File: makefile.wat

package info (click to toggle)
unzip 5.32-1
  • links: PTS
  • area: non-free
  • in suites: hamm, slink
  • size: 3,616 kB
  • ctags: 5,353
  • sloc: ansic: 35,010; cpp: 3,775; makefile: 1,269; asm: 1,113; sh: 133
file content (270 lines) | stat: -rw-r--r-- 8,261 bytes parent folder | download | duplicates (2)
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
# WMAKE makefile for 16 bit MSDOS or 32 bit DOS extender (PMODE/W or DOS/4GW)
# using Watcom C/C++ v11.0+, by Paul Kienitz, last revised 29 Sep 97.  Makes
# UnZip.exe, fUnZip.exe, and UnZipSFX.exe.
#
# Invoke from UnZip source dir with "WMAKE -F MSDOS\MAKEFILE.WAT [targets]".
# To make the PMODE/W version use "WMAKE PM=1 ..."
# To make the DOS/4GW version use "WMAKE GW=1 ..." (overrides PM=1)
#   Note: specifying PM or GW without NOASM requires that the win32 source
#   directory be present, so it can access the 32 bit assembly source.
#   PMODE/W is recommended over DOS/4GW for best performance.
# To build with debug info use "WMAKE DEBUG=1 ..."
# To build with no assembly modules use "WMAKE NOASM=1 ..."
# To support unshrinking and unreducing use "WMAKE LAWSUIT=1 ..."
#
# Other options to be fed to the compiler can be specified in an environment
# variable called LOCAL_UNZIP.

variation = $(%LOCAL_UNZIP)

# Stifle annoying "Delete this file?" questions when errors occur:
.ERASE

.EXTENSIONS:
.EXTENSIONS: .exe .obj .obx .c .h .asm

# We maintain multiple sets of object files in different directories so that
# we can compile msdos, dos/4gw, and win32 versions of UnZip without their
# object files interacting.  The following var must be a directory name
# ending with a backslash.  All object file names must include this macro
# at the beginning, for example "$(O)foo.obj".

!ifdef GW
PM = 1      # both protected mode formats use the same object files
!endif

!ifdef DEBUG
!  ifdef PM
O = od32d\  # comment here so backslash won't continue the line
!  else
O = od16d\  # ditto
!  endif
!else
!  ifdef PM
O = ob32d\  # ditto
!  else
O = ob16d\  # ditto
!  endif
!endif

!ifdef LAWSUIT
cvars = $+$(cvars)$- -DUSE_SMITH_CODE -DUSE_UNSHRINK
avars = $+$(avars)$- -DUSE_SMITH_CODE -DUSE_UNSHRINK
# "$+$(foo)$-" means expand foo as it has been defined up to now; normally,
# this Make defers inner expansion until the outer macro is expanded.
!endif

# The assembly hot-spot code in crc_i[3]86.asm is optional.  This section
# controls its usage.

!ifdef NOASM
crcob = $(O)crc32.obj
crcox = $(O)crc32.obx
!else   # !NOASM
cvars = $+$(cvars)$- -DASM_CRC
!  ifdef PM
crcob = $(O)crc_i386.obj
crcox = $(O)crc_i386.obx
crc_s = win32\crc_i386.asm   # requires that the win32 directory be present
!  else
crcob = $(O)crc_i86.obj
crcox = $(O)crc_i86.obx
crc_s = msdos\crc_i86.asm
!  endif
!endif

# Our object files: OBJA/OBJB is for UnZip, OBJX for UnZipSFX, OBJF for fUnZip:

OBJA1 = $(O)unzip.obj $(crcob) $(O)crctab.obj $(O)crypt.obj $(O)envargs.obj
OBJA  = $(OBJA1) $(O)explode.obj $(O)extract.obj $(O)fileio.obj $(O)globals.obj
OBJB2 = $(O)inflate.obj $(O)list.obj $(O)match.obj $(O)process.obj $(O)ttyio.obj
OBJB  = $(OBJB2) $(O)unreduce.obj $(O)unshrink.obj $(O)zipinfo.obj $(O)msdos.obj

OBJX2 = $(O)unzip.obx $(crcox) $(O)crctab.obx $(O)crypt.obx $(O)extract.obx
OBJX1 = $(OBJX2) $(O)fileio.obx $(O)globals.obx $(O)inflate.obx $(O)match.obx
OBJX  = $(OBJX1) $(O)process.obx $(O)ttyio.obx $(O)msdos.obx

