]>
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 \ | |
9385eb3d | 26 | install_libc_profile.a install_libc_debug.a fbsdman maninstall |
5b2abdfb A |
27 | |
28 | .SUFFIXES: | |
9385eb3d A |
29 | .SUFFIXES: .o .po .So .do .S .s -fbsd.c .c .cc .cpp .cxx .m .C .f .y .l .defs .h |
30 | .SUFFIXES: User.c User.o User.po User.So User.do | |
31 | .SUFFIXES: Server.c Server.o Server.po Server.So Server.do | |
5b2abdfb A |
32 | |
33 | OBJS+= ${SRCS:N*.h:R:S/$/.o/g} | |
34 | POBJS+= ${OBJS:.o=.po} ${STATICOBJS:.o=.po} | |
35 | SOBJS+= ${OBJS:.o=.So} | |
9385eb3d | 36 | FBSDFLAGS= -I${.CURDIR}/fbsdcompat -include _fbsd_compat_.h |
5b2abdfb | 37 | |
9385eb3d A |
38 | -fbsd.c.o: |
39 | ${CC} -static ${FBSDFLAGS} ${CFLAGS} -Os -c ${.IMPSRC} -o ${.TARGET} | |
40 | .c.o User.cUser.o Server.cServer.o: | |
41 | ${CC} -static ${CFLAGS} -Os -c ${.IMPSRC} -o ${.TARGET} | |
42 | -fbsd.c.po: | |
43 | ${CC} -pg -DPROFILE ${FBSDFLAGS} ${CFLAGS} -Os -c ${.IMPSRC} \ | |
44 | -o ${.TARGET} | |
45 | .c.po User.cUser.po Server.cServer.po: | |
5b2abdfb | 46 | ${CC} -pg -DPROFILE ${CFLAGS} -Os -c ${.IMPSRC} -o ${.TARGET} |
9385eb3d A |
47 | -fbsd.c.So: |
48 | ${CC} ${FBSDFLAGS} ${CFLAGS} -Os -c ${.IMPSRC} -o ${.TARGET} | |
49 | .c.So User.cUser.So Server.cServer.So: | |
5b2abdfb | 50 | ${CC} ${CFLAGS} -Os -c ${.IMPSRC} -o ${.TARGET} |
9385eb3d A |
51 | -fbsd.c.do: |
52 | ${CC} -g -DDEBUG ${FBSDFLAGS} ${CFLAGS} -c ${.IMPSRC} -o ${.TARGET} | |
53 | .c.do User.cUser.do Server.cServer.do: | |
5b2abdfb | 54 | ${CC} -g -DDEBUG ${CFLAGS} -c ${.IMPSRC} -o ${.TARGET} |
9385eb3d A |
55 | -fbsd.s.o: |
56 | ${CC} -x assembler-with-cpp ${FBSDFLAGS} ${CFLAGS:M-[BID]*} \ | |
57 | -static ${AINC} -c ${.IMPSRC} -o ${.TARGET} | |
5b2abdfb A |
58 | .s.o: |
59 | ${CC} -x assembler-with-cpp ${CFLAGS:M-[BID]*} -static ${AINC} -c \ | |
9385eb3d A |
60 | ${.IMPSRC} -o ${.TARGET} |
61 | -fbsd.s.po: | |
62 | ${CC} -pg -DPROFILE -x assembler-with-cpp ${FBSDFLAGS} \ | |
63 | ${CFLAGS:M-[BID]*} -Os ${AINC} -c ${.IMPSRC} -o ${.TARGET} | |
5b2abdfb A |
64 | .s.po: |
65 | ${CC} -pg -DPROFILE -x assembler-with-cpp ${CFLAGS:M-[BID]*} -Os \ | |
9385eb3d A |
66 | ${AINC} -c ${.IMPSRC} -o ${.TARGET} |
67 | -fbsd.s.So: | |
68 | ${CC} -x assembler-with-cpp ${FBSDFLAGS} \ | |
69 | ${CFLAGS:M-[BID]*} -Os ${AINC} -c ${.IMPSRC} -o ${.TARGET} | |
5b2abdfb A |
70 | .s.So: |
71 | ${CC} -x assembler-with-cpp \ | |
9385eb3d A |
72 | ${CFLAGS:M-[BID]*} -Os ${AINC} -c ${.IMPSRC} -o ${.TARGET} |
73 | -fbsd.s.do: | |
74 | ${CC} -DDEBUG -g -x assembler-with-cpp ${FBSDFLAGS} ${CFLAGS:M-[BID]*} \ | |
75 | ${AINC} -c ${.IMPSRC} -o ${.TARGET} | |
5b2abdfb A |
76 | .s.do: |
77 | ${CC} -DDEBUG -g -x assembler-with-cpp ${CFLAGS:M-[BID]*} ${AINC} -c \ | |
9385eb3d A |
78 | ${.IMPSRC} -o ${.TARGET} |
79 | .defs.h .defsUser.c .defsServer.c: | |
80 | mig -arch ${MACHINE_ARCH} -user ${.PREFIX}User.c -server ${.PREFIX}Server.c -header ${.PREFIX}.h ${.IMPSRC} | |
5b2abdfb | 81 | |
9385eb3d A |
82 | gen_mig_defs: ${SRVMIGHDRS} ${MIGHDRS} |
83 | gen_md_mig_defs: ${MD_MIGHDRS} | |
84 | ||
85 | lib${LIB}_static.a:: ${FBSDHDRS} ${OBJS} ${STATICOBJS} | |
5b2abdfb A |
86 | @${ECHO} building static ${LIB} library |
87 | @rm -f lib${LIB}_static.a | |
88 | @${AR} cq lib${LIB}_static.a `lorder ${OBJS} ${STATICOBJS} | tsort -q` ${ARADD} | |
89 | ${RANLIB} lib${LIB}_static.a | |
90 | ||
9385eb3d | 91 | lib${LIB}_profile.a:: ${FBSDHDRS} ${POBJS} |
5b2abdfb A |
92 | @${ECHO} building profiled ${LIB} library |
93 | @rm -f lib${LIB}_profile.a | |
94 | @${AR} cq lib${LIB}_profile.a `lorder ${POBJS} | tsort -q` ${ARADD} | |
95 | ${RANLIB} lib${LIB}_profile.a | |
96 | ||
97 | DOBJS+= ${OBJS:.o=.do} | |
9385eb3d | 98 | lib${LIB}_debug.a:: ${FBSDHDRS} ${DOBJS} |
5b2abdfb A |
99 | @${ECHO} building debug ${LIB} library |
100 | @rm -f lib${LIB}_debug.a | |
101 | @${AR} cq lib${LIB}_debug.a `lorder ${DOBJS} | tsort -q` ${ARADD} | |
102 | ${RANLIB} lib${LIB}_debug.a | |
103 | ||
9385eb3d | 104 | lib${LIB}.a:: ${FBSDHDRS} ${SOBJS} |
5b2abdfb A |
105 | @${ECHO} building standard ${LIB} library |
106 | @rm -f lib${LIB}.a | |
107 | @${AR} cq lib${LIB}.a `lorder ${SOBJS} | tsort -q` ${ARADD} | |
108 | ${RANLIB} lib${LIB}.a | |
109 | ||
110 | CLEANFILES += ${DOBJS} libc_static.a libc_profile.a libc_debug.a | |
111 | ||
9385eb3d A |
112 | INCDIR = ${DESTDIR}/usr/include |
113 | LOCINCDIR = ${DESTDIR}/usr/local/include | |
114 | SYSTEMFRAMEWORK = ${DESTDIR}/System/Library/Frameworks/System.framework | |
115 | PRIVHDRS = ${SYSTEMFRAMEWORK}/Versions/B/PrivateHeaders | |
116 | ||
117 | installhdrs-md: gen_md_mig_defs | |
118 | mkdir -p ${INCDIR}/mach/${MACHINE_ARCH} | |
119 | ${INSTALL} -c -m 444 ${MD_MIGHDRS} ${INCDIR}/mach/${MACHINE_ARCH} | |
120 | ||
121 | installhdrs: ${FBSDHDRS} gen_mig_defs | |
122 | mkdir -p ${INCDIR}/arpa | |
123 | mkdir -p ${INCDIR}/mach | |
124 | mkdir -p ${INCDIR}/malloc | |
125 | mkdir -p ${INCDIR}/objc | |
126 | mkdir -p ${INCDIR}/protocols | |
127 | mkdir -p ${INCDIR}/servers | |
128 | ${INSTALL} -c -m 444 ${INSTHDRS} ${INCDIR} | |
129 | ${INSTALL} -c -m 444 ${ARPA_INSTHDRS} ${INCDIR}/arpa | |
130 | ${INSTALL} -c -m 444 ${MACH_INSTHDRS} ${INCDIR}/mach | |
131 | ${INSTALL} -c -m 444 ${MALLOC_INSTHDRS} ${INCDIR}/malloc | |
132 | ${INSTALL} -c -m 444 ${OBJC_INSTHDRS} ${INCDIR}/objc | |
133 | ${INSTALL} -c -m 444 ${PROTO_INSTHDRS} ${INCDIR}/protocols | |
134 | ${INSTALL} -c -m 444 ${SRVHDRS} ${INCDIR}/servers | |
135 | mkdir -p ${LOCINCDIR} | |
136 | ${INSTALL} -c -m 444 ${LOCALHDRS} ${LOCINCDIR} | |
137 | mkdir -p ${PRIVHDRS}/architecture/ppc | |
138 | mkdir -p ${PRIVHDRS}/btree | |
139 | mkdir -p ${PRIVHDRS}/machine | |
140 | mkdir -p ${PRIVHDRS}/objc | |
141 | ${INSTALL} -c -m 444 ${SRCROOT}/ppc/sys/processor_facilities.h ${PRIVHDRS}/architecture/ppc | |
142 | ${INSTALL} -c -m 444 ${SRCROOT}/db/btree/btree.h ${PRIVHDRS}/btree | |
143 | ${INSTALL} -c -m 444 ${SRCROOT}/db/btree/bt_extern.h ${PRIVHDRS}/btree | |
144 | ${INSTALL} -c -m 444 ${SRCROOT}/internat/NXCType.h ${PRIVHDRS}/objc | |
145 | ${INSTALL} -c -m 444 ${SRCROOT}/gen/stack_logging.h ${PRIVHDRS} | |
146 | mv ${DESTDIR}/usr/include/asm.h ${PRIVHDRS}/machine | |
147 | mv ${INCDIR}/servers/srvbootstrap.h ${INCDIR}/servers/bootstrap.h | |
5b2abdfb A |
148 | |
149 | install_lib${LIB}_static.a: | |
150 | ${INSTALL} -c -m 444 lib${LIB}_static.a ${DESTDIR}/usr/local/lib/system/ | |
151 | install_lib${LIB}_profile.a: | |
152 | ${INSTALL} -c -m 444 lib${LIB}_profile.a ${DESTDIR}/usr/local/lib/system | |
153 | install_lib${LIB}_debug.a: | |
154 | ${INSTALL} -c -m 444 lib${LIB}_debug.a ${DESTDIR}/usr/local/lib/system/ | |
155 | install_lib${LIB}.a: | |
156 | ${INSTALL} -c -m 444 lib${LIB}.a ${DESTDIR}/usr/local/lib/system/ | |
157 | ||
9385eb3d A |
158 | fbsdman: ${FBSDPATCHMAN} |
159 | ||
5b2abdfb A |
160 | clean: |
161 | rm -f ${OBJS} ${POBJS} ${DOBJS} ${SOBJS} ${CLEANFILES} | |
162 | rm -f lib${LIB}.a lib${LIB}_static.a lib${LIB}_profile.a \ | |
163 | lib${LIB}_debug.a |