~ubuntu-branches/ubuntu/intrepid/unzip/intrepid

« back to all changes in this revision

Viewing changes to beos/Makefile

  • Committer: Bazaar Package Importer
  • Author(s): Santiago Vila
  • Date: 2004-06-06 17:57:46 UTC
  • Revision ID: james.westby@ubuntu.com-20040606175746-nl7p2dgp3aobyc2c
Tags: upstream-5.51
ImportĀ upstreamĀ versionĀ 5.51

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
######################################################################
 
2
#
 
3
# Makefile for Info-ZIP's unzip, unzipsfx, and funzip on BeOS
 
4
#
 
5
# Copyright (c) 1998-2001 Info-ZIP
 
6
#             Chris Herborth (chrish@qnx.com)
 
7
#
 
8
# This is the new New and Improved Makefile for BeOS; it will:
 
9
#
 
10
# 1) automatically detect your platform (PowerPC or x86) if none is
 
11
#    specified; the default compiler is CodeWarrior for PowerPC, or
 
12
#    gcc for x86
 
13
#
 
14
# 2) let you cross-compile for the other platform (PowerPC or x86), in
 
15
#    theory
 
16
#
 
17
# 3) let you use Metrowerks CodeWarrior (default) or GNU C to build with
 
18
#    for either platfor, in theory
 
19
#
 
20
# To choose a specific architecture, define the ARCH environment
 
21
# variable on the make command-line:
 
22
#
 
23
# ARCH=what make -f beos/Makefile
 
24
#
 
25
# where "what" can be "powerpc" or "x86".
 
26
#
 
27
# To choose a specific compiler, define the CC environment variable on
 
28
# the make command-line:
 
29
#
 
30
# CC=compiler make -f beos/Makefile
 
31
#
 
32
# where "compiler" can be "mwcc" or "x86".
 
33
#
 
34
# Of course, you can combine these two:
 
35
#
 
36
# ARCH=powerpc CC=mwcc make -f beos/Makefile
 
37
#
 
38
# or:
 
39
#
 
40
# CC=gcc ARCH=x86 make -f beos/Makefile
 
41
#
 
42
# To automatically install the fresh new unzip, use the "install" target:
 
43
#
 
44
# make -f beos/Makefile install
 
45
 
 
46
######################################################################
 
47
# Things that don't change:
 
48
 
 
49
SHELL = /bin/sh
 
50
 
 
51
# Punish those of you not running on SMP hardware...
 
52
MAKE  = make -j 4 -f beos/Makefile
 
53
 
 
54
LOC=$(LOCAL_UNZIP) -DPASSWD_FROM_STDIN
 
55
AF=$(LOC)
 
56
 
 
57
# UnZipSfx flags
 
58
SL = -o unzipsfx
 
59
SL2 = $(LF2)
 
60
 
 
61
# fUnZip flags
 
62
FL = -o funzip
 
63
FL2 = $(LF2)
 
64
 
 
65
# general-purpose stuff
 
66
CP = cp
 
67
RM = rm -f
 
68
LN = ln -sf
 
69
E =
 
70
O = .o
 
71
M = beos
 
72
 
 
73
# defaults for crc32 stuff and system-dependent headers
 
74
CRC32 = crc32
 
75
OSDEP_H = beos/beos.h
 
76
 
 
77
# object files
 
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)
 
82
LOBJS = $(OBJS)
 
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)
 
86
LOBJX = $(OBJX)
 
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)
 
89
 
 
90
# installation
 
91
INSTALL = install
 
92
# on some systems, manext=l and MANDIR=/usr/man/man$(manext) may be appropriate
 
93
manext = 1
 
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 \
 
98
        $(BINDIR)/unzip$E
 
99
INSTALLEDMAN = $(MANDIR)/unzip.$(manext) $(MANDIR)/funzip.$(manext) \
 
100
        $(MANDIR)/unzipsfx.$(manext) $(MANDIR)/zipinfo.$(manext)
 
101
#
 
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
 
106
 
 
107
######################################################################
 
108
# Things that change:
 
109
 
 
110
# Select an architecture:
 
111
ifndef ARCH
 
112
MACHINE=$(shell uname -m)
 
113
ifeq "$(MACHINE)" "BePC"
 
114
ARCH=x86
 
115
CC=gcc
 
116
else
 
117
ARCH=powerpc
 
118
CC=mwcc
 
119
endif
 
120
endif
 
121
 
 
122
# Now select compiler flags and whatnot based on the ARCH and CC:
 
123
WHAT=$(ARCH)-$(CC)
 
124
 
 
125
ifeq "$(WHAT)" "powerpc-mwcc"
 
