File: makefile.dj2

package info (click to toggle)
unzip 5.40-1
  • links: PTS
  • area: non-free
  • in suites: potato
  • size: 4,120 kB
  • ctags: 5,900
  • sloc: ansic: 40,977; cpp: 3,778; makefile: 1,384; asm: 1,228; sh: 133
file content (215 lines) | stat: -rw-r--r-- 6,758 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
# Makefile for Info-ZIP's UnZip, UnZipSFX and fUnZip using djgpp v2.01, by
# Frank Donahoe.                                 Last updated:  30 Sept 97

# This Makefile is specifically tailored for GNU make and GNU C and
# may not work with a generic Unix-compatible make utility.  The latest
# make version is 3.75.  Thanks to Eli Zaretskii for generously responding
# to questions with advice on the changes needed to make install work under
# the new version.
# Features used:
# - pattern rules (%.o : %.c, etc.)
# - GNU-specific conditionals and functions  (ifeq, $(patsubst,,),...)
#
# The stand-alone executable requires DPMI services to run.  If running
# in a DOS window under Windows 3.1 or later, the dpmi server is auto-
# matically present.  Under DOS, if a DPMI server is not loaded, the
# program will look for "cwsdpmi.exe."  If found, it will be loaded for
# the duration of the program.
#
# cwsdpmi is a "free" dpmi server written by Charles W. Sandmann
# (sandman@clio.rice.edu).  It may be found, among other sites, on SimTel
# Net at the URL:
#
#   ftp://ftp.simtel.net/pub/simtelnet/gnu/djgpp/v2misc/csdpmi?[b,s].zip
#
# and on its mirrors worldwide.  The latest version as of this writing is 3.
# Archives with the b postscript contain the binaries.  An alternate server
# is found, l.c., in the archive pmode??[b,s].zip.  The latest (960908) is
# v1.1.

# Separators colon and <sp> are used in Unix, semi-colon and <sp> in DOS.
VPATH=. msdos

ifdef NOASM
USE_ASMCRC=
else
USE_ASMCRC=1
endif

.PHONY : clean install uninstall

# UnZip flags
# LOCAL_UNZIP may be set in AUTOEXEC.BAT or defined in djgpp.env [make].
# See, for example, DOSWILD, in the file INSTALL.

# [make]
# LOCAL_UNZIP=-DDOSWILD
# BUTT=-m486

# BUTT may also be defined to specify the target system.  At present, -m386
# and -m486 are the only supported options.  Either will produce code that
# will run on the other microprocessor, though possibly not so fast.
# In any case, omitting BUTT will result in a slightly smaller executable.

LOC=-DDOS -DUSE_VFAT $(ASMFLG) $(LOCAL_UNZIP)
CC=gcc
LD=$(CC)
CPPFLAGS=-I. $(LOC)
ASFLAGS=$(CPPFLAGS)
CFLAGS=-Wall -O2 $(BUTT) $(CPPFLAGS)

# See INSTALL for discussion of SFX_EXDIR.
# EXDIR=-DSFX_EXDIR

FUN_FLAGS=$(CFLAGS) -DFUNZIP

# Include OFP for a modest decrease in size of unzipsfx.exe.
OFP=-fomit-frame-pointer

SFX_FLAGS=-Wall -O2 $(CPPFLAGS) -DSFX $(EXDIR) $(OFP)
LDFLAGS=-s

# general-purpose stuff
# If cp.exe is not found change to CP=copy /Y    .
CP = cp -fp
# If install.exe is not found change to INSTALL=$(CP)   .  To prevent a
# conflict with any of the many different "install's" that might be found
# in the path, GNU install will be called as `ginstall'.  This also bypasses
# a stub bug that cropped up with the install from fil316b.zip.
INSTALL=ginstall
# The default value of RM is "rm -f"  .  If rm.exe is not found, uncomment
# the following:
# RM=del
# If "djp.exe," which is Laszlo Molnar's executable file packer, is in the
# path, uncomment the three lines found far below containing $(DJP).  The
# executable files will be converted to self-extracting compressed files.
# Look for "djp.exe" in the directory v2misc in the archive mlp???b.zip.
# Do not add the option -s to DJP without making the required changes to
# the targets zipinfo$E and unzipsfx$E.

DJP = djp -q
E = .exe
O = .o
M=msdos

# defaults for crc32 stuff and system dependent headers
ifdef USE_ASMCRC
ASMFLG = -DASM_CRC
CRC32 = crc_gcc
else
ASMFLG =
CRC32 = crc32
endif

# object files
OBJS1 = unzip$O $(CRC32)$O crctab$O crypt$O envargs$O explode$O
OBJS2 = extract$O fileio$O globals$O inflate$O list$O match$O
OBJS3 = process$O ttyio$O unreduce$O unshrink$O zipinfo$O
OBJS = $(OBJS1) $(OBJS2) $(OBJS3) $M$O

