File: makefile.os2

package info (click to toggle)
unzip 6.0-16%2Bdeb8u3
  • links: PTS
  • area: main
  • in suites: jessie
  • size: 8,768 kB
  • ctags: 10,194
  • sloc: ansic: 55,133; cpp: 4,084; makefile: 2,517; asm: 1,789; cs: 1,012; sh: 119
file content (662 lines) | stat: -rw-r--r-- 18,604 bytes parent folder | download | duplicates (10)
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
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
# Makefile for UnZip, UnZipSFX and fUnZip                     03 January 2007
#
#  supported compilers:
#  - Microsoft C, version 6.00 or higher, for use under OS/2 1.x (16-bit)
#  - Watcom C/C++, version 9.0+, for use under OS/2 1.x or 2.x+ (16/32-bit)
#  - emx+gcc, version 0.9c or higher, for use under OS/2 2.x+ (32-bit)
#  - IBM C Set++, for use under OS/2 2.x+ (32-bit)
#  - Borland C++, for use under OS/2 2.x+ (32-bit)
#  - Metaware High C/C++, for use under OS/2 2.x+ (32-bit)
#
#  supported cross-compilers:
#  - Microsoft C, version 6.0 or 7.0, for use under DOS (16-bit)
#  - Watcom C/C++, version 9.0+, for use under DOS/Win95/NT (16/32-bit)
#  - GNU gcc (emx), version 0.9c or higher, for use under DOS/Win95/NT (32-bit)
#
#  supported assemblers:
#  - Microsoft MASM 6.00 with Microsoft C
#  - Watcom WASM with Watcom C/C++
#  - GNU as with GNU gcc

# To use MASM 5.x instead of MASM 6.00:
#  - set AS="masm -t -Ml"
#  - set ASEOL=";"

# To use, enter "{d,n}make -f os2/makefile.os2" (this makefile depends on its
# name being "makefile.os2", and it must be in the os2 subdirectory).

# In case you want to use Watcom wmake instead, you have to switch wmake into
# the "MS nmake compatible" mode by specifying the "-ms" option. Additionally,
# it is required to override the MAKE macro definition for the recursive
# invokation of wmake. An example:
#   wmake -ms -f os2/makefile.os2 MAKE="wmake -ms" watcom

# Notes on Microsoft C 6.00 compilation for OS/2:
#
#   The resulting programs can be used under OS/2 protected mode only, not
#   under DOS.  A larger stack has to be used for OS/2 because system calls
#   use more stack than under DOS; 8k is recommended by Microsoft.

# Notes on IBM C Set++, Watcom C/C++, Borland C++ or emx+gcc compilation:
#
#   The resulting programs can be used under protected mode of OS/2 2.x or
#   higher only, not under OS/2 1.x and not under DOS.
#
#   The NFLAGS macro is used to work around an optimization bug in the IBM
#   C++ Set compiler; this is fixed by CSD #4, so NFLAGS="" can be used for
#   all targets below.

# Notes on Watcom C/C++ compilation for DOS with the PMODE/W extender:
#
#   You need to add the following section to your \watcom\binb\wlsystem.lnk
#   file and also need to copy pmodew.exe to the same directory:
#
#   system begin pmodew
#       option osname='PMODE/W'
#       libpath %WATCOM%\lib386
#       libpath %WATCOM%\lib386\dos
#       op stub=pmodew.exe
#       format os2 le
#   end
#
#   PMODE/W 1.16 or higher is required.  See also msdos/README for important
#   notes about PMODE/W bugs.

default:
	@echo "Enter `$(MAKE) -f os2/makefile.os2 target' from the main"
	@echo "UnZip directory, where target is one of:"
	@echo "   msc mscdebug mscdos ibm ibmdyn ibmdebug ibmprof"
	@echo "   ibmdll ibmdyndll ibmdebugdll ibmprofdll"
	@echo "   metaware borland gcc gccdyn gccdebug gccdos gccwin32"
	@echo "   watcom watcom16 watcomdos watcom16dos pmodew watcomwin32"