126
CC=mwccppc
 
127
LD=mwccppc
 
128
CF=-w9 -O7 -opt schedule604 -rostr -I. $(LOC)
 
129
LF=-o unzip
 
130
LF2=-warn -L/boot/develop/lib/ppc -lbe -lroot
 
131
BEOS_MAIN=beosmain$O
 
132
TARGET=$(UNZIPS)
 
133
endif
 
134
 
 
135
ifeq "$(WHAT)" "powerpc-gcc"
 
136
CC=gcc
 
137
LD=gcc
 
138
CF=-O3 -mcpu=604 -Wall -ansi -I. -I/boot/develop/headers/be/support \
 
139
   -I/boot/develop/headers/be/storage $(LOC)
 
140
LF=-o unzip
 
141
LF2=-L/boot/develop/lib/ppc -lbe -lroot
 
142
BEOS_MAIN=beosmain$O
 
143
TARGET=$(UNZIPS)
 
144
endif
 
145
 
 
146
# This isn't likely to happen for R4 or later...
 
147
ifeq "$(WHAT)" "x86-mwcc"
 
148
CC=mwccx86
 
149
LD=mwccx86
 
150
CF=-O2 -w9 -I. $(LOC)
 
151
LF=-o unzip
 
152
LF2=-warn -L/boot/develop/lib/x86 -lbe -lroot
 
153
BEOS_MAIN=beosmain$O
 
154
TARGET=$(UNZIPS)
 
155
endif
 
156
 
 
157
ifeq "$(WHAT)" "x86-gcc"
 
158
CC=gcc
 
159
LD=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)
 
164
LF=-o unzip
 
165
LF2=-L/boot/develop/lib/x86 -lbe -lroot
 
166
BEOS_MAIN=beosmain$O
 
167
TARGET=$(UNZIPS)
 
168
endif
 
169
 
 
170
ifndef TARGET
 
171
TARGET=help
 
172
endif
 
173
 
 
174
######################################################################
 
175
# Helpful targets
 
176
all:
 
177
        @echo 'TARGET = $(TARGET)'
 
178
        @echo 'ARCH   = $(ARCH)'
 
179
        @echo 'CC     = $(CC)'
 
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) ; \
 
185
        else \
 
186
                $(MAKE) help ; \
 
187
        fi
 
188
 
 
189
help:
 
190
        @echo ''
 
191
        @echo "This Makefile lets you build Info-ZIP's zip."
 
192
        @echo ''
 
193
        @echo 'To build zip for this computer using the default compiler, just do:'
 
194
        @echo ''
 
195
        @echo ' make -f beos/Makefile'
 
196
        @echo ''
 
197
        @echo 'To build zip for a specific architecture using a specific'
 
198
        @echo 'compiler, do:'
 
199
        @echo ''
 
200
        @echo ' ARCH=cpu CC=compiler make -f beos/Makefile'
 
201
        @echo ''
 
202
        @echo 'Where:'
 
203
        @echo ' cpu is either "powerpc" or "x86"'
 
204
        @echo ' compiler is either "mwcc" or "gcc"'
 
205
        @echo ''
 
206
 
 
207
######################################################################
 
208
# Basic compile instructions and dependencies
 
209
 
 
210
# this is for GNU make; comment out and notify zip-bugs if it causes errors
 
211
.SUFFIXES:      .c .o
 
212
 
 
213
# default for compiling C files
 
214
.c.o:
 
215
        $(CC) -c $(CF) $*.c
 
216
 
 
217
 
 
218
unzips:         $(UNZIPS)
 
219
objs:           $(OBJS)
 
220
objsdll:        $(OBJSDLL)
 
221
docs:           $(DOCS)
 
222
unzipsman:      unzips docs
 
223
unzipsdocs:     unzips docs
 
224
 
 
225
 
 
226
unzip$E:        $(OBJS) beos/unzip.rsc
 
227
        $(LD) $(LF) $(LOBJS) $(LF2)
 
228
        chmod +x unzip$E
 
229
        xres -o unzip$E beos/unzip.rsc
 
230
        mimeset -f -all unzip$E
 
231
 
 
232
unzipsfx$E:     $(OBJX) beos/unzipsfx.rsc
 
233
        $(LD) $(SL) $(LOBJX) $(SL2)
 
234
        chmod +x unzipsfx$E
 
235
        xres -o unzipsfx$E beos/unzipsfx.rsc
 
236
        mimeset -f -all unzipsfx
 
237
 
 
238
funzip$E:       $(OBJF)
 
239
        $(LD) $(FL) $(OBJF) $(FL2)
 
