-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile~
323 lines (286 loc) · 8.88 KB
/
Makefile~
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
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
#
# VMA is developed under Cygwin/Mingw32, so this makefile may have
# related dependencies.
#
#
# Get current version
#
VERSION = $(shell bash ./version.sh src)
#
# wxWidgets settings (preference is static)
#
WXREL = $(shell wx-config --unicode=yes --static --release)
WXCXXFLAGS = $(shell wx-config --unicode=yes --static --cxxflags)
WXCFLAGS = $(shell wx-config --unicode=yes --static --cflags)
WXLDFLAGS = $(shell wx-config --unicode=yes --static --libs)
#
# If no static libraries exist, then check for dynamic ones
#
ifeq ($(WXLDFLAGS),)
WXREL = $(shell wx-config --unicode=yes --release)
WXCXXFLAGS = $(shell wx-config --unicode=yes --cxxflags)
WXCFLAGS = $(shell wx-config --unicode=yes --cflags)
WXLDFLAGS = $(shell wx-config --unicode=yes --libs)
endif
#
# If no static libraries exist, then check for dynamic ones
#
ifeq ($(WXLDFLAGS),)
WXREL = $(shell wx-config --unicode=yes --static --release)
WXCXXFLAGS = $(shell wx-config --unicode=yes --static --cxxflags)
WXCFLAGS = $(shell wx-config --unicode=yes --static --cflags)
WXLDFLAGS = $(shell wx-config --unicode=no --static --libs)
endif
#
# Couldn't find the libraries we need
#
ifeq ($(WXLDFLAGS),)
MISSINGLIBS = yes
endif
#
# Debugging
#
DEBUG = -g
#DEBUG = -O9
#
# Generic compiler settings
#
CC = gcc
CFLAGS = -I. -Isrc -pedantic -Wall -Wno-long-long $(WXCXXFLAGS) $(DEBUG)
CXXFLAGS = $(CFLAGS)
#
# Generic link settings
#
LDFLAGS = $(DEBUG)
LIBS =
#
# Command line objects
#
CLIOBJS = src/vma.o \
src/vmalib.o
#
# GUI objects
#
GUIOBJS = src/vmagui.o \
src/properties.o \
src/settings.o \
src/vmalib.o
#
# XPM dependencies
#
XPMS = res/add16.xpm \
res/binary16.xpm \
res/downarrow16.xpm \
res/extall16.xpm \
res/extract16.xpm \
res/find16.xpm \
res/new16.xpm \
res/open16.xpm \
res/props16.xpm \
res/remove16.xpm \
res/save16.xpm \
res/settings16.xpm \
res/text16.xpm \
res/unknown16.xpm \
res/uparrow16.xpm \
res/view16.xpm \
res/vmagui.xpm
#
# Windows specific settings
#
ifneq ($(findstring Windows,$(OS)),)
WXLDFLAGS += -mwindows
LIBS += -lshlwapi
GUIOBJS += src/vmaguirc.o
endif
#
# Mac specific settings
#
ifneq ($(findstring WXMAC,$(CXXFLAGS)),)
CFLAGS += -arch i386 -arch ppc -isysroot /Developer/SDKs/MacOSX10.4u.sdk -mmacosx-version-min=10.4 -DMAC_OS_X_VERSION_MAX_ALLOWED=1040
CXXFLAGS += -arch i386 -arch ppc -isysroot /Developer/SDKs/MacOSX10.4u.sdk -mmacosx-version-min=10.4 -DMAC_OS_X_VERSION_MAX_ALLOWED=1040
LDFLAGS += -arch i386 -arch ppc -isysroot /Developer/SDKs/MacOSX10.4u.sdk -mmacosx-version-min=10.4 -DMAC_OS_X_VERSION_MAX_ALLOWED=1040
endif
#
# Desired targets
#
TARGETS = src/vma
ifneq ($(findstring WXMAC,$(CXXFLAGS)),)
TARGETS += VMAgui.app
else
ifneq ($(WXREL),)
TARGETS += src/vmagui
endif
endif
#
# If no static libraries exist, then check for dynamic ones
#
ifeq ($(MISSINGLIBS),yes)
TARGETS = missing_wx_libraries
endif
ifeq ($(shell which wx-config),)
TARGETS = missing_wx_config
endif
#
# Distribution files
#
MISCFILES = Changes.txt \
Readme.txt \
*.ucm
#
# Distribution files for z/OS
#
ZOSFILES = Run.jcl \
$(MISCFILES)
#
# Distribution files
#
DISTFILES = $(XPMS) \
res/Info.plist \
res/PkgInfo \
res/VMAgui.icns \
res/vmagui.ico \
res/vmagui.rc \
src/properties.cpp \
src/properties.h \
src/settings.cpp \
src/settings.h \
src/version.h \
src/vma.c \
src/vmagui.cpp \
src/vmagui.h \
src/vmalib.c \
src/vmalib.h \
src/vmapriv.h \
Changes.txt \
Readme.txt \
*.ucm \
Makefile \
Makefile.jcl \
Run.jcl \
version.sh \
VMA.sln \
VMA.vcproj \
VMAgui.vcproj \
.version \
.revision
#
# Default target is just the CLI version
#
all: $(TARGETS)
#
# wx-config couldn't be found
#
missing_wx_config:
@echo "==================================================="
@echo "You must install the wxWidgets development package."
@echo "==================================================="
#
# Required wxWidgets configuration not found
#
missing_wx_libraries:
@echo "=================================================="
@echo "You must install the unicode version of wxWidgets."
@echo "=================================================="
#
# CLI target
#
cli: src/vma
#
# GUI target
#
gui: src/vmagui
#
# Command line utility dependencies
#
src/vma: $(CLIOBJS)
#
src/vma.o: src/vma.c src/vmalib.h
#
# GUI utility dependencies
#
src/vmagui: $(GUIOBJS)
$(LINK.cc) ${LDFLAGS} -o $@ $^ $(WXLDFLAGS) $(LIBS)
#
VMAgui.app: src/vmagui
rm -rf VMAgui.app
mkdir -p VMAgui.app/Contents/MacOS
mkdir -p VMAgui.app/Contents/Resources
sed -e "s/__VERSION__/$(VERSION)/" res/Info.plist >VMAgui.app/Contents/Info.plist
cp res/PkgInfo VMAgui.app/Contents
cp res/VMAgui.icns VMAgui.app/Contents/Resources
strip -o VMAgui.app/Contents/MacOS/VMAgui src/vmagui
cp src/vmagui VMAgui.app/Contents/MacOS/VMAgui
#
src/vmagui.o: src/vmagui.cpp src/vmagui.h src/settings.h src/properties.h src/vmalib.h $(XPMS)
#
src/settings.o: src/settings.cpp src/settings.h res/find16.xpm
#
src/properties.o: src/properties.cpp src/properties.h src/vmalib.h
#
src/vmaguirc.o: res/vmagui.rc res/vmagui.ico
windres --use-temp-file $(WXCXXFLAGS) $< $@
#
# Common dependencies
#
src/vmalib.o: src/vmalib.c src/vmalib.h src/vmapriv.h
#
# Pick up after ourselves
#
clean:
-rm -rf src/*.o src/*.exe src/vma src/vmagui VMAgui.app
#
# Build the source dist
#
dist: clean
-rm -rf vma-$(VERSION).tar.gz vma-$(VERSION)
mkdir vma-$(VERSION) vma-$(VERSION)/res vma-$(VERSION)/src
for f in $(DISTFILES) ; do cp -pR $$f vma-$(VERSION)/$$f ; done
#
# add me later
#
# sed -e 's/\r//g;s/\t/ /g;s/ *$//g' ...
# dos2unix vma-$(VERSION)/* vma-$(VERSION)/src/*
find vma-$(VERSION) -name .DS_Store -exec rm \{\} \;
tar zcf ../vma-$(VERSION).tar.gz vma-$(VERSION)
rm -rf vma-$(VERSION)
#
# Build the Windows dist
#
win:
-rm -rf vmawin-$(VERSION).zip vmawin-$(VERSION)
mkdir vmawin-$(VERSION)
cp Release/*.exe vmawin-$(VERSION)
cp $(MISCFILES) vmawin-$(VERSION)
zip -9 -r ../vmawin-$(VERSION).zip vmawin-$(VERSION)
rm -rf vmawin-$(VERSION)
#
# Build the Linux dist
#
lin: clean all
-rm -rf vmalin-$(VERSION).$(shell uname -m).tar.gz vmalin-$(VERSION).$(shell uname -m)
mkdir vmalin-$(VERSION).$(shell uname -m)
cp $(TARGETS) vmalin-$(VERSION).$(shell uname -m)
strip vmalin-$(VERSION).$(shell uname -m)/*
cp $(MISCFILES) vmalin-$(VERSION).$(shell uname -m)
tar jcf ../vmalin-$(VERSION).$(shell uname -m).tar.bz2 vmalin-$(VERSION).$(shell uname -m)
#
# Build the Mac dist
#
mac: clean all
-rm -rf ../vmamac-$(VERSION).dmg vmamac-$(VERSION)
mkdir vmamac-$(VERSION)
cp -pR $(MISCFILES) $(TARGETS) vmamac-$(VERSION)
hdiutil create -ov -srcdir "vmamac-$(VERSION)" -fs HFS+ -volname "VMAgui $(VERSION)" TMP.dmg
hdiutil convert TMP.dmg -format UDZO -imagekey zlib-level=9 -o "../vmamac-$(VERSION).dmg"
rm TMP.dmg
rm -rf vmamac-$(VERSION)
#
# Build the z/OS dist
#
zos:
-rm -rf vmazos-$(VERSION).zip vmazos-$(VERSION)
mkdir vmazos-$(VERSION)
cp -pR $(ZOSFILES) vma.xmit vmazos-$(VERSION)
zip -9 -r ../vmazos-$(VERSION).zip vmazos-$(VERSION)
rm -rf vmazos-$(VERSION)