1
######################################################################
3
# Makefile for Info-ZIP's unzip, unzipsfx, and funzip on BeOS
5
# Copyright (c) 1998-2001 Info-ZIP
6
# Chris Herborth (chrish@qnx.com)
8
# This is the new New and Improved Makefile for BeOS; it will:
10
# 1) automatically detect your platform (PowerPC or x86) if none is
11
# specified; the default compiler is CodeWarrior for PowerPC, or
14
# 2) let you cross-compile for the other platform (PowerPC or x86), in
17
# 3) let you use Metrowerks CodeWarrior (default) or GNU C to build with
18
# for either platfor, in theory
20
# To choose a specific architecture, define the ARCH environment
21
# variable on the make command-line:
23
# ARCH=what make -f beos/Makefile
25
# where "what" can be "powerpc" or "x86".
27
# To choose a specific compiler, define the CC environment variable on
28
# the make command-line:
30
# CC=compiler make -f beos/Makefile
32
# where "compiler" can be "mwcc" or "x86".
34
# Of course, you can combine these two:
36
# ARCH=powerpc CC=mwcc make -f beos/Makefile
40
# CC=gcc ARCH=x86 make -f beos/Makefile
42
# To automatically install the fresh new unzip, use the "install" target:
44
# make -f beos/Makefile install
46
######################################################################
47
# Things that don't change:
51
# Punish those of you not running on SMP hardware...
52
MAKE = make -j 4 -f beos/Makefile
54
LOC=$(LOCAL_UNZIP) -DPASSWD_FROM_STDIN
65
# general-purpose stuff
73
# defaults for crc32 stuff and system-dependent headers
78
OBJS1 = unzip$O $(CRC32)$O crctab$O crypt$O envargs$O explode$O
79
OBJS2 = extract$O fileio$O globals$O inflate$O list$O match$O
80
OBJS3 = process$O ttyio$O unreduce$O unshrink$O zipinfo$O
81
OBJS = $(OBJS1) $(OBJS2) $(OBJS3) $M$O $(BEOS_MAIN)
83
OBJSDLL = $(OBJS) api$O
84
OBJX = unzipsfx$O $(CRC32)$O crctab_$O crypt_$O extract_$O fileio_$O \
85
globals_$O inflate_$O match_$O process_$O ttyio_$O $M_$O $(BEOS_MAIN)
87
OBJF = funzip$O $(CRC32)$O cryptf$O globalsf$O inflatef$O ttyiof$O
88
UNZIP_H = unzip.h unzpriv.h globals.h $(OSDEP_H)
92
# on some systems, manext=l and MANDIR=/usr/man/man$(manext) may be appropriate
94
prefix = /boot/home/config
95
BINDIR = $(prefix)/bin# where to install executables
96
MANDIR = $(prefix)/man/man$(manext)# where to install man pages
97
INSTALLEDBIN = $(BINDIR)/funzip$E $(BINDIR)/zipinfo$E $(BINDIR)/unzipsfx$E \
99
INSTALLEDMAN = $(MANDIR)/unzip.$(manext) $(MANDIR)/funzip.$(manext) \
100
$(MANDIR)/unzipsfx.$(manext) $(MANDIR)/zipinfo.$(manext)
102
UNZIPS = unzip$E funzip$E unzipsfx$E zipinfo$E
103
# this is a little ugly...well, no, it's a lot ugly:
104
MANS = man/unzip.1 man/unzipsfx.1 man/zipinfo.1 man/funzip.1 man/zipgrep.1
105
DOCS = unzip.txt unzipsfx.txt zipinfo.txt funzip.txt zipgrep.txt
107
######################################################################
108
# Things that change:
110
# Select an architecture:
112
MACHINE=$(shell uname -m)
113
ifeq "$(MACHINE)" "BePC"
122
# Now select compiler flags and whatnot based on the ARCH and CC:
125
ifeq "$(WHAT)" "powerpc-mwcc"
128
CF=-w9 -O7 -opt schedule604 -rostr -I. $(LOC)
130
LF2=-warn -L/boot/develop/lib/ppc -lbe -lroot
135
ifeq "$(WHAT)" "powerpc-gcc"
138
CF=-O3 -mcpu=604 -Wall -ansi -I. -I/boot/develop/headers/be/support \
139
-I/boot/develop/headers/be/storage $(LOC)
141
LF2=-L/boot/develop/lib/ppc -lbe -lroot
146
# This isn't likely to happen for R4 or later...
147
ifeq "$(WHAT)" "x86-mwcc"
150
CF=-O2 -w9 -I. $(LOC)
152
LF2=-warn -L/boot/develop/lib/x86 -lbe -lroot
157
ifeq "$(WHAT)" "x86-gcc"
160
CF=-O3 -mpentiumpro \
161
-Wall -Wno-multichar -Wno-trigraphs \
162
-ansi -I. -I/boot/develop/headers/be/support \
163
-I/boot/develop/headers/be/storage $(LOC)
165
LF2=-L/boot/develop/lib/x86 -lbe -lroot
174
######################################################################
177
@echo 'TARGET = $(TARGET)'
178
@echo 'ARCH = $(ARCH)'
180
if [ -n "$(TARGET)" ] ; then \
181
$(MAKE) CC=$(CC) CF="$(CF)" LD="$(LD)" \
182
LF="$(LF)" LF2="$(LF2)" CCPP="$(CC)" CPPF="$(CF)" \
183
OBJS="$(OBJS)" LOBJS="$(LOBJS)" OBJX="$(OBJX)" \
184
LOBJX="$(LOBJX)" $(TARGET) ; \
191
@echo "This Makefile lets you build Info-ZIP's zip."
193
@echo 'To build zip for this computer using the default compiler, just do:'
195
@echo ' make -f beos/Makefile'
197
@echo 'To build zip for a specific architecture using a specific'
198
@echo 'compiler, do:'
200
@echo ' ARCH=cpu CC=compiler make -f beos/Makefile'
203
@echo ' cpu is either "powerpc" or "x86"'
204
@echo ' compiler is either "mwcc" or "gcc"'
207
######################################################################
208
# Basic compile instructions and dependencies
210
# this is for GNU make; comment out and notify zip-bugs if it causes errors
213
# default for compiling C files
222
unzipsman: unzips docs
223
unzipsdocs: unzips docs
226
unzip$E: $(OBJS) beos/unzip.rsc
227
$(LD) $(LF) $(LOBJS) $(LF2)
229
xres -o unzip$E beos/unzip.rsc
230
mimeset -f -all unzip$E
232
unzipsfx$E: $(OBJX) beos/unzipsfx.rsc
233
$(LD) $(SL) $(LOBJX) $(SL2)
235
xres -o unzipsfx$E beos/unzipsfx.rsc
236
mimeset -f -all unzipsfx
239
$(LD) $(FL) $(OBJF) $(FL2)
243
$(LN) unzip$E zipinfo$E
246
crc32$O: crc32.c $(UNZIP_H) zip.h
247
crctab$O: crctab.c $(UNZIP_H) zip.h
248
crypt$O: crypt.c $(UNZIP_H) zip.h crypt.h ttyio.h
249
envargs$O: envargs.c $(UNZIP_H)
250
explode$O: explode.c $(UNZIP_H)
251
extract$O: extract.c $(UNZIP_H) crypt.h
252
fileio$O: fileio.c $(UNZIP_H) crypt.h ttyio.h ebcdic.h
253
funzip$O: funzip.c $(UNZIP_H) crypt.h ttyio.h tables.h
254
globals$O: globals.c $(UNZIP_H)
255
inflate$O: inflate.c inflate.h $(UNZIP_H)
256
list$O: list.c $(UNZIP_H)
257
match$O: match.c $(UNZIP_H)
258
process$O: process.c $(UNZIP_H)
259
ttyio$O: ttyio.c $(UNZIP_H) zip.h crypt.h ttyio.h
260
unreduce$O: unreduce.c $(UNZIP_H)
261
unshrink$O: unshrink.c $(UNZIP_H)
262
unzip$O: unzip.c $(UNZIP_H) crypt.h unzvers.h consts.h
263
zipinfo$O: zipinfo.c $(UNZIP_H)
265
unzipsfx$O: unzip.c $(UNZIP_H) crypt.h unzvers.h consts.h # unzipsfx only
266
$(CP) unzip.c unzipsfx.c
267
$(CC) -c $(CF) -DSFX unzipsfx.c
270
crypt_$O: crypt.c $(UNZIP_H) zip.h crypt.h ttyio.h # unzipsfx only
271
$(CP) crypt.c crypt_.c
272
$(CC) -c $(CF) -DSFX crypt_.c
275
crctab_$O: crctab.c $(UNZIP_H) zip.h # unzipsfx only
276
$(CP) crctab.c crctab_.c
277
$(CC) -c $(CF) -DSFX crctab_.c
280
fileio_$O: fileio.c $(UNZIP_H) crypt.h ttyio.h ebcdic.h # unzipsfx only
281
$(CP) fileio.c fileio_.c
282
$(CC) -c $(CF) -DSFX fileio_.c
285
extract_$O: extract.c $(UNZIP_H) crypt.h # unzipsfx only
286
$(CP) extract.c extract_.c
287
$(CC) -c $(CF) -DSFX extract_.c
290
globals_$O: globals.c $(UNZIP_H) # unzipsfx only
291
$(CP) globals.c globals_.c
292
$(CC) -c $(CF) -DSFX globals_.c
295
inflate_$O: inflate.c inflate.h $(UNZIP_H) crypt.h # unzipsfx only
296
$(CP) inflate.c inflate_.c
297
$(CC) -c $(CF) -DSFX inflate_.c
300
process_$O: process.c $(UNZIP_H) # unzipsfx only
301
$(CP) process.c process_.c
302
$(CC) -c $(CF) -DSFX process_.c
305
ttyio_$O: ttyio.c $(UNZIP_H) zip.h crypt.h ttyio.h # unzipsfx only
306
$(CP) ttyio.c ttyio_.c
307
$(CC) -c $(CF) -DSFX ttyio_.c
310
cryptf$O: crypt.c $(UNZIP_H) zip.h crypt.h ttyio.h # funzip only
311
$(CP) crypt.c cryptf.c
312
$(CC) -c $(CF) -DFUNZIP cryptf.c
315
globalsf$O: globals.c $(UNZIP_H) # funzip only
316
$(CP) globals.c globalsf.c
317
$(CC) -c $(CF) -DFUNZIP globalsf.c
320
inflatef$O: inflate.c inflate.h $(UNZIP_H) crypt.h # funzip only
321
$(CP) inflate.c inflatef.c
322
$(CC) -c $(CF) -DFUNZIP inflatef.c
325
ttyiof$O: ttyio.c $(UNZIP_H) zip.h crypt.h ttyio.h # funzip only
326
$(CP) ttyio.c ttyiof.c
327
$(CC) -c $(CF) -DFUNZIP ttyiof.c
330
beos$O: beos/beos.c $(UNZIP_H) unzvers.h # BeOS only
331
$(CC) -c $(CF) beos/beos.c
333
beosmain$O: beos/beosmain.cpp $(UNZIP_H) unzvers.h # BeOS only
334
$(CCPP) -c $(CPPF) beos/beosmain.cpp
336
# version() not used by unzipsfx, so no unzvers.h dependency
337
beos_$O: beos/beos.c $(UNZIP_H) # unzipsfx only
338
$(CP) beos/beos.c beos_.c
339
$(CC) -c $(CF) -Ibeos -DSFX beos_.c
342
beosmain_$O: beos/beosmain.cpp $(UNZIP_H)
343
$(CP) beos/beosmain.cpp beosmain_.cpp
344
$(CCPP) -c $(CPPF) -Ibeos -DSFX beosmain_.cpp
348
# this really only works for Unix targets, unless E and O specified on cmd line
350
-rm -f $(UNZIPS) $(OBJS) $(OBJF) $(OBJX) api$O apihelp$O crc_gcc$O \
351
unzipstb$O beosmain.o beosmain_.o
354
$(INSTALL) -m 755 $(UNZIPS) $(BINDIR)
355
mimeset -f -all $(BINDIR)/unzip
356
mimeset -f -all $(BINDIR)/unzipsfx
357
$(RM) $(BINDIR)/zipinfo$E
358
$(LN) unzip$E $(BINDIR)/zipinfo$E
359
$(RM) $(BINDIR)/zipgrep$E
360
$(INSTALL) -m 755 unix/zipgrep $(BINDIR)/zipgrep$E
361
$(INSTALL) -m 644 man/unzip.1 $(MANDIR)/unzip.$(manext)
362
$(INSTALL) -m 644 man/unzipsfx.1 $(MANDIR)/unzipsfx.$(manext)
363
$(INSTALL) -m 644 man/zipinfo.1 $(MANDIR)/zipinfo.$(manext)
364
$(INSTALL) -m 644 man/funzip.1 $(MANDIR)/funzip.$(manext)
365
$(INSTALL) -m 644 man/zipgrep.1 $(MANDIR)/zipgrep.$(manext)
366
$(INSTALL) -m 644 $(DOCS) $(MANDIR)
368
# alternatively, could use zip method: -cd $(BINDIR); rm -f $(UNZIPS) [etc.]
370
rm -f $(INSTALLEDBIN) $(INSTALLEDMAN)
373
TESTZIP = testmake.zip # the test zipfile
375
# test some basic features of the build
379
@echo ' This is a Unix-specific target. (Just so you know.)'
380
@echo ' (Should work ok on BeOS... [cjh])'
381
if test ! -f $(TESTZIP); then \
382
echo " error: can't find test file $(TESTZIP)"; exit 1; fi
384
echo " testing extraction"
385
./unzip -b $(TESTZIP) testmake.zipinfo
387
echo " error: file extraction from $(TESTZIP) failed"; exit 1; fi
389
echo ' testing zipinfo (unzip -Z)'
390
./unzip -Z $(TESTZIP) > testmake.unzip-Z
391
if diff testmake.unzip-Z testmake.zipinfo; then ;; else \
392
echo ' error: zipinfo output doesn't match stored version'; fi
393
$(RM) testmake.unzip-Z testmake.zipinfo
395
echo ' testing unzip -d exdir option'
396
./unzip -b $(TESTZIP) -d testun
399
echo ' testing unzip -o and funzip (ignore funzip warning)'
400
./unzip -boq $(TESTZIP) notes -d testun
401
./funzip < $(TESTZIP) > testun/notes2
402
if diff testun/notes testun/notes2; then ;; else \
403
echo 'error: funzip output disagrees with unzip'; fi
405
echo ' testing unzipsfx (self-extractor)'
406
cat unzipsfx $(TESTZIP) > testsfx
407
$(CHMOD) 0700 testsfx
409
if diff notes testun/notes; then ;; else \
410
echo ' error: unzipsfx file disagrees with unzip'; fi
411
$(RM) testsfx notes testun/notes testun/notes2
414
echo ' testing complete.'