# MS C 6.00 for OS/2, 16-bit (should figure out way to split unzip/funzip
# compiles so former is always large model and latter always small model...)
msc:
	$(MAKE) -f os2/makefile.os2 all \
	CC="cl -nologo -AL -Ocegit -Gs -I. $(FP)" \
	CFLAGS="-G2 -Zp1 -W3 -DOS2 -DMSC -DASM_CRC $(LOCAL_UNZIP)" \
	NFLAGS="" \
	DLLFLAG="" \
	AS="ml -nologo -c -Zm -Cp" \
	ASFLAGS="-D__LARGE__ -D__286" \
	LDFLAGS="-F 2000 -Lp -Fe" \
	LDFLAGS2="-link /noe" \
	OUT="-Fo" \
	OBJ=".obj" \
	CRCA_O="crc_i86.obj" \
	OBJF2="os2f.obj" \
	DEF="os2\unzip.def"

# MS C 6.00 for OS/2, debug version
mscdebug:
	$(MAKE) -f os2/makefile.os2 all \
	CC="cl -nologo -AL -Zi -Od -I. $(FP)" \
	CFLAGS="-G2 -Zp1 -W3 -DOS2 -DMSC -DASM_CRC $(LOCAL_UNZIP)" \
	NFLAGS="" \
	DLLFLAG="" \
	AS="ml -nologo -c -Zim -Cp" \
	ASFLAGS="-D__LARGE__ -D__286" \
	LDFLAGS="-F 2000 -Lp -Fe" \
	LDFLAGS2="-link /noe" \
	OUT="-Fo" \
	OBJ=".obj" \
	CRCA_O="crc_i86.obj" \
	OBJF2="os2f.obj" \
	DEF="os2\unzip.def"

# cross-compilation for MS-DOS with MS C 6.00 (same comment as above...formerly;
# now unzip is large model again, because of DEFLATE_64 support)
mscdos:
	$(MAKE) -f os2/makefile.os2 all \
	CC="cl -nologo -AL -Oaict -Gs -I. $(FP)" \
	CFLAGS="-Zp1 -W3 -DASM_CRC $(LOCAL_UNZIP)" \
	NFLAGS="" \
	DLLFLAG="" \
	AS="ml -nologo -c -Zm -Cp" \
	ASFLAGS="-D__LARGE__" \
	LDFLAGS="-F 0C00 -Lr -Fe" \
	LDFLAGS2="-link /noe /exe" \
	OUT="-Fo" \
	OBJ=".obj" \
	CRCA_O="crc_i86" \
	OBJU2="msdos.obj" \
	OBJX2="msdos_.obj" \
	OBJF2="msdosf.obj" \
	OSDEP_H="msdos/doscfg.h"

# IBM C Set, statically linked runtime
ibm:
	$(MAKE) -f os2/makefile.os2 all \
	CC="icc -Q -O -Gs -I." \
	CFLAGS="-Sm -Sp1 -DOS2 $(LOCAL_UNZIP)" \
	NFLAGS="" \
	DLLFLAG="" \
	LDFLAGS="-B/ST:0x50000 -Fe" \
	LDFLAGS2="" \
	OUT="-Fo" \
	OBJ=".obj" \
	DEF="os2\unzip.def"

# IBM C Set, dynamically linked runtime
ibmdyn:
	$(MAKE) -f os2/makefile.os2 all \
	CC="icc -Q -O -Gs -Gd -I." \
	CFLAGS="-Sm -Sp1 -DOS2 $(LOCAL_UNZIP)" \
	NFLAGS="" \
	DLLFLAG="" \
	LDFLAGS="-B/ST:0x50000 -Fe" \
	LDFLAGS2="" \
	OUT="-Fo" \
	OBJ=".obj" \
	DEF="os2\unzip.def"

# IBM C Set, debug version
ibmdebug:
	$(MAKE) -f os2/makefile.os2 all \
	CC="icc -Q -Ti -I." \
	CFLAGS="-Sm -Sp1 -D__DEBUG_ALLOC__ -DOS2 $(LOCAL_UNZIP)" \
	NFLAGS="" \
	DLLFLAG="" \
	LDFLAGS="-B/ST:0x50000 -Fe" \
	LDFLAGS2="" \
	OUT="-Fo" \
	OBJ=".obj" \
	DEF="os2\unzip.def"

