2 DSTROOT != x=`pwd`/DSTROOT && mkdir -p $$x && echo $$x
5 OBJROOT != x=`pwd`/OBJROOT && mkdir -p $$x && echo $$x
8 SRCROOT != dirname `pwd`
11 SYMROOT != x=`pwd`/SYMROOT && mkdir -p $$x && echo $$x
18 NARCHS != echo $(RC_ARCHS) | wc -w
19 LIBSYS = $(SDKROOT)/usr/local/lib/system
20 NJOBS != perl -e '$$n = `/usr/sbin/sysctl -n hw.ncpu`; printf "%d\n", $$n < 2 ? 2 : ($$n * 1.5)'
21 BSDMAKE = bsdmake -f Makefile
22 BSDMAKEJ = $(BSDMAKE) -j $(NJOBS)
24 # This variables are to guarantee that the left-hand side of an expression is
29 # Remove the arch stuff, since we know better here.
30 LOCAL_CFLAGS != echo $(RC_CFLAGS) | sed 's/ *-arch [^ ][^ ]*//g'
32 FORMS := debug dynamic profile static
36 build: build-debug build-dynamic build-profile build-static
38 # These are the non B&I defaults
39 .ifndef RC_ProjectName
40 install: installhdrs install-all
42 .else # RC_ProjectName
46 install: BI-install-$(F)
49 install -c -m 444 $(OBJROOT)/sys/libsyscall.list $(DSTROOT)/usr/local/lib/system
50 .endif # RC_ProjectName
53 .if $(dynamic) == $(F)
58 LIPOARGS$(F) != perl -e 'printf "%s\n", join(" ", map(qq(-arch $$_ \"$(OBJROOT)/obj.$$_/libsyscall$(SUFFIX$(F)).a\"), qw($(RC_ARCHS))))'
61 build-$(F): build-$(A)-$(F)
65 cp -p "$(OBJROOT)/obj.$(RC_ARCHS)/libsyscall$(SUFFIX$(F)).a" "$(SYMROOT)"
67 lipo -create $(LIPOARGS$(F)) -output $(SYMROOT)/libsyscall$(SUFFIX$(F)).a
72 mkdir -p $(OBJROOT)/obj.$(A) && \
73 MAKEOBJDIR="$(OBJROOT)/obj.$(A)" MACHINE_ARCH="$(A)" \
74 DSTROOT='$(DSTROOT)' OBJROOT='$(OBJROOT)' SYMROOT='$(SYMROOT)' \
75 MAKEFLAGS="" CFLAGS="-arch $(A) $(LOCAL_CFLAGS)" $(BSDMAKEJ) libsyscall$(SUFFIX$(F)).a
80 MAKEOBJDIR="$(OBJROOT)" DESTDIR="$(DSTROOT)" MAKEFLAGS="" \
81 DSTROOT='$(DSTROOT)' OBJROOT='$(OBJROOT)' SYMROOT='$(SYMROOT)' \
82 $(BSDMAKE) installhdrs
84 mkdir -p "$(OBJROOT)/obj.$(A)" && \
85 MAKEOBJDIR="$(OBJROOT)/obj.$(A)" MACHINE_ARCH="$(A)" \
86 DSTROOT='$(DSTROOT)' OBJROOT='$(OBJROOT)' SYMROOT='$(SYMROOT)' \
87 MAKEFLAGS="" $(BSDMAKE) installhdrs-md
91 BI-install-$(F): build-$(F)
92 mkdir -p $(DSTROOT)/usr/local/lib/system
93 if [ -f "$(SYMROOT)/libsyscall$(SUFFIX$(F)).a" ]; then \
94 echo "Installing libsyscall$(SUFFIX$(F)).a" && \
95 install -c -m 444 "$(SYMROOT)/libsyscall$(SUFFIX$(F)).a" \
96 $(DSTROOT)/usr/local/lib/system && \
97 ranlib "$(DSTROOT)/usr/local/lib/system/libsyscall$(SUFFIX$(F)).a"; \
102 mkdir -p $(DSTROOT)/usr/share/man/man2
103 MAKEOBJDIR="$(OBJROOT)" DESTDIR="$(DSTROOT)" \
104 DSTROOT='$(DSTROOT)' OBJROOT='$(OBJROOT)' SYMROOT='$(SYMROOT)' \
105 MACHINE_ARCH="$(ARCH)" MAKEFLAGS="" $(BSDMAKE) all-man maninstall
107 install-all: setup build install-man
109 install-all: BI-install-$(F)
114 rm -f $(OBJROOT)/libsyscall$(SUFFIX$(F)).a
116 .for A in $(RC_ARCHS)
117 rm -rf $(OBJROOT)/obj.$(A)
120 INCLUDEDIR = $(OBJROOT)/include
121 SYSDIR = $(OBJROOT)/sys
123 setup: $(INCLUDEDIR) $(SYSDIR)
125 USR-INCLUDE = /usr/include
126 MOD-HEADERS = architecture/ppc/mode_independent_asm.h architecture/i386/asm_help.h
129 mkdir -p $(INCLUDEDIR)
130 .for h in $(MOD-HEADERS)
131 mkdir -p $(INCLUDEDIR)/$(h:H)
132 sed 's/\.globl/.private_extern/g' $(USR-INCLUDE)/$(h) > $(INCLUDEDIR)/$(h)
133 .endfor # MOD-HEADERS
137 $(SRCROOT)/libsyscall/create-syscalls.pl $(SRCROOT)/bsd/kern/syscalls.master $(SRCROOT)/libsyscall/custom $(SYSDIR)