OBJX = unzipsfx$O $(CRC32)$O crctab_$O crypt_$O extract_$O fileio_$O \
	globals_$O inflate_$O match_$O process_$O ttyio_$O $M_$O

OBJF = funzip$O $(CRC32)$O crypt-$O globals-$O inflate-$O ttyio-$O

OBJECTS_ALL = $(sort $(OBJS) $(OBJX) $(OBJF) crc32$O crc_gcc$O)

# Common header files included by all C sources:
UNZIP_H = unzip.h unzpriv.h globals.h msdos/doscfg.h

# executable files
UNZIPS = unzip$E zipinfo$E funzip$E unzipsfx$E

# pattern rules to compile the sources:
%$O : %.c
	$(CC) $(CFLAGS) -c $< -o $@

%-$O: %.c
	$(CC) $(FUN_FLAGS) -c $< -o $@

%_$O: %.c
	$(CC) $(SFX_FLAGS) -c $< -o $@

%sfx$O: %.c
	$(CC) $(SFX_FLAGS) -c $< -o $@

all: unzips

unzips:	unzip$E zipinfo$E funzip$E unzipsfx$E

unzip$E: $(OBJS)
	$(LD) $(LDFLAGS) $(OBJS) -o $@
#	$(DJP) $@

zipinfo$E: unzip$E
	stubify -g $@
	stubedit $@ runfile=unzip argv0=zipinfo

funzip$E: $(OBJF)
	$(LD) $(LDFLAGS) $(OBJF) -o $@
#	$(DJP) $@

unzipsfx$E: $(OBJX)
	$(LD) $(LDFLAGS) $(OBJX) -o $@
#	$(DJP) -s $@

# explicit compilation instructions:

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

# BIN_PATH may be defined in djgpp.env [make] or defined below.  If the
# installation is to the directory containing gcc.exe etc. place the
# following in djgpp.env:

# [make]
# BIN_PATH=%\>;BIN_PATH%%\DJDIR%\bin

# Even if so placed, it can be over-ridden here by, say:
# BIN_PATH=c:\usr\bin

install:
	-@if not exist $(BIN_PATH)\nul mkdir $(BIN_PATH)
	command.com /c for %f in ($(UNZIPS)) do $(INSTALL) %f $(BIN_PATH) > NUL

uninstall:
	command.com /c for %f in ($(UNZIPS)) do $(RM) $(BIN_PATH)\%f > NUL

clean:
ifeq ($(firstword $(RM)), del)
	$(RM) *$O
	$(RM) *.~
	$(RM) *.exe
else
	$(RM) $(OBJECTS_ALL) *.~ *.exe
endif

# Source dependencies:
crc_gcc$O:      crc_i386.S
crc32$O:        crc32.c $(UNZIP_H) zip.h
crctab$O:       crctab.c $(UNZIP_H) zip.h
crypt$O:        crypt.c $(UNZIP_H) zip.h crypt.h ttyio.h
crypt-$O:       crypt.c $(UNZIP_H) zip.h crypt.h ttyio.h
envargs$O:      envargs.c $(UNZIP_H)
explode$O:      explode.c $(UNZIP_H)
extract$O:      extract.c $(UNZIP_H) crypt.h
extract_$O:     extract.c $(UNZIP_H) crypt.h
fileio$O:       fileio.c $(UNZIP_H) crypt.h ttyio.h ebcdic.h
funzip$O:       funzip.c $(UNZIP_H) crypt.h ttyio.h tables.h
globals$O:      globals.c $(UNZIP_H)
globals-$O:     globals.c $(UNZIP_H)
inflate$O:      inflate.c inflate.h $(UNZIP_H)
inflate-$O:     inflate.c inflate.h $(UNZIP_H) crypt.h
list$O:         list.c $(UNZIP_H)
match$O:        match.c $(UNZIP_H)
msdos$O:        msdos/msdos.c $(UNZIP_H)
msdos_$O:       msdos/msdos.c $(UNZIP_H)
process$O:      process.c $(UNZIP_H)
process_$O:     process.c $(UNZIP_H)
ttyio$O:        ttyio.c $(UNZIP_H) zip.h crypt.h ttyio.h
ttyio-$O:       ttyio.c $(UNZIP_H) zip.h crypt.h ttyio.h
unreduce$O:     unreduce.c $(UNZIP_H)
unshrink$O:     unshrink.c $(UNZIP_H)
unzip$O:        unzip.c $(UNZIP_H) crypt.h version.h consts.h
unzipsfx$O:     unzip.c $(UNZIP_H) crypt.h version.h consts.h
zipinfo$O:      zipinfo.c $(UNZIP_H)