# IBM C Set, profiling version for PROFIT
ibmprof:
	$(MAKE) -f os2/makefile.os2 all \
	CC="icc -Q -O -Gs -Gh -Ti -I." \
	CFLAGS="-Sm -Sp1 -DOS2 $(LOCAL_UNZIP)" \
	NFLAGS="" \
	DLLFLAG="" \
	LDFLAGS="-B/ST:0x50000 -Fe" \
	LDFLAGS2="cppopa3.obj" \
	OUT="-Fo" \
	OBJ=".obj" \
	DEF="os2\unzip.def"

# IBM C Set, statically linked runtime
ibmdll:
	$(MAKE) -f os2/makefile.os2 dll \
	CC="icc -Q -O -Gs -I." \
	CFLAGS="-Sm -Sp1 -DOS2 $(LOCAL_UNZIP)" \
	NFLAGS="" \
	DLLFLAG="-Gm -Ge- -DDLL -DOS2DLL -DAPI_DOC" \
	LDFLAGS="-Fe" \
	LDFLAGS2="" \
	OUT="-Fo" \
	OBJ=".obj" \
	DLLDEF="os2\rexxapi.def" \
	STUBDEF="os2\stub.def" \
	DEF="os2\unzip.def" \
	APILIB="REXX.lib"

# IBM C Set, dynamically linked runtime
ibmdyndll:
	$(MAKE) -f os2/makefile.os2 dll \
	CC="icc -Q -O -Gs -Gd -I." \
	CFLAGS="-Sm -Sp1 -DOS2 $(LOCAL_UNZIP)" \
	NFLAGS="" \
	DLLFLAG="-Gm -Ge- -DDLL -DOS2DLL -DAPI_DOC" \
	LDFLAGS="-Fe" \
	LDFLAGS2="" \
	OUT="-Fo" \
	OBJ=".obj" \
	DLLDEF="os2\rexxapi.def" \
	STUBDEF="os2\stub.def" \
	DEF="os2\unzip.def" \
	APILIB="REXX.lib"

# IBM C Set, debug version
ibmdebugdll:
	$(MAKE) -f os2/makefile.os2 dll \
	CC="icc -Q -Ti -I." \
	CFLAGS="-Sm -Sp1 -D__DEBUG_ALLOC__ -DOS2 $(LOCAL_UNZIP)" \
	NFLAGS="" \
	DLLFLAG="-Gm -Ge- -DDLL -DOS2DLL -DAPI_DOC" \
	LDFLAGS="-Fe" \
	LDFLAGS2="" \
	OUT="-Fo" \
	OBJ=".obj" \
	DLLDEF="os2\rexxapi.def" \
	STUBDEF="os2\stub.def" \
	DEF="os2\unzip.def" \
	APILIB="REXX.lib"

# IBM C Set, profiling version for PROFIT
ibmprofdll:
	$(MAKE) -f os2/makefile.os2 dll \
	CC="icc -Q -O -Gs -Gh -Ti -I." \
	CFLAGS="-Gm -Sm -Sp1 -DOS2 $(LOCAL_UNZIP)" \
	NFLAGS="" \
	DLLFLAG="-Gm -Ge- -DDLL -DOS2DLL -DAPI_DOC" \
	LDFLAGS="-Fe" \
	LDFLAGS2="profit.obj" \
	OUT="-Fo" \
	OBJ=".obj" \
	DLLDEF="os2\rexxapi.def" \
	STUBDEF="os2\stub.def" \
	DEF="os2\unzip.def" \
	APILIB="REXX.lib"

# Watcom C/386 9.0 or higher
watcom:
	$(MAKE) -f os2/makefile.os2 all \
	CC="wcl386 -bt=os2v2 -zq -Ox -s -I." \
	CFLAGS="-Zp1 -DOS2 -DASM_CRC $(LOCAL_UNZIP)" \
	NFLAGS="" \
	DLLFLAG="" \
	AS="wasm -bt=os2v2 -zq -3 -mf" \
	ASFLAGS="" \
	LDFLAGS="-k0x50000 -x -l=os2v2 -Fe=" \
	LDFLAGS2="" \
	OUT="-Fo" \
	OBJ=".obj" \
	CRCA_O="crc_i386.obj" \
	DEF="" \
	DIRSEP="\\" \
	AS_DIRSEP="\\"