OBJF1  = $(O)funzip.obj $(crcox) $(O)cryptf.obj $(O)globalsf.obj
OBJF  = $(OBJF1) $(O)inflatef.obj $(O)ttyio.obx
# fUnZip uses $(crcox) and $(O)ttyio.obx because they're small-model.

# Common header files included by all C sources:

UNZIP_H = unzip.h unzpriv.h globals.h msdos\doscfg.h

# Now we have to pick out the proper compiler and options for it.  This gets
# pretty complicated with the PM, GW, DEBUG, and NOASM options...

link   = wlink
asm    = wasm

!ifdef PM
cc     = wcc386
# Use Pentium Pro timings, flat memory, static strings in code, max strictness:
cflags = -bt=DOS -mf -6r -zt -zq -wx
aflags = -bt=DOS -mf -3 -zq
cflagx = $(cflags)
aflagx = $(aflags)

!  ifdef GW
lflags = sys DOS4G
!  else
# THIS REQUIRES THAT PMODEW.EXE BE FINDABLE IN THE COMMAND PATH.
# It does NOT require you to add a pmodew entry to wlink.lnk or wlsystem.lnk.
defaultlibs = libpath %WATCOM%\lib386 libpath %WATCOM%\lib386\dos
lflags = format os2 le op osname='PMODE/W' op stub=pmodew.exe $(defaultlibs)
!  endif

!else   # plain 16-bit DOS:

cc     = wcc
# Use plain 8086 code, medium memory, static strings in code, max strictness:
cflags = -bt=DOS -mm -0 -zt -zq -wx
aflags = -bt=DOS -mm -0 -zq
# for UnZipSFX and fUnZip, use the small memory model:
cflagx = -bt=DOS -ms -0 -zt -zq -wx
aflagx = -bt=DOS -ms -0 -zq
lflags = sys DOS
!endif  # !PM

cvars  = $+$(cvars)$- -DMSDOS $(variation)
avars  = $+$(avars)$- $(variation)


# Specify optimizations, or a nonoptimized debugging version:

!ifdef DEBUG
cdebug = -od -d2
cdebux = -od -d2
ldebug = d w all op symf
!else
!  ifdef PM
cdebug = -s -obhikl+rt -oe=100 -zp8
# -oa helps slightly but might be dangerous.
!  else
cdebug = -s -oehiklrt
!  endif
cdebux = -s -obhiklrs
ldebug = op el
!endif

