]> git.saurik.com Git - apple/xnu.git/blob - libsyscall/Makefile.xbs
xnu-1228.tar.gz
[apple/xnu.git] / libsyscall / Makefile.xbs
1 BSDMAKE = bsdmake -f Makefile
2
3 .PATH: .
4 .MAIN: all
5 all: lib${LIB}.a lib${LIB}_static.a lib${LIB}_debug.a lib${LIB}_profile.a
6 install: installhdrs install_lib${LIB}.a install_lib${LIB}_static.a \
7 install_lib${LIB}_profile.a install_lib${LIB}_debug.a maninstall
8
9 .SUFFIXES:
10 .SUFFIXES: .o .po .So .do
11 .SUFFIXES: .S .s .c .cc .cpp .cxx .m .C
12 .SUFFIXES: .defs .h
13 .SUFFIXES: User.c User.o User.po User.So User.do
14 .SUFFIXES: Server.c Server.o Server.po Server.So Server.do
15
16 OBJS+= ${SRCS:N*.h:R:S/$/.o/g}
17 DOBJS+= ${OBJS:.o=.do}
18 POBJS+= ${OBJS:.o=.po} ${STATICOBJS:.o=.po}
19 SOBJS+= ${OBJS:.o=.So}
20
21 #### Standard C Rules #################################################
22 .c.o User.cUser.o Server.cServer.o:
23 ${CC} -static ${PRECFLAGS-${.IMPSRC:T}} ${CFLAGS} \
24 ${CFLAGS-${.IMPSRC:T}} -Os ${OPTIMIZE-${.IMPSRC:T}} \
25 -c ${.IMPSRC} -o ${.TARGET}
26 .c.po User.cUser.po Server.cServer.po:
27 ${CC} -pg ${PRECFLAGS-${.IMPSRC:T}} -DPROFILE ${CFLAGS} \
28 ${CFLAGS-${.IMPSRC:T}} -Os ${OPTIMIZE-${.IMPSRC:T}} \
29 -c ${.IMPSRC} -o ${.TARGET}
30 .c.So User.cUser.So Server.cServer.So:
31 ${CC} ${PRECFLAGS-${.IMPSRC:T}} ${CFLAGS} ${CFLAGS-${.IMPSRC:T}} \
32 -Os ${OPTIMIZE-${.IMPSRC:T}} -c ${.IMPSRC} -o ${.TARGET}
33 .c.do User.cUser.do Server.cServer.do:
34 ${CC} -g ${PRECFLAGS-${.IMPSRC:T}} -DDEBUG ${CFLAGS} \
35 ${CFLAGS-${.IMPSRC:T}} -c ${.IMPSRC} -o ${.TARGET}
36
37 #### Standard Assembler Rules #########################################
38 .s.o .S.o:
39 ${CC} -static -x assembler-with-cpp ${PRECFLAGS-${.IMPSRC:T}} \
40 ${AINC} ${CFLAGS:M-[BIDFU]*} ${CFLAGS-${.IMPSRC:T}:M-[BIDFU]*} \
41 -Os ${OPTIMIZE-${.IMPSRC:T}} -c ${.IMPSRC} -o ${.TARGET}
42 .s.po .S.po:
43 ${CC} -pg -x assembler-with-cpp ${PRECFLAGS-${.IMPSRC:T}} -DPROFILE \
44 ${AINC} ${CFLAGS:M-[BIDFU]*} ${CFLAGS-${.IMPSRC:T}:M-[BIDFU]*} \
45 -Os ${OPTIMIZE-${.IMPSRC:T}} -c ${.IMPSRC} -o ${.TARGET}
46 .s.So .S.So:
47 ${CC} -x assembler-with-cpp ${PRECFLAGS-${.IMPSRC:T}} \
48 ${AINC} ${CFLAGS:M-[BIDFU]*} ${CFLAGS-${.IMPSRC:T}:M-[BIDFU]*} \
49 -Os ${OPTIMIZE-${.IMPSRC:T}} -c ${.IMPSRC} -o ${.TARGET}
50 .s.do .S.do:
51 ${CC} -g -x assembler-with-cpp ${PRECFLAGS-${.IMPSRC:T}} -DDEBUG \
52 ${AINC} ${CFLAGS:M-[BIDFU]*} ${CFLAGS-${.IMPSRC:T}:M-[BIDFU]*} \
53 -c ${.IMPSRC} -o ${.TARGET}
54
55 #### mig Rules ########################################################
56 .defs.h .defsUser.c .defsServer.c:
57 mig -arch ${MACHINE_ARCH} -cc ${CC} -user ${.PREFIX}User.c -server ${.PREFIX}Server.c -header ${.PREFIX}.h ${.IMPSRC}
58
59 gen_mig_defs: ${SRVMIGHDRS} ${MIGHDRS}
60 gen_md_mig_defs: ${MD_MIGHDRS}
61
62 #### Library Rules ####################################################
63 lib${LIB}_static.a:: ${OBJS} ${STATICOBJS}
64 @${ECHO} building static ${LIB} library
65 @rm -f lib${LIB}_static.a
66 @${AR} cq lib${LIB}_static.a `lorder ${OBJS} ${STATICOBJS} | tsort -q` ${ARADD}
67 ${RANLIB} lib${LIB}_static.a
68
69 lib${LIB}_profile.a:: ${POBJS} ${POBJS2}
70 @${ECHO} building profiled ${LIB} library
71 @rm -f lib${LIB}_profile.a
72 @${AR} cq lib${LIB}_profile.a `lorder ${POBJS} | tsort -q` ${ARADD}
73 ${RANLIB} lib${LIB}_profile.a
74
75 lib${LIB}_debug.a:: ${DOBJS} ${DOBJS2}
76 @${ECHO} building debug ${LIB} library
77 @rm -f lib${LIB}_debug.a
78 @${AR} cq lib${LIB}_debug.a `lorder ${DOBJS} | tsort -q` ${ARADD}
79 ${RANLIB} lib${LIB}_debug.a
80
81 lib${LIB}.a:: ${SOBJS} ${SOBJS2}
82 @${ECHO} building standard ${LIB} library
83 @rm -f lib${LIB}.a
84 @${AR} cq lib${LIB}.a `lorder ${SOBJS} | tsort -q` ${ARADD}
85 ${RANLIB} lib${LIB}.a
86
87 CLEANFILES += ${DOBJS} lib${LIB}_static.a lib${LIB}_profile.a lib${LIB}_debug.a
88
89 INCDIR = ${DESTDIR}/usr/include
90 LOCINCDIR = ${DESTDIR}/usr/local/include
91 SYSTEMFRAMEWORK = ${DESTDIR}/System/Library/Frameworks/System.framework
92 PRIVHDRS = ${SYSTEMFRAMEWORK}/Versions/B/PrivateHeaders
93 PRIVHDRSPPC = ${PRIVHDRS}/architecture/ppc
94 KERNELFRAMEWORK = ${DESTDIR}/System/Library/Frameworks/Kernel.framework
95 PRIVKERNELHDRS = ${KERNELFRAMEWORK}/Versions/A/PrivateHeaders
96
97 installhdrs-md: gen_md_mig_defs
98 mkdir -p ${INCDIR}/mach/${MACHINE_ARCH}
99 ${INSTALL} -o 0 -c -m 444 ${MD_MIGHDRS} ${INCDIR}/mach/${MACHINE_ARCH}
100 mkdir -p ${PRIVHDRSPPC}
101 ${INSTALL} -c -m 444 ${PRIVHDRSPPCHDRS} ${PRIVHDRSPPC}
102
103 installhdrs: gen_mig_defs
104 mkdir -p ${INCDIR}/mach
105 mkdir -p ${INCDIR}/servers
106 ${INSTALL} -o 0 -c -m 444 ${MACH_INSTHDRS} ${INCDIR}/mach
107 ${INSTALL} -o 0 -c -m 444 ${SRVHDRS} ${INCDIR}/servers
108 @for i in `find ${DESTDIR}/usr/include/mach ${DESTDIR}/usr/include/servers -name \*.h`; do \
109 x=`fgrep '<mach/mig.h>' $$i | uniq -d`; \
110 if [ -n "$$x" ]; then \
111 echo patching $$i; \
112 ed - $$i < ${SRCROOT}/libsyscall/fixdups.ed; \
113 fi; \
114 done
115
116 install_lib${LIB}_static.a:
117 ${INSTALL} -c -m 444 lib${LIB}_static.a ${DESTDIR}/usr/local/lib/system/
118 install_lib${LIB}_profile.a:
119 ${INSTALL} -c -m 444 lib${LIB}_profile.a ${DESTDIR}/usr/local/lib/system
120 install_lib${LIB}_debug.a:
121 ${INSTALL} -c -m 444 lib${LIB}_debug.a ${DESTDIR}/usr/local/lib/system/
122 install_lib${LIB}.a:
123 ${INSTALL} -c -m 444 lib${LIB}.a ${DESTDIR}/usr/local/lib/system/
124
125 clean:
126 rm -f ${OBJS} ${POBJS} ${DOBJS} ${SOBJS} ${CLEANFILES}
127 rm -f lib${LIB}.a lib${LIB}_static.a lib${LIB}_profile.a \
128 lib${LIB}_debug.a