# Watcom C/286 9.0 or higher
watcom16:
	$(MAKE) -f os2/makefile.os2 all \
	CC="wcl -bt=os2 -zq -ml -Ox -s -I." \
	CFLAGS="-Zp1 -DOS2 $(LOCAL_UNZIP)" \
	NFLAGS="" \
	DLLFLAG="" \
	AS="wasm -bt=os2 -zq -2 -ml" \
	ASFLAGS="" \
	LDFLAGS="-k0x2000 -x -l=os2 -Fe=" \
	LDFLAGS2="" \
	OUT="-Fo" \
	OBJ=".obj" \
	CRCA_O="crc_i86.obj" \
	OBJF2="os2f.obj" \
	DIRSEP="\\" \
	AS_DIRSEP="\\"

# Watcom C/386 9.0 or higher, crosscompilation for DOS, DOS4GW extender
watcomdos:
	$(MAKE) -f os2/makefile.os2 all \
	CC="wcl386 -bt=dos4g -zq -Ox -s -I." \
	CFLAGS="-Zp1 -DMSDOS -DASM_CRC $(LOCAL_UNZIP)" \
	NFLAGS="" \
	DLLFLAG="" \
	AS="wasm -bt=dos4g -zq -3 -mf" \
	ASFLAGS="" \
	LDFLAGS="-k0x50000 -x -l=dos4g -Fe=" \
	LDFLAGS2="" \
	OUT="-Fo" \
	OBJ=".obj" \
	CRCA_O="crc_i386.obj" \
	OBJU2="msdos.obj" \
	OBJX2="msdos_.obj" \
	OSDEP_H="msdos/doscfg.h" \
	DIRSEP="\\" \
	AS_DIRSEP="\\"

# Watcom C/386 9.0 or higher, crosscompilation for DOS, PMODE/W extender
pmodew:
	$(MAKE) -f os2/makefile.os2 all \
	CC="wcl386 -bt=dos4g -zq -Ox -s -I." \
	CFLAGS="-Zp1 -DMSDOS -DASM_CRC $(LOCAL_UNZIP)" \
	NFLAGS="" \
	DLLFLAG="" \
	AS="wasm -bt=dos4g -zq -3 -mf" \
	ASFLAGS="" \
	LDFLAGS="-k0x50000 -x -l=pmodew -Fe=" \
	LDFLAGS2="" \
	OUT="-Fo" \
	OBJ=".obj" \
	CRCA_O="crc_i386.obj" \
	OBJU2="msdos.obj" \
	OBJX2="msdos_.obj" \
	OSDEP_H="msdos/doscfg.h" \
	DIRSEP="\\" \
	AS_DIRSEP="\\"

# Watcom C/286 9.0 or higher, crosscompilation for DOS
watcom16dos:
	$(MAKE) -f os2/makefile.os2 all \
	CC="wcl -bt=dos -zq -ml -Ox -s -I." \
	CFLAGS="-Zp1 -DMSDOS $(LOCAL_UNZIP)" \
	NFLAGS="" \
	DLLFLAG="" \
	AS="wasm -bt=dos -0 -ml" \
	ASFLAGS="-D__LARGE__" \
	LDFLAGS="-k0xC00 -x -l=dos -Fe=" \
	LDFLAGS2="" \
	OUT="-Fo" \
	OBJ=".obj" \
	OBJU2="msdos.obj" \
	OBJX2="msdos_.obj" \
	OBJF2="msdosf.obj" \
	OSDEP_H="msdos/doscfg.h" \
	DIRSEP="\\" \
	AS_DIRSEP="\\"

# Watcom C/386 9.0 or higher, crosscompilation for Win95/NT
watcomwin32:
	$(MAKE) -f os2/makefile.os2 all \
	CC="wcl386 -bt=NT -zq -Ox -s -I." \
	CFLAGS="-Zp1 -DWIN32 -DASM_CRC $(LOCAL_UNZIP)" \
	NFLAGS="" \
	DLLFLAG="" \
	AS="wasm -bt=NT -zq -3 -mf" \
	ASFLAGS="" \
	LDFLAGS="-k0x50000 -x -l=NT -Fe=" \
	LDFLAGS2="" \
	OUT="-Fo" \
	OBJ=".obj" \
	CRCA_O="crc_i386.obj" \
	OBJU2="win32.obj nt.obj" \
	OBJX2="win32_.obj nt_.obj" \
	OBJF2="win32f.obj" \
	DEF="" \
	DIRSEP="\\" \
	AS_DIRSEP="\\"