# How to compile sources:
.c.obx:
	$(cc) $(cdebux) $(cflagx) $(cvars) -DSFX $[@ -fo=$@

.c.obj:
	$(cc) $(cdebug) $(cflags) $(cvars) $[@ -fo=$@

# Here we go!  By default, make all targets, except no UnZipSFX for PMODE:
!ifdef PM
all: UnZip.exe fUnZip.exe
!else
all: UnZip.exe fUnZip.exe UnZipSFX.exe
!endif

# Convenient shorthand options for single targets:
u:   UnZip.exe    .SYMBOLIC
f:   fUnZip.exe   .SYMBOLIC
x:   UnZipSFX.exe .SYMBOLIC

UnZip.exe:	$(OBJA) $(OBJB)
	set WLK_VA=file {$(OBJA)}
	set WLK_VB=file {$(OBJB)}
	$(link) $(lflags) $(ldebug) name $@ @WLK_VA @WLK_VB
	set WLK_VA=
	set WLK_VB=
# We use WLK_VA/WLK_VB to keep the size of each command under 256 chars.

UnZipSFX.exe:	$(OBJX)
	set WLK_VX=file {$(OBJX)}
	$(link) $(lflags) $(ldebug) name $@ @WLK_VX
	set WLK_VX=

fUnZip.exe:	$(OBJF)
	set WLK_VF=file {$(OBJF)}
	$(link) $(lflags) $(ldebug) name $@ @WLK_VF
	set WLK_VF=


# Source dependencies:

#       for UnZip ...

$(O)crc32.obj:    crc32.c $(UNZIP_H) zip.h
$(O)crctab.obj:   crctab.c $(UNZIP_H) zip.h
$(O)crypt.obj:    crypt.c $(UNZIP_H) zip.h crypt.h ttyio.h
$(O)envargs.obj:  envargs.c $(UNZIP_H)
$(O)explode.obj:  explode.c $(UNZIP_H)
$(O)extract.obj:  extract.c $(UNZIP_H) crypt.h
$(O)fileio.obj:   fileio.c $(UNZIP_H) crypt.h ttyio.h ebcdic.h
$(O)globals.obj:  globals.c $(UNZIP_H)
$(O)inflate.obj:  inflate.c inflate.h $(UNZIP_H)
$(O)list.obj:     list.c $(UNZIP_H)
$(O)match.obj:    match.c $(UNZIP_H)
$(O)process.obj:  process.c $(UNZIP_H)
$(O)ttyio.obj:    ttyio.c $(UNZIP_H) zip.h crypt.h ttyio.h
$(O)unreduce.obj: unreduce.c $(UNZIP_H)
$(O)unshrink.obj: unshrink.c $(UNZIP_H)
$(O)unzip.obj:    unzip.c $(UNZIP_H) crypt.h version.h consts.h
$(O)zipinfo.obj:  zipinfo.c $(UNZIP_H)

#       for UnZipSFX ...

$(O)crc32.obx:    crc32.c $(UNZIP_H) zip.h
$(O)crctab.obx:   crctab.c $(UNZIP_H) zip.h
$(O)crypt.obx:    crypt.c $(UNZIP_H) zip.h crypt.h ttyio.h
$(O)extract.obx:  extract.c $(UNZIP_H) crypt.h
$(O)fileio.obx:   fileio.c $(UNZIP_H) crypt.h ttyio.h ebcdic.h
$(O)globals.obx:  globals.c $(UNZIP_H)
$(O)inflate.obx:  inflate.c inflate.h $(UNZIP_H)
$(O)match.obx:    match.c $(UNZIP_H)
$(O)process.obx:  process.c $(UNZIP_H)
$(O)ttyio.obx:    ttyio.c $(UNZIP_H) zip.h crypt.h ttyio.h
$(O)unzip.obx:    unzip.c $(UNZIP_H) crypt.h version.h consts.h

# Special case object files:

$(O)msdos.obj:    msdos\msdos.c $(UNZIP_H)
	$(cc) $(cdebug) $(cflags) $(cvars) msdos\msdos.c -fo=$@

$(O)msdos.obx:    msdos\msdos.c $(UNZIP_H)
	$(cc) $(cdebux) $(cflagx) $(cvars) -DSFX msdos\msdos.c -fo=$@

!ifndef NOASM
$(crcob):         $(crc_s)
	$(asm) $(aflags) $(avars) $(crc_s) -fo=$@

$(crcox):         $(crc_s)
	$(asm) $(aflagx) $(avars) $(crc_s) -fo=$@
!endif

# Variant object files for fUnZip, using $(cflagx):

$(O)funzip.obj:   funzip.c $(UNZIP_H) crypt.h ttyio.h tables.h
	$(cc) $(cdebux) $(cflagx) $(cvars) funzip.c -fo=$@

$(O)cryptf.obj:   crypt.c $(UNZIP_H) zip.h crypt.h ttyio.h
	$(cc) $(cdebux) $(cflagx) $(cvars) -DFUNZIP crypt.c -fo=$@

$(O)globalsf.obj: globals.c $(UNZIP_H)
	$(cc) $(cdebux) $(cflagx) $(cvars) -DFUNZIP globals.c -fo=$@

$(O)inflatef.obj: inflate.c inflate.h $(UNZIP_H) crypt.h
	$(cc) $(cdebux) $(cflagx) $(cvars) -DFUNZIP inflate.c -fo=$@

$(O)ttyiof.obj:   ttyio.c $(UNZIP_H) zip.h crypt.h ttyio.h
	$(cc) $(cdebux) $(cflagx) $(cvars) -DFUNZIP ttyio.c -fo=$@

# Unwanted file removal:

clean:     .SYMBOLIC
!ifdef PM
	del ob32d\*.ob?
!else
	del ob16d\*.ob?
!endif

cleaner:   clean  .SYMBOLIC
	del UnZip.exe
	del fUnZip.exe
	del UnZipSFX.exe