240
        chmod +x funzip$E
 
241
 
 
242
zipinfo$E:      unzip$E
 
243
        $(LN) unzip$E zipinfo$E
 
244
 
 
245
 
 
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)
 
264
 
 
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
 
268
        $(RM) unzipsfx.c
 
269
 
 
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
 
273
        $(RM) crypt_.c
 
274
 
 
275
crctab_$O:      crctab.c $(UNZIP_H) zip.h                       # unzipsfx only
 
276
        $(CP) crctab.c crctab_.c
 
277
        $(CC) -c $(CF) -DSFX crctab_.c
 
278
        $(RM) crctab_.c
 
279
 
 
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
 
283
        $(RM) fileio_.c
 
284
 
 
285
extract_$O:     extract.c $(UNZIP_H) crypt.h                    # unzipsfx only
 
286
        $(CP) extract.c extract_.c
 
287
        $(CC) -c $(CF) -DSFX extract_.c
 
288
        $(RM) extract_.c
 
289
 
 
290
globals_$O:     globals.c $(UNZIP_H)                            # unzipsfx only
 
291
        $(CP) globals.c globals_.c
 
292
        $(CC) -c $(CF) -DSFX globals_.c
 
293
        $(RM) globals_.c
 
294
 
 
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
 
298
        $(RM) inflate_.c
 
299
 
 
300
process_$O:     process.c $(UNZIP_H)                            # unzipsfx only
 
301
        $(CP) process.c process_.c
 
302
        $(CC) -c $(CF) -DSFX process_.c
 
303
        $(RM) process_.c
 
304
 
 
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
 
308
        $(RM) ttyio_.c
 
309
 
 
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
 
313
        $(RM) cryptf.c
 
314
 
 
315
globalsf$O:     globals.c $(UNZIP_H)                            # funzip only
 
316
        $(CP) globals.c globalsf.c
 
317
        $(CC) -c $(CF) -DFUNZIP globalsf.c
 
318
        $(RM) globalsf.c
 
319
 
 
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
 
323
        $(RM) inflatef.c
 
324
 
 
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
 
328
        $(RM) ttyiof.c
 
329
 
 
330
beos$O:         beos/beos.c $(UNZIP_H) unzvers.h                # BeOS only
 
331
        $(CC) -c $(CF) beos/beos.c
 
332
 
 
333
beosmain$O:     beos/beosmain.cpp $(UNZIP_H) unzvers.h          # BeOS only
 
334
        $(CCPP) -c $(CPPF) beos/beosmain.cpp
 
335
 
 
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
 
340
        $(RM) beos_.c
 
341
 
 
342
beosmain_$O:    beos/beosmain.cpp $(UNZIP_H)
 
343
        $(CP) beos/beosmain.cpp beosmain_.cpp
 
344
        $(CCPP) -c $(CPPF) -Ibeos -DSFX beosmain_.cpp
 
345
        $(RM) beosmain_.cpp
 
346
 
 
347
 
 
348
# this really only works for Unix targets, unless E and O specified on cmd line
 
349
clean:
 
350
        -rm -f $(UNZIPS) $(OBJS) $(OBJF) $(OBJX) api$O apihelp$O crc_gcc$O \
 
351
          unzipstb$O beosmain.o beosmain_.o
 
352
 
 
353
install:        all
 
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)
 
367
 
 
368
# alternatively, could use zip method:  -cd $(BINDIR); rm -f $(UNZIPS)  [etc.]
 
369
uninstall:
 
370
        rm -f $(INSTALLEDBIN) $(INSTALLEDMAN)
 
371
 
 
372
 
 
373
TESTZIP = testmake.zip  # the test zipfile
 
374
 
 
375
# test some basic features of the build
 
376
test:           check
 
377
 
 
378
check:  unzips
 
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
 
383
#
 
384
        echo "  testing extraction"
 
385
        ./unzip -b $(TESTZIP) testmake.zipinfo
 
386
        if test $? ; then \
 
387
            echo "  error:  file extraction from $(TESTZIP) failed"; exit 1; fi
 
388
#
 
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
 
394
#
 
395
        echo '  testing unzip -d exdir option'
 
396
        ./unzip -b $(TESTZIP) -d testun
 
397
        cat testun/notes
 
398
#
 
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
 
404
#
 
405
        echo '  testing unzipsfx (self-extractor)'
 
406
        cat unzipsfx $(TESTZIP) > testsfx
 
407
        $(CHMOD) 0700 testsfx
 
408
        ./testsfx -b notes
 
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
 
412
        rmdir testun
 
413
#
 
414
        echo '  testing complete.'