# MetaWare High C/C++ 3.2
metaware:
	$(MAKE) -f os2/makefile.os2 all \
	CC="hc -O2 -I." \
	CFLAGS="-D__32BIT__ -DOS2 $(LOCAL_UNZIP)" \
	NFLAGS="" \
	DLLFLAG="" \
	LDFLAGS="-o " \
	LDFLAGS2="" \
	OUT="-o ./" \
	OBJ=".obj" \
	DEF="-Hdef=os2\unzip.def"

# Borland C++
borland:
	$(MAKE) -f os2/makefile.os2 all \
	CC="bcc -O -I. -Ios2" \
	CFLAGS="-w- -D__cdecl -D__32BIT__ -DOS2 $(LOCAL_UNZIP)" \
	NFLAGS="" \
	DLLFLAG="" \
	LDFLAGS="-e" \
	LDFLAGS2="" \
	OUT="-o" \
	OBJ=".obj" \
	DEF="-sDos2\unzip.def"

# emx, gcc, OMF format, statically linked C runtime
gcc:
	$(MAKE) -f os2/makefile.os2 all \
	CC="gcc -Zomf -O -I." \
	CFLAGS="-Wall -DOS2 -DASM_CRC $(LOCAL_UNZIP)" \
	NFLAGS="" \
	DLLFLAG="" \
	AS="gcc -Zomf" \
	ASFLAGS="-Di386" \
	LDFLAGS="-o ./" \
	LDFLAGS2="-Zsmall-conv -Zstack 320 -Zsys -s" \
	OUT="-o" \
	OBJ=".obj" \
	CRCA_O="crc_gcc.obj" \
	DEF="os2/unzip.def"

# emx, gcc, OMF format, dynamically linked C runtime
gccdyn:
	$(MAKE) -f os2/makefile.os2 all \
	CC="gcc -Zomf -O -I." \
	CFLAGS="-Wall -DOS2 -DASM_CRC $(LOCAL_UNZIP)" \
	NFLAGS="" \
	DLLFLAG="" \
	AS="gcc -Zomf" \
	ASFLAGS="-Di386" \
	LDFLAGS="-o ./" \
	LDFLAGS2="-Zstack 320 -Zcrtdll -s" \
	OUT="-o" \
	OBJ=".obj" \
	CRCA_O="crc_gcc.obj" \
	DEF="os2/unzip.def"

# emx, gcc, a.out format, with debug info for gdb
gccdebug:
	$(MAKE) -f os2/makefile.os2 all \
	CC="gcc -g -I." \
	CFLAGS="-Wall -DOS2 -DASM_CRC $(LOCAL_UNZIP)" \
	NFLAGS="" \
	DLLFLAG="" \
	AS="gcc -g" \
	ASFLAGS="-Di386" \
	LDFLAGS="-o ./" \
	LDFLAGS2="-Zsmall-conv" \
	OUT="-o" \
	OBJ=".o" \
	CRCA_O="crc_gcc.o" \

# emx, gcc, a.out format, cross-compilation for MS-DOS
gccdos:
	$(MAKE) -f os2/makefile.os2 all \
	CC="gcc -O -I." \
	CFLAGS="-Wall -DMSDOS -DASM_CRC $(LOCAL_UNZIP)" \
	NFLAGS="" \
	DLLFLAG="" \
	AS="gcc" \
	ASFLAGS="-Di386" \
	LDFLAGS="-o ./" \
	LDFLAGS2="-Zsmall-conv -s" \
	OUT="-o" \
	OBJ=".o" \
	CRCA_O="crc_gcc.o" \
	OBJU2="msdos.o" \
	OBJX2="msdos_.o" \
	OSDEP_H="msdos/doscfg.h"

