]>
Commit | Line | Data |
---|---|---|
5b2abdfb A |
1 | # This is a replacement for bsd.lib.mk for the libc project to get it |
2 | # doing the Right Thing in XBS, which is substantially different than | |
3 | # the BSD build system. | |
4 | # | |
5 | # The main problems arise when libc.a isn't meant to be static, but | |
6 | # libc_static.a is. We also build a debug version of the library | |
7 | # in addition to shared, static, and profile. Also, we build all | |
8 | # versions of libc with debugging enabled, unstripped. The BSD style | |
9 | # is to strip every object file after it is built but here, libc.a | |
10 | # will get merged into the larger libSystem.dylib, which will eventually | |
11 | # be stripped. We also don't build a libc.dylib, since it will be | |
12 | # munged into libSystem.dylib. | |
13 | # | |
14 | # And another difference, B&I wishes to build the 4 incarnations of Libc | |
15 | # in parallel on different machines. To do this, we must look at the | |
16 | # RC_ProjectName variable (which B&I sets) to determine which of the 4 | |
17 | # versions of Libc we will be building. Remember that the installhdrs | |
18 | # pass should only be invoked on one of the 4 versions, and man pages | |
19 | # should only be installed once as well. Both of these get done when | |
20 | # we're invoked as "Libc". | |
21 | ||
22 | .PATH: . | |
23 | .MAIN: all | |
24 | all: libc.a libc_static.a libc_debug.a libc_profile.a | |
25 | install: installhdrs install_libc.a install_libc_static.a \ | |
26 | install_libc_profile.a install_libc_debug.a maninstall | |
27 | ||
28 | .SUFFIXES: | |
29 | .SUFFIXES: .o .po .So .do .S .s .c .cc .cpp .cxx .m .C .f .y .l .defs .h | |
30 | ||
31 | OBJS+= ${SRCS:N*.h:R:S/$/.o/g} | |
32 | POBJS+= ${OBJS:.o=.po} ${STATICOBJS:.o=.po} | |
33 | SOBJS+= ${OBJS:.o=.So} | |
34 | ||
35 | .c.o: | |
36 | ${CC} -static ${CFLAGS} -c ${.IMPSRC} -o ${.TARGET} | |
37 | .c.po: | |
38 | ${CC} -pg -DPROFILE ${CFLAGS} -Os -c ${.IMPSRC} -o ${.TARGET} | |
39 | .c.So: | |
40 | ${CC} ${CFLAGS} -Os -c ${.IMPSRC} -o ${.TARGET} | |
41 | .c.do: | |
42 | ${CC} -g -DDEBUG ${CFLAGS} -c ${.IMPSRC} -o ${.TARGET} | |
43 | .s.o: | |
44 | ${CC} -x assembler-with-cpp ${CFLAGS:M-[BID]*} -static ${AINC} -c \ | |
45 | ${.IMPSRC} -o ${.TARGET} | |
46 | .s.po: | |
47 | ${CC} -pg -DPROFILE -x assembler-with-cpp ${CFLAGS:M-[BID]*} -Os \ | |
48 | ${AINC} -c ${.IMPSRC} -o ${.TARGET} | |
49 | .s.So: | |
50 | ${CC} -x assembler-with-cpp \ | |
51 | ${CFLAGS:M-[BID]*} -Os ${AINC} -c ${.IMPSRC} -o ${.TARGET} | |
52 | .s.do: | |
53 | ${CC} -DDEBUG -g -x assembler-with-cpp ${CFLAGS:M-[BID]*} ${AINC} -c \ | |
54 | ${.IMPSRC} -o ${.TARGET} | |
55 | .defs.h: | |
56 | mig -user ${.TARGET:S/.h$/User.c/} \ | |
57 | -server ${.TARGET:S/.h$/Server.c/} -header ${.TARGET} ${.IMPSRC} | |
58 | ||
59 | gen_mig_defs: ${SRVMIGHDRS} ${MIGHDRS} | |
60 | lib${LIB}_static.a:: ${OBJS} ${STATICOBJS} | |
61 | @${ECHO} building static ${LIB} library | |
62 | @rm -f lib${LIB}_static.a | |
63 | @${AR} cq lib${LIB}_static.a `lorder ${OBJS} ${STATICOBJS} | tsort -q` ${ARADD} | |
64 | ${RANLIB} lib${LIB}_static.a | |
65 | ||
66 | lib${LIB}_profile.a:: ${POBJS} | |
67 | @${ECHO} building profiled ${LIB} library | |
68 | @rm -f lib${LIB}_profile.a | |
69 | @${AR} cq lib${LIB}_profile.a `lorder ${POBJS} | tsort -q` ${ARADD} | |
70 | ${RANLIB} lib${LIB}_profile.a | |
71 | ||
72 | DOBJS+= ${OBJS:.o=.do} | |
73 | lib${LIB}_debug.a:: ${DOBJS} | |
74 | @${ECHO} building debug ${LIB} library | |
75 | @rm -f lib${LIB}_debug.a | |
76 | @${AR} cq lib${LIB}_debug.a `lorder ${DOBJS} | tsort -q` ${ARADD} | |
77 | ${RANLIB} lib${LIB}_debug.a | |
78 | ||
79 | lib${LIB}.a:: ${SOBJS} | |
80 | @${ECHO} building standard ${LIB} library | |
81 | @rm -f lib${LIB}.a | |
82 | @${AR} cq lib${LIB}.a `lorder ${SOBJS} | tsort -q` ${ARADD} | |
83 | ${RANLIB} lib${LIB}.a | |
84 | ||
85 | CLEANFILES += ${DOBJS} libc_static.a libc_profile.a libc_debug.a | |
86 | ||
734aad71 A |
87 | # XXX not used here yet, but used in Makefile |
88 | SYSTEMFRAMEWORK = ${DESTDIR}/System/Library/Frameworks/System.framework | |
89 | PRIVHDRS = ${SYSTEMFRAMEWORK}/Versions/B/PrivateHeaders | |
90 | ||
5b2abdfb A |
91 | installhdrs: gen_mig_defs |
92 | mkdir -p ${DESTDIR}/usr/include/arpa | |
93 | mkdir -p ${DESTDIR}/usr/include/protocols | |
94 | mkdir -p ${DESTDIR}/usr/include/mach | |
95 | mkdir -p ${DESTDIR}/usr/include/objc | |
96 | mkdir -p ${DESTDIR}/usr/include/servers | |
97 | ${INSTALL} -c -m 444 ${INSTHDRS} ${DESTDIR}/usr/include | |
98 | ${INSTALL} -c -m 444 ${ARPA_INSTHDRS} ${DESTDIR}/usr/include/arpa | |
99 | ${INSTALL} -c -m 444 ${PROTO_INSTHDRS} ${DESTDIR}/usr/include/protocols | |
100 | ${INSTALL} -c -m 444 ${MACH_INSTHDRS} ${DESTDIR}/usr/include/mach | |
101 | ${INSTALL} -c -m 444 ${OBJC_INSTHDRS} ${DESTDIR}/usr/include/objc | |
102 | ${INSTALL} -c -m 444 ${SRVHDRS} ${DESTDIR}/usr/include/servers | |
103 | mv ${DESTDIR}/usr/include/servers/srvbootstrap.h ${DESTDIR}/usr/include/servers/bootstrap.h | |
104 | mkdir -p ${DESTDIR}/System/Library/Frameworks/System.framework/Versions/B/PrivateHeaders/ | |
105 | mkdir -p ${DESTDIR}/System/Library/Frameworks/System.framework/Versions/B/PrivateHeaders/architecture | |
106 | mkdir -p ${DESTDIR}/System/Library/Frameworks/System.framework/Versions/B/PrivateHeaders/architecture/ppc | |
107 | mkdir -p ${DESTDIR}/System/Library/Frameworks/System.framework/Versions/B/PrivateHeaders/btree | |
108 | mkdir -p ${DESTDIR}/System/Library/Frameworks/System.framework/Versions/B/PrivateHeaders/machine | |
109 | mkdir -p ${DESTDIR}/System/Library/Frameworks/System.framework/Versions/B/PrivateHeaders/objc | |
110 | install -c -m 444 ${SRCROOT}/db/btree/btree.h ${DESTDIR}/System/Library/Frameworks/System.framework/Versions/B/PrivateHeaders/btree | |
111 | install -c -m 444 ${SRCROOT}/db/btree/bt_extern.h ${DESTDIR}/System/Library/Frameworks/System.framework/Versions/B/PrivateHeaders/btree | |
112 | install -c -m 444 ${SRCROOT}/ppc/sys/processor_facilities.h ${DESTDIR}/System/Library/Frameworks/System.framework/Versions/B/PrivateHeaders/architecture/ppc | |
113 | install -c -m 444 ${SRCROOT}/internat/NXCType.h ${DESTDIR}/System/Library/Frameworks/System.framework/Versions/B/PrivateHeaders/objc | |
114 | install -c -m 444 ${SRCROOT}/gen/stack_logging.h ${DESTDIR}/System/Library/Frameworks/System.framework/Versions/B/PrivateHeaders/ | |
115 | mv ${DESTDIR}/usr/include/asm.h ${DESTDIR}/System/Library/Frameworks/System.framework/Versions/B/PrivateHeaders/machine | |
116 | ||
117 | install_lib${LIB}_static.a: | |
118 | ${INSTALL} -c -m 444 lib${LIB}_static.a ${DESTDIR}/usr/local/lib/system/ | |
119 | install_lib${LIB}_profile.a: | |
120 | ${INSTALL} -c -m 444 lib${LIB}_profile.a ${DESTDIR}/usr/local/lib/system | |
121 | install_lib${LIB}_debug.a: | |
122 | ${INSTALL} -c -m 444 lib${LIB}_debug.a ${DESTDIR}/usr/local/lib/system/ | |
123 | install_lib${LIB}.a: | |
124 | ${INSTALL} -c -m 444 lib${LIB}.a ${DESTDIR}/usr/local/lib/system/ | |
125 | ||
126 | clean: | |
127 | rm -f ${OBJS} ${POBJS} ${DOBJS} ${SOBJS} ${CLEANFILES} | |
128 | rm -f lib${LIB}.a lib${LIB}_static.a lib${LIB}_profile.a \ | |
129 | lib${LIB}_debug.a |