modified: nfig1.py
[GalaxyCodeBases.git] / c_cpp / Mac / Csu-85 / Makefile
blobe8b23896f153f18130f33ce4d37ce9e53c986c59
1 CC = $(shell xcrun -sdk "$(SDKROOT)" -find clang)
2 ifneq (,$(SDKROOT))
3 SDK_DIR = $(shell xcodebuild -version -sdk "$(SDKROOT)" Path)
4 endif
6 OFLAG = -Os
7 CFLAGS = $(OFLAG) -Wall $(RC_NONARCH_CFLAGS)
9 SRCROOT = .
10 SYMROOT = .
11 OBJROOT = .
13 PAX = /bin/pax -rw
14 MKDIR = /bin/mkdir -p
15 CHMOD = /bin/chmod
16 LIPO = /usr/bin/lipo
18 ifeq (,$(RC_ARCHS))
19 # build for the local arch only
20 ARCH_CFLAGS ?= -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include
21 # ARCH_CFLAGS = -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/usr/include
22 else
23 # assume the toolchain supports static compilation for all request archs
24 ARCH_CFLAGS = $(patsubst %,-arch %,$(RC_ARCHS))
25 ifneq (,$(SDK_DIR))
26 ARCH_CFLAGS := $(ARCH_CFLAGS) -isysroot $(SDK_DIR)
27 endif
28 endif
30 # v1 = MacOSX 10.4 and earlier, iPhone n/a
31 # v2 = MacOSX 10.5 and later, iPhone 2.0 or later
32 # v3 = MacOSX 10.6 and later, iPhone 2.0 or later
33 # v4 = MacOSX 10.6 and later, iPhone 3.1 or later
35 ifeq (,$(RC_PURPLE))
36 OS_MIN_V1 = -mmacosx-version-min=10.4
37 OS_MIN_V2 = -mmacosx-version-min=10.5
38 OS_MIN_V3 = -mmacosx-version-min=10.6
39 OS_MIN_V4 = -mmacosx-version-min=10.6
40 INSTALL_TARGET = install_macosx
41 else
42 ifeq (,$(RC_INDIGO))
43 OS_MIN_V2 = -miphoneos-version-min=2.0
44 OS_MIN_V3 = -miphoneos-version-min=2.0
45 OS_MIN_V4 = -miphoneos-version-min=3.1
46 INSTALL_TARGET = install_iphone
47 else
48 OS_MIN_V2 = -mmacosx-version-min=10.5
49 OS_MIN_V3 = -mmacosx-version-min=10.5
50 OS_MIN_V4 = -mmacosx-version-min=10.6
51 INSTALL_TARGET = install_ios_simulator
52 endif
53 endif
55 USRLIBDIR = /usr/lib
56 LOCLIBDIR = /usr/local/lib
57 DSTDIRS = $(DSTROOT)$(USRLIBDIR) $(DSTROOT)$(LOCLIBDIR)
59 INSTALLSRC_FILES = Makefile crt.c icplusplus.c lazy_dylib_loader.c start.s dyld_glue.s lazy_dylib_helper.s
61 INTERMEDIATE_FILES = \
62 $(SYMROOT)/crt1.v1.o $(SYMROOT)/crt1.v2.o $(SYMROOT)/crt1.v3.o $(SYMROOT)/crt1.v4.o \
63 $(SYMROOT)/gcrt1.o $(SYMROOT)/crt0.o \
64 $(SYMROOT)/dylib1.v1.o $(SYMROOT)/dylib1.v2.o \
65 $(SYMROOT)/bundle1.v1.o \
66 $(SYMROOT)/lazydylib1.o
68 # default target for development builds
69 all: $(INTERMEDIATE_FILES)
72 $(SYMROOT)/crt1.v1.o: start.s crt.c dyld_glue.s
73 $(CC) -r $(ARCH_CFLAGS) -Os $(OS_MIN_V1) -mdynamic-no-pic -nostdlib -keep_private_externs $^ -o $@ -DCRT -DOLD_LIBSYSTEM_SUPPORT
75 $(SYMROOT)/crt1.v2.o: start.s crt.c dyld_glue.s
76 $(CC) -r $(ARCH_CFLAGS) -Os $(OS_MIN_V2) -nostdlib -keep_private_externs $^ -o $@ -DCRT
78 $(SYMROOT)/crt1.v3.o: start.s crt.c
79 $(CC) -r $(ARCH_CFLAGS) -Os $(OS_MIN_V3) -nostdlib -keep_private_externs $^ -o $@ -DADD_PROGRAM_VARS
81 $(SYMROOT)/crt1.v4.o: start.s crt.c
82 $(CC) -r $(ARCH_CFLAGS) -Os $(OS_MIN_V4) -nostdlib -keep_private_externs $^ -o $@ -DADD_PROGRAM_VARS
84 $(SYMROOT)/gcrt1.o: start.s crt.c dyld_glue.s
85 $(CC) -r $(ARCH_CFLAGS) -Os $(OS_MIN_V1) -nostdlib -keep_private_externs $^ -o $@ -DGCRT -DOLD_LIBSYSTEM_SUPPORT
88 $(SYMROOT)/crt0.o: start.s crt.c
89 $(CC) -r $(ARCH_CFLAGS) -Os -static -Wl,-new_linker -nostdlib -keep_private_externs $^ -o $@
92 $(SYMROOT)/dylib1.v1.o: dyld_glue.s icplusplus.c
93 $(CC) -r $(ARCH_CFLAGS) -Os $(OS_MIN_V1) -nostdlib -keep_private_externs $^ -o $@ -DCFM_GLUE
95 $(SYMROOT)/dylib1.v2.o: dyld_glue.s
96 $(CC) -r $(ARCH_CFLAGS) -Os $(OS_MIN_V2) -nostdlib -keep_private_externs $^ -o $@ -DCFM_GLUE
99 $(SYMROOT)/bundle1.v1.o: dyld_glue.s
100 $(CC) -r $(ARCH_CFLAGS) -Os $(OS_MIN_V1) -nostdlib -keep_private_externs $^ -o $@
104 $(SYMROOT)/lazydylib1.o: lazy_dylib_helper.s lazy_dylib_loader.c
105 $(CC) -r $(ARCH_CFLAGS) -Os -nostdlib -keep_private_externs $^ -o $@
107 clean:
108 rm -f $(OBJROOT)/*.o $(SYMROOT)/*.o
111 install: all $(DSTDIRS) $(INSTALL_TARGET)
114 install_iphone:
115 cp $(SYMROOT)/crt1.v2.o $(DSTROOT)$(USRLIBDIR)/crt1.o
116 cp $(SYMROOT)/crt1.v4.o $(DSTROOT)$(USRLIBDIR)/crt1.3.1.o
117 cp $(SYMROOT)/dylib1.v2.o $(DSTROOT)$(USRLIBDIR)/dylib1.o
118 cp $(SYMROOT)/bundle1.v1.o $(DSTROOT)$(USRLIBDIR)/bundle1.o
119 cp $(SYMROOT)/lazydylib1.o $(DSTROOT)$(USRLIBDIR)/lazydylib1.o
120 cp $(SYMROOT)/gcrt1.o $(DSTROOT)$(USRLIBDIR)/gcrt1.o
121 cp $(SYMROOT)/crt0.o $(DSTROOT)$(LOCLIBDIR)/crt0.o
124 install_macosx:
125 cp $(SYMROOT)/crt1.v3.o $(DSTROOT)$(USRLIBDIR)/crt1.10.6.o
126 cp $(SYMROOT)/crt1.v2.o $(DSTROOT)$(USRLIBDIR)/crt1.10.5.o
127 cp $(SYMROOT)/crt1.v1.o $(DSTROOT)$(USRLIBDIR)/crt1.o
128 cp $(SYMROOT)/gcrt1.o $(DSTROOT)$(USRLIBDIR)/gcrt1.o
129 cp $(SYMROOT)/dylib1.v2.o $(DSTROOT)$(USRLIBDIR)/dylib1.10.5.o
130 cp $(SYMROOT)/dylib1.v1.o $(DSTROOT)$(USRLIBDIR)/dylib1.o
131 cp $(SYMROOT)/bundle1.v1.o $(DSTROOT)$(USRLIBDIR)/bundle1.o
132 cp $(SYMROOT)/lazydylib1.o $(DSTROOT)$(USRLIBDIR)/lazydylib1.o
133 cp $(SYMROOT)/crt0.o $(DSTROOT)$(LOCLIBDIR)/crt0.o
135 install_ios_simulator:
136 rm -rf $(DSTROOT)
137 mkdir -p $(DSTROOT)/$(SDK_DIR)/$(USRLIBDIR)
138 cp $(SYMROOT)/crt1.v2.o $(DSTROOT)/$(SDK_DIR)/$(USRLIBDIR)/crt1.10.5.o
139 cp $(SYMROOT)/crt1.v4.o $(DSTROOT)/$(SDK_DIR)/$(USRLIBDIR)/crt1.10.6.o
140 cp $(SYMROOT)/lazydylib1.o $(DSTROOT)/$(SDK_DIR)/$(USRLIBDIR)/lazydylib1.o
141 cp $(SYMROOT)/dylib1.v2.o $(DSTROOT)/$(SDK_DIR)/$(USRLIBDIR)/dylib1.o
142 cp $(SYMROOT)/bundle1.v1.o $(DSTROOT)/$(SDK_DIR)/$(USRLIBDIR)/bundle1.o
143 cd $(DSTROOT)/$(SDK_DIR)/$(USRLIBDIR); ln -s crt1.10.6.o crt1.o; ln -s crt1.10.5.o crt1.3.1.o
146 installhdrs:
148 installsrc:
149 $(MKDIR) $(SRCROOT)
150 $(CHMOD) 755 $(SRCROOT)
151 $(PAX) $(INSTALLSRC_FILES) $(SRCROOT)
152 $(CHMOD) 444 $(SRCROOT)/*
154 $(OJBROOT) $(SYMROOT) $(DSTDIRS):
155 $(MKDIR) $@