# emx, gcc, RSXNT, cross-compilation for Win32, statically linked C runtime
gccwin32:
	$(MAKE) -f os2/makefile.os2 all \
	CC="gcc -Zwin32 -O2 -I." \
	CFLAGS="-Wall -DWIN32 -DASM_CRC $(LOCAL_UNZIP)" \
	NFLAGS="" \
	DLLFLAG="" \
	AS="gcc" \
	ASFLAGS="-Di386" \
	LDFLAGS="-Zsys -o ./" \
	LDFLAGS2="-ladvapi32 -Zsmall-conv -s" \
	OUT="-o" \
	OBJ=".o" \
	CRCA_O="crc_gcc.o" \
	OBJU2="win32.o nt.o" \
	OBJX2="win32_.o nt_.o" \
	OBJF2="win32f.o" \
	OSDEP_H="win32/w32cfg.h"

# variables

# LOCAL_UNZIP = -DREENTRANT

# default settings for target dependent macros:
DIRSEP = /
AS_DIRSEP = /

OSDEP_H = os2/os2data.h os2/os2cfg.h
CRCA_O  =

OBJU  = unzip$(OBJ) crc32$(OBJ) $(CRCA_O) crypt$(OBJ) envargs$(OBJ) \
	explode$(OBJ) extract$(OBJ) fileio$(OBJ) globals$(OBJ) \
	inflate$(OBJ) list$(OBJ) match$(OBJ) process$(OBJ) ttyio$(OBJ) \
	ubz2err$(OBJ) unreduce$(OBJ) unshrink$(OBJ) zipinfo$(OBJ)
OBJU2 = os2$(OBJ) os2acl$(OBJ)
OBJX  = unzipsf_$(OBJ) crc32_$(OBJ) $(CRCA_O) crypt_$(OBJ) \
        extract_$(OBJ) fileio_$(OBJ) globals_$(OBJ) inflate_$(OBJ) \
	match_$(OBJ) process_$(OBJ) ttyio_$(OBJ) ubz2err_$(OBJ)
OBJX2 = os2_$(OBJ) os2acl_$(OBJ)
OBJDLL= api$(OBJ) apihelp$(OBJ) rexxhelp$(OBJ) rexxapi$(OBJ)
OBJF  = funzip$(OBJ) crc32f$(OBJ) $(CRCA_O) cryptf$(OBJ) inflatef$(OBJ) \
	globalsf$(OBJ) ttyiof$(OBJ)
OBJF2 =

UNZIP_H = unzip.h unzpriv.h globals.h $(OSDEP_H)

# rules

.SUFFIXES:	.c .asm $(OBJ)

.c$(OBJ):
	$(CC) -c $(CFLAGS) $(DLLFLAG) $<

.asm$(OBJ):
	$(AS) $(ASFLAGS) $< $(ASEOL)

# targets

all:	unzip.exe funzip.exe unzipsfx.exe
dll:	unzip32.dll unzip.stb funzip.exe unzipsfx.exe

unzip.exe: $(OBJU) $(OBJU2)
	$(CC) $(LDFLAGS)$@ $(DEF) $(OBJU) $(OBJU2) $(LDFLAGS2)

funzip.exe: $(OBJF) $(OBJF2)
	$(CC) $(LDFLAGS)$@ $(DEF) $(OBJF) $(OBJF2) $(LDFLAGS2)

unzipsfx.exe:	$(OBJX) $(OBJX2)
	$(CC) $(LDFLAGS)$@ $(DEF) $(OBJX) $(OBJX2) $(LDFLAGS2)

unzip32.dll: $(DLLDEF) $(OBJU) $(OBJU2) $(OBJDLL)
	$(CC) $(DLLFLAG) $(LDFLAGS)$@ $(DLLDEF) $(OBJU) $(OBJDLL) $(OBJU2) $(APILIB) $(LDFLAGS2)

unzip.stb: unzipstb$(OBJ) $(STUBDEF)
	$(CC) $(LDFLAGS)$@ $(STUBDEF) unzipstb$(OBJ) $(LDFLAGS2)
	copy unzip.stb unzip.exe

# dependencies

