| 1 |
# Makefile for Zip, ZipCloak, ZipNote and ZipSplit for port of gcc producing |
| 2 |
# native Win32-Intel binaries. Derived from makefile.w32. |
| 3 |
# Currently supported implementations: Cygwin and MinGW. |
| 4 |
# Authors: Cosmin Truta, Christian Spieler, and possibly others. |
| 5 |
# Last updated: 2008-Jun-22. |
| 6 |
# |
| 7 |
# To use, do "make -f win32/makefile.gcc". |
| 8 |
|
| 9 |
# Optional nonstandard preprocessor flags (as -DMEDIUM_MEM or -DNO_ASM) |
| 10 |
# should be added to the environment via "set LOCAL_ZIP=-DFOO" or added |
| 11 |
# to the declaration of LOC here: |
| 12 |
LOC = $(LOCAL_ZIP) |
| 13 |
|
| 14 |
# ------------ GNU C ------------ |
| 15 |
CC=gcc |
| 16 |
CFLAGS=-O2 -Wall -DWIN32 -DFORCE_WIN32_OVER_UNIX |
| 17 |
ifndef USEZLIB |
| 18 |
CCFLAGS=$(CFLAGS) $(LOC) |
| 19 |
else |
| 20 |
CCFLAGS=$(CFLAGS) -DUSE_ZLIB $(LOC) |
| 21 |
endif |
| 22 |
UTILFLAGS=$(CCFLAGS) -DUTIL -o$@ |
| 23 |
|
| 24 |
#AS=as |
| 25 |
AS=$(CC) |
| 26 |
ifndef USEZLIB |
| 27 |
ASDEFS= |
| 28 |
else |
| 29 |
ASDEFS=-DUSE_ZLIB |
| 30 |
endif |
| 31 |
ASFLAGS=-c $(ASDEFS) $(LOC) |
| 32 |
|
| 33 |
RC=windres |
| 34 |
|
| 35 |
LD=$(CC) |
| 36 |
LDFLAGS=-o$@ -s |
| 37 |
ifndef USEZLIB |
| 38 |
LIBS=-luser32 -ladvapi32 |
| 39 |
else |
| 40 |
LIBS=-L. -lz -luser32 -ladvapi32 |
| 41 |
endif |
| 42 |
|
| 43 |
OSDEP_H = win32/osdep.h |
| 44 |
ZIPUP_H = win32/zipup.h |
| 45 |
|
| 46 |
# variables |
| 47 |
ifndef USEZLIB |
| 48 |
CRCA_O = crc_i386.o |
| 49 |
CRCAUO = crci386_.o |
| 50 |
OBJA = match.o $(CRCA_O) |
| 51 |
else |
| 52 |
CRCA_O = |
| 53 |
CRCAUO = |
| 54 |
OBJA = |
| 55 |
endif |
| 56 |
#use second definition for linking against libz |
| 57 |
|
| 58 |
OBJZ1 = zip.o crypt.o ttyio.o zipfile.o zipup.o fileio.o util.o \ |
| 59 |
crc32.o globals.o |
| 60 |
OBJZ2 = deflate.o trees.o $(OBJA) |
| 61 |
OBJZS = win32.o win32zip.o win32i64.o nt.o |
| 62 |
OBJZ = $(OBJZ1) $(OBJZ2) $(OBJZS) |
| 63 |
|
| 64 |
OBJU1 = zipfile_.o fileio_.o util_.o crc32_.o $(CRCAUO) globals.o |
| 65 |
OBJUS = win32_.o win32i64.o |
| 66 |
OBJU = $(OBJU1) $(OBJUS) |
| 67 |
|
| 68 |
OBJN = zipnote.o $(OBJU) |
| 69 |
OBJS = zipsplit.o $(OBJU) |
| 70 |
OBJC1 = zipcloak.o crypt_.o ttyio.o |
| 71 |
OBJC = $(OBJC1) $(OBJU) |
| 72 |
|
| 73 |
ZIP_H = zip.h ziperr.h tailor.h $(OSDEP_H) |
| 74 |
|
| 75 |
ZIPS = zip.exe zipnote.exe zipsplit.exe zipcloak.exe |
| 76 |
|
| 77 |
# rules |
| 78 |
|
| 79 |
.SUFFIXES: .c .o |
| 80 |
|
| 81 |
.c.o: |
| 82 |
$(CC) -c $(CCFLAGS) -I. -o$@ $< |
| 83 |
|
| 84 |
# targets |
| 85 |
|
| 86 |
zips: $(ZIPS) |
| 87 |
|
| 88 |
zip.o: zip.c $(ZIP_H) revision.h crc32.h crypt.h ttyio.h |
| 89 |
zipfile.o: zipfile.c $(ZIP_H) crc32.h |
| 90 |
zipup.o: zipup.c $(ZIP_H) revision.h crc32.h crypt.h $(ZIPUP_H) |
| 91 |
fileio.o: fileio.c $(ZIP_H) crc32.h |
| 92 |
util.o: util.c $(ZIP_H) |
| 93 |
globals.o: globals.c $(ZIP_H) |
| 94 |
deflate.o: deflate.c $(ZIP_H) |
| 95 |
trees.o: trees.c $(ZIP_H) |
| 96 |
crc32.o: crc32.c $(ZIP_H) crc32.h |
| 97 |
crypt.o: crypt.c $(ZIP_H) crypt.h crc32.h ttyio.h |
| 98 |
ttyio.o: ttyio.c $(ZIP_H) crypt.h ttyio.h |
| 99 |
|
| 100 |
win32zip.o: win32/win32zip.c $(ZIP_H) win32/win32zip.h win32/nt.h |
| 101 |
$(CC) -c $(CCFLAGS) -I. win32/win32zip.c |
| 102 |
|
| 103 |
win32.o: win32/win32.c $(ZIP_H) win32/win32zip.h |
| 104 |
$(CC) -c $(CCFLAGS) -I. win32/win32.c |
| 105 |
|
| 106 |
win32i64.o: win32/win32i64.c $(ZIP_H) |
| 107 |
$(CC) -c $(CCFLAGS) -I. win32/win32i64.c |
| 108 |
|
| 109 |
nt.o: win32/nt.c $(ZIP_H) win32/nt.h |
| 110 |
$(CC) -c $(CCFLAGS) -I. win32/nt.c |
| 111 |
|
| 112 |
zipcloak.o: zipcloak.c $(ZIP_H) revision.h crc32.h crypt.h ttyio.h |
| 113 |
zipnote.o: zipnote.c $(ZIP_H) revision.h |
| 114 |
zipsplit.o: zipsplit.c $(ZIP_H) revision.h |
| 115 |
|
| 116 |
zipfile_.o: zipfile.c $(ZIP_H) crc32.h |
| 117 |
$(CC) -c $(UTILFLAGS) zipfile.c |
| 118 |
|
| 119 |
fileio_.o: fileio.c $(ZIP_H) crc32.h |
| 120 |
$(CC) -c $(UTILFLAGS) fileio.c |
| 121 |
|
| 122 |
util_.o: util.c $(ZIP_H) |
| 123 |
$(CC) -c $(UTILFLAGS) util.c |
| 124 |
|
| 125 |
crc32_.o: crc32.c $(ZIP_H) crc32.h |
| 126 |
$(CC) -c $(UTILFLAGS) crc32.c |
| 127 |
|
| 128 |
crypt_.o: crypt.c $(ZIP_H) crypt.h crc32.h ttyio.h |
| 129 |
$(CC) -c $(UTILFLAGS) crypt.c |
| 130 |
|
| 131 |
win32_.o: win32/win32.c $(ZIP_H) win32/win32zip.h |
| 132 |
$(CC) -c $(UTILFLAGS) -I. win32/win32.c |
| 133 |
|
| 134 |
match.o: match.S |
| 135 |
$(AS) $(ASFLAGS) match.S |
| 136 |
|
| 137 |
crc_i386.o: crc_i386.S |
| 138 |
$(AS) $(ASFLAGS) crc_i386.S |
| 139 |
|
| 140 |
crci386_.o: crc_i386.S |
| 141 |
$(AS) $(ASFLAGS) -DUTIL -o$@ crc_i386.S |
| 142 |
|
| 143 |
ziprc.o: win32/zip.rc revision.h |
| 144 |
- $(RC) -o $@ win32/zip.rc |
| 145 |
|
| 146 |
zip.exe: $(OBJZ) ziprc.o |
| 147 |
$(LD) $(LDFLAGS) $(OBJZ) ziprc.o $(LIBS) |
| 148 |
|
| 149 |
zipcloak.exe: $(OBJC) |
| 150 |
$(LD) $(LDFLAGS) $(OBJC) $(LIBS) |
| 151 |
|
| 152 |
zipnote.exe: $(OBJN) |
| 153 |
$(LD) $(LDFLAGS) $(OBJN) |
| 154 |
|
| 155 |
zipsplit.exe: $(OBJS) |
| 156 |
$(LD) $(LDFLAGS) $(OBJS) |
| 157 |
|
| 158 |
clean: |
| 159 |
rm -f *.o $(ZIPS) |