summaryrefslogtreecommitdiff
path: root/win32/makefile.gcc
blob: 6e924ad2be6dca4bbaf6aa75466748d76ca11987 (plain)
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
# Makefile for Zip, ZipCloak, ZipNote and ZipSplit for port of gcc producing
# native Win32-Intel binaries. Derived from makefile.w32.
# Currently supported implementations: Cygwin and MinGW.
# Authors: Cosmin Truta, Christian Spieler, and possibly others.
# Last updated: 2005-Jan-24.
#
# To use, do "make -f win32/makefile.gcc".

# Optional nonstandard preprocessor flags (as -DMEDIUM_MEM or -DNO_ASM)
# should be added to the environment via "set LOCAL_ZIP=-DFOO" or added
# to the declaration of LOC here:
LOC = $(LOCAL_ZIP)

# ------------ GNU C ------------
CC=gcc
ifndef USEZLIB
CFLAGS=-O2 -Wall -DWIN32
else
CFLAGS=-O2 -Wall -DWIN32 -DUSE_ZLIB
endif
CCFLAGS=$(CFLAGS) $(LOC)
UTILFLAGS=$(CCFLAGS) -DUTIL -o$@

#AS=as
AS=$(CC)
ifndef USEZLIB
ASDEFS=
else
ASDEFS=-DUSE_ZLIB
endif
ASFLAGS=-c $(ASDEFS) $(LOC)

LD=$(CC)
LDFLAGS=-o$@ -s
ifndef USEZLIB
LIBS=-luser32 -ladvapi32
else
LIBS=-L. -lz -luser32 -ladvapi32
endif

OSDEP_H = win32/osdep.h
ZIPUP_H = win32/zipup.h

# variables
ifndef USEZLIB
OBJA  = match.o crc_i386.o
else
OBJA  =
endif
#use second definition for linking against libz

OBJZ1 = zip.o crypt.o ttyio.o zipfile.o zipup.o fileio.o util.o \
	crc32.o crctab.o globals.o
OBJZ2 = deflate.o trees.o $(OBJA)
OBJZS = win32.o win32zip.o nt.o
OBJZ  = $(OBJZ1) $(OBJZ2) $(OBJZS)

OBJU1 = zipfile_.o fileio_.o util_.o globals.o
OBJUS = win32_.o
OBJU  = $(OBJU1) $(OBJUS)

OBJN  = zipnote.o $(OBJU)
OBJS  = zipsplit.o $(OBJU)
OBJC1 = zipcloak.o crctab.o crypt_.o ttyio.o
OBJC  = $(OBJC1) $(OBJU)

ZIP_H = zip.h ziperr.h tailor.h $(OSDEP_H)

ZIPS = zip.exe zipnote.exe zipsplit.exe zipcloak.exe

# rules

.SUFFIXES: .c .o

.c.o:
	$(CC) -c $(CCFLAGS) -I. -o$@ $<

# targets

zips: $(ZIPS)

zip.o: zip.c $(ZIP_H) revision.h crypt.h ttyio.h
zipfile.o: zipfile.c $(ZIP_H)
zipup.o: zipup.c $(ZIP_H) revision.h crypt.h $(ZIPUP_H)
fileio.o: fileio.c $(ZIP_H)
util.o: util.c $(ZIP_H)
globals.o: globals.c $(ZIP_H)
deflate.o: deflate.c $(ZIP_H)
trees.o: trees.c $(ZIP_H)
crc32.o: crc32.c $(ZIP_H)
crctab.o: crctab.c $(ZIP_H)
crypt.o: crypt.c $(ZIP_H) crypt.h ttyio.h
ttyio.o: ttyio.c $(ZIP_H) crypt.h ttyio.h

win32zip.o: win32/win32zip.c $(ZIP_H) win32/win32zip.h win32/nt.h
	$(CC) -c $(CCFLAGS) -I. win32/win32zip.c

win32.o: win32/win32.c $(ZIP_H) win32/win32zip.h
	$(CC) -c $(CCFLAGS) -I. win32/win32.c

nt.o: win32/nt.c $(ZIP_H) win32/nt.h
	$(CC) -c $(CCFLAGS) -I. win32/nt.c

zipcloak.o: zipcloak.c $(ZIP_H) revision.h crypt.h ttyio.h
zipnote.o: zipnote.c $(ZIP_H) revision.h
zipsplit.o: zipsplit.c $(ZIP_H) revision.h

zipfile_.o: zipfile.c $(ZIP_H)
	$(CC) -c $(UTILFLAGS) zipfile.c

fileio_.o: fileio.c $(ZIP_H)
	$(CC) -c $(UTILFLAGS) fileio.c

util_.o: util.c $(ZIP_H)
	$(CC) -c $(UTILFLAGS) util.c

crypt_.o: crypt.c $(ZIP_H) crypt.h ttyio.h
	$(CC) -c $(UTILFLAGS) crypt.c

win32_.o: win32/win32.c $(ZIP_H) win32/win32zip.h
	$(CC) -c $(UTILFLAGS) -I. win32/win32.c

match.o: match.S
	$(AS) $(ASFLAGS) match.S

crc_i386.o: crc_i386.S
	$(AS) $(ASFLAGS) crc_i386.S

zip.exe: $(OBJZ)
	$(LD) $(LDFLAGS) $(OBJZ) $(LIBS)

zipcloak.exe: $(OBJC)
	$(LD) $(LDFLAGS) $(OBJC) $(LIBS)

zipnote.exe: $(OBJN)
	$(LD) $(LDFLAGS) $(OBJN)

zipsplit.exe: $(OBJS)
	$(LD) $(LDFLAGS) $(OBJS)

clean:
	rm -f *.o $(ZIPS)