apihelp$(OBJ):	apihelp.c $(UNZIP_H) unzvers.h
crc32$(OBJ):	crc32.c $(UNZIP_H) zip.h crc32.h
envargs$(OBJ):	envargs.c $(UNZIP_H)
explode$(OBJ):	explode.c $(UNZIP_H)
extract$(OBJ):	extract.c $(UNZIP_H) crc32.h crypt.h
fileio$(OBJ):	fileio.c $(UNZIP_H) crc32.h crypt.h ttyio.h ebcdic.h
globals$(OBJ):	globals.c $(UNZIP_H)
inflate$(OBJ):	inflate.c $(UNZIP_H)
list$(OBJ):	list.c $(UNZIP_H)
match$(OBJ):	match.c $(UNZIP_H)
process$(OBJ):	process.c $(UNZIP_H) crc32.h
ttyio$(OBJ):	ttyio.c $(UNZIP_H) zip.h crypt.h ttyio.h
ubz2err$(OBJ):	ubz2err.c $(UNZIP_H)
unreduce$(OBJ):	unreduce.c $(UNZIP_H)
unshrink$(OBJ):	unshrink.c $(UNZIP_H)
unzip$(OBJ):	unzip.c $(UNZIP_H) crypt.h unzvers.h consts.h
api$(OBJ):	api.c $(UNZIP_H) unzvers.h
zipinfo$(OBJ):	zipinfo.c $(UNZIP_H)

unzipstb$(OBJ):	unzipstb.c					# DLL version
	$(CC) -c $(CFLAGS) unzipstb.c

msdos$(OBJ):	msdos/msdos.c $(UNZIP_H) unzvers.h		# DOS only
	$(CC) -c $(CFLAGS) msdos$(DIRSEP)msdos.c

msdos_$(OBJ):	msdos/msdos.c $(UNZIP_H)			# DOS unzipsfx
	$(CC) -c $(CFLAGS) -DSFX $(OUT)$@ msdos$(DIRSEP)msdos.c

msdosf$(OBJ):	msdos/msdos.c $(UNZIP_H)			# DOS funzip
	$(CC) -c $(CFLAGS) -DFUNZII $(OUT)$@ msdos$(DIRSEP)msdos.c

win32$(OBJ):	win32/win32.c $(UNZIP_H) win32/nt.h unzvers.h	# Win32 only
	$(CC) -c $(CFLAGS) win32$(DIRSEP)win32.c

nt$(OBJ):	win32/nt.c $(UNZIP_H) win32/nt.h		# Win32 only
	$(CC) -c $(CFLAGS) win32$(DIRSEP)nt.c

win32_$(OBJ):	win32/win32.c $(UNZIP_H) win32/nt.h		# Win32 unzipsfx
	$(CC) -c $(CFLAGS) -DSFX $(OUT)$@ win32$(DIRSEP)win32.c

nt_$(OBJ):	win32/nt.c $(UNZIP_H) win32/nt.h		# Win32 unzipsfx
	$(CC) -c $(CFLAGS) -DSFX $(OUT)$@ win32$(DIRSEP)nt.c

win32f$(OBJ):	win32/win32.c $(UNZIP_H) win32/nt.h		# Win32 funzip
	$(CC) -c $(CFLAGS) -DFUNZIP $(OUT)$@ win32$(DIRSEP)win32.c

os2$(OBJ):	os2/os2.c $(UNZIP_H) unzvers.h			# OS/2 only
	$(CC) -c $(CFLAGS) $(DLLFLAG) os2$(DIRSEP)os2.c

os2_$(OBJ):	os2/os2.c $(UNZIP_H)				# OS/2 unzipsfx
	$(CC) -c $(CFLAGS) -DSFX $(OUT)$@ os2$(DIRSEP)os2.c

os2f$(OBJ):	os2/os2.c $(UNZIP_H)				# OS/2 funzip
	$(CC) -c $(CFLAGS) -DFUNZIP $(OUT)$@ os2$(DIRSEP)os2.c

os2acl$(OBJ):	os2/os2acl.c $(UNZIP_H) unzvers.h		# OS/2 only
	$(CC) -c $(CFLAGS) $(DLLFLAG) os2$(DIRSEP)os2acl.c

os2acl_$(OBJ):	os2/os2acl.c $(UNZIP_H) unzvers.h		# OS/2 unzipsfx
	$(CC) -c $(CFLAGS) -DSFX $(OUT)$@ os2$(DIRSEP)os2acl.c

rexxhelp$(OBJ):	os2/rexxhelp.c					# OS/2 DLL only
	$(CC) -c $(CFLAGS) $(DLLFLAG) os2$(DIRSEP)rexxhelp.c

rexxapi$(OBJ):	os2/rexxapi.c					# OS/2 DLL only
	$(CC) -c $(CFLAGS) $(DLLFLAG) os2$(DIRSEP)rexxapi.c

