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
19 NARCHS != echo $(RC_ARCHS) | wc -w
20 LIBSYS = $(SDKROOT)/usr/local/lib/system
21 NJOBS != perl -e '$$n = `/usr/sbin/sysctl -n hw.ncpu`; printf "%d\n", $$n < 2 ? 2 : ($$n * 1.5)'
22 BSDMAKE = bsdmake -f Makefile
23 BSDMAKEJ = $(BSDMAKE) -j $(NJOBS)
25 # This variables are to guarantee that the left-hand side of an expression is
30 # Remove the arch stuff, since we know better here.
31 LOCAL_CFLAGS != echo $(RC_CFLAGS) | sed 's/ *-arch [^ ][^ ]*//g'
33 FORMS := debug dynamic profile static
37 build: build-debug build-dynamic build-profile build-static
39 # These are the non B&I defaults
40 .ifndef RC_ProjectName
41 install: installhdrs install-all
43 .else # RC_ProjectName
47 install: BI-install-$(F)
50 install -c -m 444 $(OBJROOT)/sys/libsyscall.list $(DSTROOT)/usr/local/lib/system
51 .endif # RC_ProjectName
54 .if $(dynamic) == $(F)
59 LIPOARGS$(F) != perl -e 'printf "%s\n", join(" ", map(qq(-arch $$_ \"$(OBJROOT)/obj.$$_/libsyscall$(SUFFIX$(F)).a\"), qw($(RC_ARCHS))))'
62 build-$(F): build-$(A)-$(F)
67 cp -p "$(OBJROOT)/obj.$(RC_ARCHS)/libsyscall$(SUFFIX$(F)).a" "$(SYMROOT)"
69 xcrun -sdk $(SDKROOT) lipo -create $(LIPOARGS$(F)) -output $(SYMROOT)/libsyscall$(SUFFIX$(F)).a
74 mkdir -p $(OBJROOT)/obj.$(A) && \
75 MAKEOBJDIR="$(OBJROOT)/obj.$(A)" MACHINE_ARCH="$(A)" \
76 DSTROOT='$(DSTROOT)' OBJROOT='$(OBJROOT)' SYMROOT='$(SYMROOT)' \
77 MAKEFLAGS="" MIGDEFINES="" CFLAGS="-arch $(A) $(LOCAL_CFLAGS)" $(BSDMAKEJ) libsyscall$(SUFFIX$(F)).a
82 MAKEOBJDIR="$(OBJROOT)" DESTDIR="$(DSTROOT)" MAKEFLAGS="" \
83 DSTROOT='$(DSTROOT)' OBJROOT='$(OBJROOT)' SYMROOT='$(SYMROOT)' \
84 MIGDEFINES="-DLIBSYSCALL_INTERFACE=1" \
85 $(BSDMAKE) installhdrs
87 mkdir -p "$(OBJROOT)/obj.$(A)" && \
88 MAKEOBJDIR="$(OBJROOT)/obj.$(A)" MACHINE_ARCH="$(A)" \
89 DSTROOT='$(DSTROOT)' OBJROOT='$(OBJROOT)' SYMROOT='$(SYMROOT)' \
90 MAKEFLAGS="" MIGDEFINES="" $(BSDMAKE) installhdrs-md
94 BI-install-$(F): build-$(F)
95 mkdir -p $(DSTROOT)/usr/local/lib/system
96 if [ -f "$(SYMROOT)/libsyscall$(SUFFIX$(F)).a" ]; then \
97 echo "Installing libsyscall$(SUFFIX$(F)).a" && \
98 install -c -m 644 "$(SYMROOT)/libsyscall$(SUFFIX$(F)).a" \
99 $(DSTROOT)/usr/local/lib/system && \
100 ranlib "$(DSTROOT)/usr/local/lib/system/libsyscall$(SUFFIX$(F)).a"; \
101 chmod 444 "$(DSTROOT)/usr/local/lib/system/libsyscall$(SUFFIX$(F)).a"; \
106 mkdir -p $(DSTROOT)/usr/share/man/man2
107 MAKEOBJDIR="$(OBJROOT)" DESTDIR="$(DSTROOT)" \
108 DSTROOT='$(DSTROOT)' OBJROOT='$(OBJROOT)' SYMROOT='$(SYMROOT)' \
109 MACHINE_ARCH="$(ARCH)" MAKEFLAGS="" $(BSDMAKE) all-man maninstall
111 install-all: setup build install-man
113 install-all: BI-install-$(F)
118 rm -f $(OBJROOT)/libsyscall$(SUFFIX$(F)).a
120 .for A in $(RC_ARCHS)
121 rm -rf $(OBJROOT)/obj.$(A)
124 INCLUDEDIR = $(OBJROOT)/include
125 SYSDIR = $(OBJROOT)/sys
127 setup: $(INCLUDEDIR) $(SYSDIR)
129 USR-INCLUDE = /usr/include
130 MOD-HEADERS = architecture/ppc/mode_independent_asm.h architecture/i386/asm_help.h
133 mkdir -p $(INCLUDEDIR)
134 .for h in $(MOD-HEADERS)
135 mkdir -p $(INCLUDEDIR)/$(h:H)
136 sed 's/\.globl/.private_extern/g' $(USR-INCLUDE)/$(h) > $(INCLUDEDIR)/$(h)
137 .endfor # MOD-HEADERS
141 $(SRCROOT)/libsyscall/create-syscalls.pl $(SRCROOT)/bsd/kern/syscalls.master $(SRCROOT)/libsyscall/custom $(SYSDIR)