-
Notifications
You must be signed in to change notification settings - Fork 45
/
Makefile.legacy
176 lines (129 loc) · 5.04 KB
/
Makefile.legacy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
# Compilers and linkers
OBJCC_I386 = /Xcode3/usr/bin/gcc-4.2 -arch i386
OBJCC_PPC = /Xcode3/usr/bin/gcc-4.0 -arch ppc
CC_I386 = /Xcode3/usr/bin/gcc-4.2 -arch i386
CC_PPC = /Xcode3/usr/bin/gcc-4.0 -arch ppc
CXX_I386 = /Xcode3/usr/bin/g++-4.2 -arch i386
CXX_PPC = /Xcode3/usr/bin/g++-4.0 -arch ppc
LD = /Xcode3/usr/bin/gcc-4.0
AR = ar
SDK = -isysroot /Xcode3/SDKs/MacOSX10.5.sdk
# Options for compilation
GCC_OPTS = -O2 \
-Wno-import \
-Wno-multichar \
-mmacosx-version-min=10.3.9 \
-DIsLegacyVersion
OBJC_OPTS = -std=gnu99 \
$(SDK)
C_OPTS = -std=gnu99 \
$(SDK)
CXX_OPTS = $(SDK)
AUTODEPENDENCY_CFLAGS=-MMD -MF$(@:.o=.d) -MT$@
ALL_OBJCFLAGS = $(OBJC_OPTS) $(GCC_OPTS) $(CFLAGS) $(OBJCFLAGS)
ALL_CFLAGS = $(C_OPTS) $(GCC_OPTS) $(CFLAGS)
ALL_CXXFLAGS = $(CXX_OPTS) $(GCC_OPTS) $(CXXFLAGS)
# Options for linking
LIBS = -framework Foundation \
-framework Carbon \
-lz \
-lbz2 \
-lobjc \
-lstdc++ \
-lm
ALL_LDFLAGS = -arch i386 -arch ppc \
-mmacosx-version-min=10.3.9 \
-ObjC \
$(SDK) \
$(LDFLAGS)
# Paths
SOURCE_DIR = .
BUILD_DIR = Build
# Files
PLATFORM_OBJC_FILES = XADPlatformMacOSX.m \
XADStringCFString.m
include Makefile.common
# Framework
FRAMEWORK_NAME = XADMaster
FRAMEWORK_FILES = $(FRAMEWORK_NAME).framework
FRAMEWORK_HEADER_FILES = $(shell grep -i Public $(FRAMEWORK_NAME).xcodeproj/project.pbxproj |\
perl -pe 's!^.*/\*\s*(.+\.h).*$$!$$1!g' |\
grep -v xadmaster)
FRAMEWORK_LIBS = $(LIBS) \
-F../UniversalDetector \
-framework UniversalDetector
FRAMEWORK_LDFLAGS = -arch i386 -arch ppc \
-mmacosx-version-min=10.3.9 \
-dynamiclib \
-install_name @executable_path/../Frameworks/$(FRAMEWORK_NAME).framework/$(FRAMEWORK_NAME) \
$(SDK) \
$(LDFLAGS)
# Compilation rules
all: $(FRAMEWORK_FILES) $(EXECUTABLE_FILES) $(LIBRARY_FILES)
$(FRAMEWORK_NAME).framework: \
$(FRAMEWORK_NAME).framework/Versions/A/$(FRAMEWORK_NAME) \
$(FRAMEWORK_NAME).framework/Versions/A/Resources/Info.plist \
$(FRAMEWORK_NAME).framework/Versions/A/Resources/en.lproj/InfoPlist.strings \
$(FRAMEWORK_HEADER_FILES:%=$(FRAMEWORK_NAME).framework/Versions/A/Headers/%)
ln -shf A $(FRAMEWORK_NAME).framework/Versions/Current
ln -shf Versions/Current/$(FRAMEWORK_NAME) $(FRAMEWORK_NAME).framework/$(FRAMEWORK_NAME)
ln -shf Versions/Current/Resources $(FRAMEWORK_NAME).framework/Resources
ln -shf Versions/Current/Headers $(FRAMEWORK_NAME).framework/Headers
$(FRAMEWORK_NAME).framework/Versions/A/$(FRAMEWORK_NAME): $(LIBRARY_OBJS) ../UniversalDetector/UniversalDetector.framework
@mkdir -p $(dir $@)
$(LD) $(FRAMEWORK_LDFLAGS) -o $@ $(LIBRARY_OBJS) $(FRAMEWORK_LIBS)
$(FRAMEWORK_NAME).framework/Versions/A/Resources/Info.plist: Info.plist
@mkdir -p $(dir $@)
cat $^ |\
perl -pe 's/\$$\{EXECUTABLE_NAME\}/$(FRAMEWORK_NAME)/sg' |\
perl -pe 's/\$$\{PRODUCT_NAME\}/$(FRAMEWORK_NAME)/sg' |\
cat >$@
$(FRAMEWORK_NAME).framework/Versions/A/Resources/en.lproj/InfoPlist.strings: English.lproj/InfoPlist.strings
@mkdir -p $(dir $@)
cp $^ $@
$(FRAMEWORK_NAME).framework/Versions/A/Headers/%: %
@mkdir -p $(dir $@)
cp $^ $@
libXADMaster.a: $(LIBRARY_OBJS)
rm -f $@
$(AR) rcs $@ $^
../UniversalDetector/UniversalDetector.framework:
make -C ../UniversalDetector -f Makefile.legacy
../UniversalDetector/libUniversalDetector.a:
make -C ../UniversalDetector -f Makefile.legacy
XADTest2: $(XADTEST2_OBJS) libXADMaster.a ../UniversalDetector/libUniversalDetector.a
$(LD) $(ALL_LDFLAGS) -o $@ $^ $(LIBS)
XADTest3: $(XADTEST3_OBJS) libXADMaster.a ../UniversalDetector/libUniversalDetector.a
$(LD) $(ALL_LDFLAGS) -o $@ $^ $(LIBS)
XADTest4: $(XADTEST4_OBJS) libXADMaster.a ../UniversalDetector/libUniversalDetector.a
$(LD) $(ALL_LDFLAGS) -o $@ $^ $(LIBS)
XADTest5: $(XADTEST5_OBJS) libXADMaster.a ../UniversalDetector/libUniversalDetector.a
$(LD) $(ALL_LDFLAGS) -o $@ $^ $(LIBS)
XADTest6: $(XADTEST6_OBJS) $(CMDLINE_OBJS) libXADMaster.a ../UniversalDetector/libUniversalDetector.a
$(LD) $(ALL_LDFLAGS) -o $@ $^ $(LIBS)
unar: $(UNAR_OBJS) $(CMDLINE_OBJS) libXADMaster.a ../UniversalDetector/libUniversalDetector.a
$(LD) $(ALL_LDFLAGS) -o $@ $^ $(LIBS)
lsar: $(LSAR_OBJS) $(CMDLINE_OBJS) libXADMaster.a ../UniversalDetector/libUniversalDetector.a
$(LD) $(ALL_LDFLAGS) -o $@ $^ $(LIBS)
clean:
rm -rf $(BUILD_DIR) $(FRAMEWORK_FILES) $(EXECUTABLE_FILES) $(LIBRARY_FILES)
make -C ../UniversalDetector -f Makefile.legacy clean
.PHONY: ../UniversalDetector/UniversalDetector.framework clean
# Suffix rules
.SUFFIXES: .o .c .m .cpp
$(BUILD_DIR)/%.o: $(SOURCE_DIR)/%.c
@mkdir -p $(dir $@)
$(CC_I386) $(ALL_CFLAGS) $(AUTODEPENDENCY_CFLAGS) -c $< -o [email protected]
$(CC_PPC) $(ALL_CFLAGS) -c $< -o [email protected]
lipo -create [email protected] [email protected] -output $@
$(BUILD_DIR)/%.o: $(SOURCE_DIR)/%.m
@mkdir -p $(dir $@)
$(OBJCC_I386) $(ALL_OBJCFLAGS) $(AUTODEPENDENCY_CFLAGS) -c $< -o [email protected]
$(OBJCC_PPC) $(ALL_OBJCFLAGS) -c $< -o [email protected]
lipo -create [email protected] [email protected] -output $@
$(BUILD_DIR)/%.o: $(SOURCE_DIR)/%.cpp
@mkdir -p $(dir $@)
$(CXX_I386) $(ALL_CXXFLAGS) $(AUTODEPENDENCY_CFLAGS) -c $< -o [email protected]
$(CXX_PPC) $(ALL_CXXFLAGS) -c $< -o [email protected]
lipo -create [email protected] [email protected] -output $@
-include $(OBJS:.o=.d)