]> git.saurik.com Git - apple/xnu.git/blobdiff - SETUP/config/mkmakefile.c
xnu-7195.101.1.tar.gz
[apple/xnu.git] / SETUP / config / mkmakefile.c
index 9614ba1952fd586e474dbece9b39f74656f41570..a17fef6097305a4a381164fc5945923013582022 100644 (file)
@@ -65,7 +65,7 @@ static char sccsid[] __attribute__((used)) = "@(#)mkmakefile.c        5.21 (Berkeley) 6
 #include "config.h"
 
 void    read_files(void);
-void    do_objs(FILE *fp, const char *msg, int ext);
+void    do_objs(FILE *fp, const char *msg, int ext, int flags);
 void    do_files(FILE *fp, const char *msg, char ext);
 void    do_machdep(FILE *ofp);
 void    do_rules(FILE *f);
@@ -243,16 +243,18 @@ makefile(void)
                continue;
 percent:
                if (eq(line, "%OBJS\n")) {
-                       do_objs(ofp, "OBJS=", -1);
+                       do_objs(ofp, "OBJS=", -1, 0);
+               } else if (eq(line, "%LIBOBJS\n")) {
+                       do_objs(ofp, "LIBOBJS=", -1, LIBRARYDEP);
                } else if (eq(line, "%CFILES\n")) {
                        do_files(ofp, "CFILES=", 'c');
-                       do_objs(ofp, "COBJS=", 'c');
+                       do_objs(ofp, "COBJS=", 'c', 0);
                } else if (eq(line, "%CXXFILES\n")) {
                        do_files(ofp, "CXXFILES=", 'p');
-                       do_objs(ofp, "CXXOBJS=", 'p');
+                       do_objs(ofp, "CXXOBJS=", 'p', 0);
                } else if (eq(line, "%SFILES\n")) {
                        do_files(ofp, "SFILES=", 's');
-                       do_objs(ofp, "SOBJS=", 's');
+                       do_objs(ofp, "SOBJS=", 's', 0);
                } else if (eq(line, "%MACHDEP\n")) {
                        do_machdep(ofp);
                } else if (eq(line, "%RULES\n")) {
@@ -287,6 +289,7 @@ read_files(void)
        const char *devorprof;
        int options;
        int not_option;
+       int for_xnu_lib;
        char pname[BUFSIZ];
        char fname[1024];
        char *rest = (char *) 0;
@@ -346,6 +349,7 @@ next:
        nreqs = 0;
        devorprof = "";
        needs = 0;
+       for_xnu_lib = 0;
        if (eq(wd, "standard")) {
                goto checkdev;
        }
@@ -371,6 +375,10 @@ nextopt:
                next_word(fp, wd);
                goto save;
        }
+       if (eq(wd, "xnu-library")) {
+               for_xnu_lib = 1;
+               goto nextopt;
+       }
        nreqs++;
        if (needs == 0 && nreqs == 1) {
                needs = ns(wd);
@@ -469,6 +477,10 @@ checkdev:
                        goto getrest;
                }
                next_word(fp, wd);
+               if (wd && eq(wd, "xnu-library")) {
+                       for_xnu_lib = 1;
+                       next_word(fp, wd);
+               }
                if (wd) {
                        devorprof = wd;
                        next_word(fp, wd);
@@ -508,6 +520,9 @@ getrest:
        if (pf && pf->f_type == INVISIBLE) {
                pf->f_flags = 1;                /* mark as duplicate */
        }
+       if (for_xnu_lib) {
+               tp->f_flags |= LIBRARYDEP;
+       }
        goto next;
 }
 
@@ -541,7 +556,7 @@ put_source_file_name(FILE *fp, struct file_list *tp)
 }
 
 void
-do_objs(FILE *fp, const char *msg, int ext)
+do_objs(FILE *fp, const char *msg, int ext, int flags)
 {
        struct file_list *tp;
        int lpos, len;
@@ -556,6 +571,13 @@ do_objs(FILE *fp, const char *msg, int ext)
                        continue;
                }
 
+               /*
+                * Check flags (if any)
+                */
+               if (flags && ((tp->f_flags & flags) != flags)) {
+                       continue;
+               }
+
                /*
                 *      Check for '.o' file in list
                 */