crc_i86$(OBJ):	msdos/crc_i86.asm				# 16bit only
	$(AS) $(ASFLAGS) msdos$(AS_DIRSEP)crc_i86.asm $(ASEOL)

crc_i386$(OBJ):	win32/crc_i386.asm				# 32bit, MASM
	$(AS) $(ASFLAGS) win32$(AS_DIRSEP)crc_i386.asm $(ASEOL)

crc_gcc$(OBJ):	crc_i386.S					# 32bit, GNU AS
	$(AS) $(ASFLAGS) -x assembler-with-cpp -c -o $@ crc_i386.S

# NFLAGS are solely used as work-around for optimization bug in IBM C++ Set
crypt$(OBJ):	crypt.c $(UNZIP_H) zip.h crypt.h crc32.h ttyio.h
	$(CC) -c $(CFLAGS) $(DLLFLAG) $(NFLAGS) crypt.c

# funzip compilation section
funzip$(OBJ):	funzip.c $(UNZIP_H) crc32.h crypt.h ttyio.h
	$(CC) -c $(CFLAGS) funzip.c

crc32f$(OBJ):	crc32.c $(UNZIP_H) zip.h crc32.h
	$(CC) -c $(CFLAGS) -DFUNZIP $(OUT)$@ crc32.c

cryptf$(OBJ):	crypt.c $(UNZIP_H) zip.h crypt.h crc32.h ttyio.h
	$(CC) -c $(CFLAGS) $(NFLAGS) -DFUNZIP $(OUT)$@ crypt.c

globalsf$(OBJ):	globals.c $(UNZIP_H)
	$(CC) -c $(CFLAGS) -DFUNZIP $(OUT)$@ globals.c

inflatef$(OBJ):	inflate.c inflate.h $(UNZIP_H) crypt.h
	$(CC) -c $(CFLAGS) -DFUNZIP $(OUT)$@ inflate.c

ttyiof$(OBJ):	ttyio.c $(UNZIP_H) zip.h crypt.h ttyio.h
	$(CC) -c $(CFLAGS) $(NFLAGS) -DFUNZIP $(OUT)$@ ttyio.c

# unzipsfx compilation section
crc32_$(OBJ):	crc32.c $(UNZIP_H) zip.h crc32.h
	$(CC) -c $(CFLAGS) -DSFX $(OUT)$@ crc32.c

crypt_$(OBJ):	crypt.c $(UNZIP_H) zip.h crypt.h crc32.h ttyio.h
	$(CC) -c $(CFLAGS) -DSFX $(OUT)$@ crypt.c

extract_$(OBJ):	extract.c $(UNZIP_H) crypt.h
	$(CC) -c $(CFLAGS) -DSFX $(OUT)$@ extract.c

fileio_$(OBJ):	fileio.c $(UNZIP_H) crc32.h crypt.h ttyio.h ebcdic.h
	$(CC) -c $(CFLAGS) -DSFX $(OUT)$@ fileio.c

globals_$(OBJ):	globals.c $(UNZIP_H)
	$(CC) -c $(CFLAGS) -DSFX $(OUT)$@ globals.c

inflate_$(OBJ):	inflate.c inflate.h $(UNZIP_H) crypt.h
	$(CC) -c $(CFLAGS) -DSFX $(OUT)$@ inflate.c

match_$(OBJ):	match.c $(UNZIP_H)
	$(CC) -c $(CFLAGS) -DSFX $(OUT)$@ match.c

process_$(OBJ):	process.c $(UNZIP_H) crc32.h
	$(CC) -c $(CFLAGS) -DSFX $(OUT)$@ process.c

ttyio_$(OBJ):	ttyio.c $(UNZIP_H) zip.h crypt.h ttyio.h
	$(CC) -c $(CFLAGS) -DSFX $(OUT)$@ ttyio.c

ubz2err_$(OBJ):	ubz2err.c $(UNZIP_H)
	$(CC) -c $(CFLAGS) -DSFX $(OUT)$@ ubz2err.c

unzipsf_$(OBJ):	unzip.c $(UNZIP_H) crypt.h unzvers.h consts.h
	$(CC) -c $(CFLAGS) -DSFX $(OUT)$@ unzip.c