Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
6725 | siemargl | 1 | # Makefile for Info-ZIP's UnZip, UnZipSFX and fUnZip using DJGPP v2.01 or |
2 | # higher, by Frank Donahoe. Last updated: 21 Jul 2008 |
||
3 | |||
4 | # This Makefile is specifically tailored for GNU make and GNU C and |
||
5 | # may not work with a generic Unix-compatible make utility. The latest |
||
6 | # make version is 3.78.1. Thanks to Eli Zaretskii for generously responding |
||
7 | # to questions with advice on the changes needed to make install work under |
||
8 | # DJGPP version 2.0x. |
||
9 | # Features used: |
||
10 | # - pattern rules (%.o : %.c, etc.) |
||
11 | # - GNU-specific conditionals and functions (ifeq, $(patsubst,,),...) |
||
12 | # - simply expanded variables (VAR := text) |
||
13 | # |
||
14 | # The stand-alone executable requires DPMI services to run. If running |
||
15 | # in a DOS window under Windows 3.1 or later, the dpmi server is auto- |
||
16 | # matically present. Under DOS, if a DPMI server is not loaded, the |
||
17 | # program will look for "cwsdpmi.exe." If found, it will be loaded for |
||
18 | # the duration of the program. |
||
19 | # |
||
20 | # cwsdpmi is a "free" dpmi server written by Charles W. Sandmann |
||
21 | # (sandman@clio.rice.edu). It may be found, among other sites, on SimTel |
||
22 | # Net at the URL: |
||
23 | # |
||
24 | # ftp://ftp.simtel.net/pub/simtelnet/gnu/djgpp/v2misc/csdpmi?[b,s].zip |
||
25 | # |
||
26 | # and on its mirrors worldwide. The latest version as of this writing is 5. |
||
27 | # Archives with the b postscript contain the binaries. An alternate server |
||
28 | # is found, l.c., in the archive pmode??[b,s].zip. The latest (20001022) is |
||
29 | # v1.3. |
||
30 | |||
31 | # Separators colon and |
||
32 | VPATH=. msdos |
||
33 | |||
34 | ifdef NOASM |
||
35 | USE_ASMCRC= |
||
36 | else |
||
37 | USE_ASMCRC=1 |
||
38 | endif |
||
39 | |||
40 | .PHONY : clean install uninstall |
||
41 | |||
42 | # UnZip flags |
||
43 | # LOCAL_UNZIP may be set in "AUTOEXEC.BAT" or defined in "djgpp.env" under |
||
44 | # [make] as in the example below. Or, if you habitually work in a DOS box |
||
45 | # under Windows9x, right click on the MS-DOS icon, select properties, then |
||
46 | # program, to find a slot called batch file, where you may specify the path |
||
47 | # to a file which will set the variables of choice every time the box is |
||
48 | # opened. |
||
49 | # See, for example, DOSWILD, in the file INSTALL. |
||
50 | |||
51 | # [make] |
||
52 | # +BUTT=-mcpu=pentiumpro |
||
53 | # +LOC=-W -Wall |
||
54 | # +LOCAL_UNZIP=-DUSE_UNSHRINK |
||
55 | |||
56 | # BUTT may be defined to specify the target system. With gcc v2.95, |
||
57 | # optimizing options like "-mcpu=pentiumpro -march=pentiumpro" are supported, |
||
58 | # but the traditional "-m386" and "-m486" options of previous gcc 2.x |
||
59 | # version will continue to work. |
||
60 | # So if you are in the habit of compiling from source, programs for your |
||
61 | # own use, it is well to consult gcc's manual for options suitable to |
||
62 | # your processer and to set BUTT accordingly. Consult INSTALL for |
||
63 | # LOCAL_UNZIP. |
||
64 | |||
65 | LOC= |
||
66 | CC=gcc |
||
67 | LD=$(CC) |
||
68 | CPPFLAGS=-I. $(INC_BZ2LIB) -DDOS -DUSE_VFAT $(ASMFLG) $(LOCAL_UNZIP) $(LOC) |
||
69 | ASFLAGS=$(CPPFLAGS) |
||
70 | CFLAGS=-Wall -O2 $(BUTT) $(CPPFLAGS) |
||
71 | |||
72 | # See INSTALL for discussion of SFX_EXDIR. |
||
73 | # EXDIR=-DSFX_EXDIR |
||
74 | |||
75 | FUN_FLAGS=$(CFLAGS) -DFUNZIP |
||
76 | |||
77 | # Include OFP for a modest decrease in size of unzipsfx.exe. |
||
78 | OFP=-fomit-frame-pointer |
||
79 | |||
80 | SFX_FLAGS=-Wall -O2 $(CPPFLAGS) -DSFX $(EXDIR) $(OFP) |
||
81 | LDFLAGS=-s |
||
82 | |||
83 | # general-purpose stuff |
||
84 | # If cp.exe is not found change to CP=copy /Y . |
||
85 | CP = cp -fp |
||
86 | # If install.exe is not found change to INSTALL=$(CP) . To prevent a |
||
87 | # conflict with any of the many different "install's" that might be found |
||
88 | # in the path, GNU install will be called as `ginstall'. This also bypasses |
||
89 | # a stub bug that cropped up with the install from fil316b.zip. |
||
90 | INSTALL=ginstall |
||
91 | # The default value of RM is "rm -f" . If rm.exe is not found, uncomment |
||
92 | # the following: |
||
93 | # RM=del |
||
94 | # Laszlo Molnar who wrote DJ Packer and Markus F. X. J. Oberhumer who wrote |
||
95 | # the compression library used by the DJ Packer have collaborated on the |
||
96 | # Ultimate Packer for eXecutables, which has recently been released. Look |
||
97 | # for upx???d.zip at http://upx.sourceforge.net/ |
||
98 | # As an alternative, look for "djp.exe", now two years old, in the archive |
||
99 | # mlp107[b,s].zip, found in the same location as csdpmi?[b,s].zip (see above). |
||
100 | # Do not add the option -s to djp.exe without making the required changes |
||
101 | # to the target zipinfo$E. Uncomment the three lines beginning with $(DJP) |
||
102 | # or $(DJPSX). |
||
103 | |||
104 | #DJP = djp -q |
||
105 | #DJPSX = djp -q -s |
||
106 | DJP = upx -qq --best |
||
107 | DJPSX = $(DJP) |
||
108 | E = .exe |
||
109 | O = .o |
||
110 | M=msdos |
||
111 | |||
112 | # defaults for crc32 stuff and system dependent headers |
||
113 | ifdef USE_ASMCRC |
||
114 | ASMFLG = -DASM_CRC |
||
115 | CRCA_O = crc_gcc$O |
||
116 | else |
||
117 | ASMFLG = |
||
118 | CRCA_O = |
||
119 | endif |
||
120 | |||
121 | # optional inclusion of bzip2 decompression |
||
122 | IZ_BZIP2 = bzip2 |
||
123 | ifdef USEBZ2 |
||
124 | INC_BZ2LIB = -I$(IZ_BZIP2) |
||
125 | LOCAL_UNZIP:=-DUSE_BZIP2 $(LOCAL_UNZIP) |
||
126 | LD_BZ2LIB = -L$(IZ_BZIP2) -lbz2 |
||
127 | LIBBZIP2 = $(IZ_BZIP2)/libbz2.a |
||
128 | else |
||
129 | INC_BZ2LIB = |
||
130 | LD_BZ2LIB = |
||
131 | LIBBZIP2 = |
||
132 | endif |
||
133 | |||
134 | # object files |
||
135 | OBJS1 = unzip$O crc32$O $(CRCA_O) crypt$O envargs$O explode$O |
||
136 | OBJS2 = extract$O fileio$O globals$O inflate$O list$O match$O |
||
137 | OBJS3 = process$O ttyio$O ubz2err$O unreduce$O unshrink$O zipinfo$O |
||
138 | OBJS = $(OBJS1) $(OBJS2) $(OBJS3) $M$O |
||
139 | |||
140 | OBJX = unzipsfx$O crc32_$O $(CRCA_O) crypt_$O extract_$O fileio_$O \ |
||
141 | globals_$O inflate_$O match_$O process_$O ttyio_$O ubz2err_$O $M_$O |
||
142 | |||
143 | OBJF = funzip$O crc32-$O $(CRCA_O) crypt-$O globals-$O inflate-$O ttyio-$O |
||
144 | |||
145 | OBJECTS_ALL = $(sort $(OBJS) $(OBJX) $(OBJF) crc_gcc$O) |
||
146 | |||
147 | # Common header files included by all C sources: |
||
148 | UNZIP_H = unzip.h unzpriv.h globals.h msdos/doscfg.h |
||
149 | |||
150 | # executable files |
||
151 | UNZIPS = unzip$E zipinfo$E funzip$E unzipsfx$E |
||
152 | |||
153 | # pattern rules to compile the sources: |
||
154 | %$O : %.c |
||
155 | $(CC) $(CFLAGS) -c $< -o $@ |
||
156 | |||
157 | %-$O: %.c |
||
158 | $(CC) $(FUN_FLAGS) -c $< -o $@ |
||
159 | |||
160 | %_$O: %.c |
||
161 | $(CC) $(SFX_FLAGS) -c $< -o $@ |
||
162 | |||
163 | %sfx$O: %.c |
||
164 | $(CC) $(SFX_FLAGS) -c $< -o $@ |
||
165 | |||
166 | all: unzips |
||
167 | |||
168 | unzips: unzip$E zipinfo$E funzip$E unzipsfx$E |
||
169 | |||
170 | unzip$E: $(OBJS) $(LIBBZIP2) |
||
171 | $(LD) $(LDFLAGS) $(OBJS) $(LD_BZ2LIB) -o $@ |
||
172 | # $(DJP) $@ |
||
173 | |||
174 | zipinfo$E: unzip$E |
||
175 | stubify -g $@ |
||
176 | stubedit $@ runfile=unzip argv0=zipinfo |
||
177 | |||
178 | funzip$E: $(OBJF) |
||
179 | $(LD) $(LDFLAGS) $(OBJF) -o $@ |
||
180 | # $(DJP) $@ |
||
181 | |||
182 | unzipsfx$E: $(OBJX) |
||
183 | $(LD) $(LDFLAGS) $(OBJX) -o $@ |
||
184 | # $(DJPSX) $@ |
||
185 | |||
186 | # create/update the library for the optional bzip2 support: |
||
187 | $(IZ_BZIP2)/libbz2.a: |
||
188 | $(MAKE) -C $(IZ_BZIP2) -f Makebz2.iz CC="$(CC)" RM="$(RM)" |
||
189 | |||
190 | # explicit compilation instructions: |
||
191 | |||
192 | crc_gcc$O: crc_i386.S # 32bit, GNU AS |
||
193 | $(CC) $(ASFLAGS) -x assembler-with-cpp -c -o $@ $< |
||
194 | |||
195 | # BIN_PATH may be defined in djgpp.env [make] or defined below. If the |
||
196 | # installation is to the directory containing gcc.exe etc. place the |
||
197 | # following in djgpp.env: |
||
198 | |||
199 | # [make] |
||
200 | # +BIN_PATH=%\DJDIR%\bin |
||
201 | |||
202 | # Even if so placed, it can be over-ridden here by, say: |
||
203 | # BIN_PATH=c:\usr\bin |
||
204 | |||
205 | install: |
||
206 | -@if not exist $(BIN_PATH)\nul mkdir $(BIN_PATH) |
||
207 | command.com /c for %f in ($(UNZIPS)) do $(INSTALL) %f $(BIN_PATH) > NUL |
||
208 | |||
209 | uninstall: |
||
210 | command.com /c for %f in ($(UNZIPS)) do $(RM) $(BIN_PATH)\%f > NUL |
||
211 | |||
212 | clean: |
||
213 | $(MAKE) -C $(IZ_BZIP2) -f Makebz2.iz CC="$(CC)" RM="$(RM)" clean |
||
214 | ifeq ($(firstword $(RM)), del) |
||
215 | $(RM) *$O |
||
216 | $(RM) *.~ |
||
217 | $(RM) *.exe |
||
218 | else |
||
219 | $(RM) $(OBJECTS_ALL) *.~ *.exe |
||
220 | endif |
||
221 | |||
222 | # Source dependencies: |
||
223 | crc_gcc$O: crc_i386.S |
||
224 | crc32$O: crc32.c $(UNZIP_H) zip.h crc32.h |
||
225 | crc32-$O: crc32.c $(UNZIP_H) zip.h crc32.h |
||
226 | crc32_$O: crc32.c $(UNZIP_H) zip.h crc32.h |
||
227 | crypt$O: crypt.c $(UNZIP_H) zip.h crypt.h crc32.h ttyio.h |
||
228 | crypt-$O: crypt.c $(UNZIP_H) zip.h crypt.h crc32.h ttyio.h |
||
229 | crypt_$O: crypt.c $(UNZIP_H) zip.h crypt.h crc32.h ttyio.h |
||
230 | envargs$O: envargs.c $(UNZIP_H) |
||
231 | explode$O: explode.c $(UNZIP_H) |
||
232 | extract$O: extract.c $(UNZIP_H) crc32.h crypt.h |
||
233 | extract_$O: extract.c $(UNZIP_H) crc32.h crypt.h |
||
234 | fileio$O: fileio.c $(UNZIP_H) crc32.h crypt.h ttyio.h ebcdic.h |
||
235 | fileio_$O: fileio.c $(UNZIP_H) crc32.h crypt.h ttyio.h ebcdic.h |
||
236 | funzip$O: funzip.c $(UNZIP_H) crc32.h crypt.h ttyio.h |
||
237 | globals$O: globals.c $(UNZIP_H) |
||
238 | globals-$O: globals.c $(UNZIP_H) |
||
239 | globals_$O: globals.c $(UNZIP_H) |
||
240 | inflate$O: inflate.c inflate.h $(UNZIP_H) |
||
241 | inflate-$O: inflate.c inflate.h $(UNZIP_H) crypt.h |
||
242 | inflate_$O: inflate.c inflate.h $(UNZIP_H) |
||
243 | list$O: list.c $(UNZIP_H) |
||
244 | match$O: match.c $(UNZIP_H) |
||
245 | match_$O: match.c $(UNZIP_H) |
||
246 | msdos$O: msdos/msdos.c $(UNZIP_H) |
||
247 | msdos_$O: msdos/msdos.c $(UNZIP_H) |
||
248 | process$O: process.c $(UNZIP_H) crc32.h |
||
249 | process_$O: process.c $(UNZIP_H) crc32.h |
||
250 | ttyio$O: ttyio.c $(UNZIP_H) zip.h crypt.h ttyio.h |
||
251 | ttyio-$O: ttyio.c $(UNZIP_H) zip.h crypt.h ttyio.h |
||
252 | ttyio_$O: ttyio.c $(UNZIP_H) zip.h crypt.h ttyio.h |
||
253 | ubz2err$O: ubz2err.c $(UNZIP_H) |
||
254 | ubz2err_$O: ubz2err.c $(UNZIP_H) |
||
255 | unreduce$O: unreduce.c $(UNZIP_H) |
||
256 | unshrink$O: unshrink.c $(UNZIP_H) |
||
257 | unzip$O: unzip.c $(UNZIP_H) crypt.h unzvers.h consts.h |
||
258 | unzipsfx$O: unzip.c $(UNZIP_H) crypt.h unzvers.h consts.h |
||
259 | zipinfo$O: zipinfo.c $(UNZIP_H) |