143009Swollman# Makefile for zlib under OS/2 using GCC (PGCC)
22744Swollman# For conditions of distribution and use, see copyright notice in zlib.h
320091Swollman
420091Swollman# To compile and test, type:
520091Swollman#   cp Makefile.os2 ..
620091Swollman#   cd ..
720091Swollman#   make -f Makefile.os2 test
82744Swollman
92744Swollman# This makefile will build a static library z.lib, a shared library
1020091Swollman# z.dll and a import library zdll.lib. You can use either z.lib or
1120091Swollman# zdll.lib by specifying either -lz or -lzdll on gcc's command line
1220091Swollman
1343009SwollmanCC=gcc -Zomf -s
1443009Swollman
1543009SwollmanCFLAGS=-O6 -Wall
1643009Swollman#CFLAGS=-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7
1743009Swollman#CFLAGS=-g -DZLIB_DEBUG
1843009Swollman#CFLAGS=-O3 -Wall -Wwrite-strings -Wpointer-arith -Wconversion \
1920091Swollman#           -Wstrict-prototypes -Wmissing-prototypes
2020091Swollman
2120091Swollman#################### BUG WARNING: #####################
222744Swollman## infcodes.c hits a bug in pgcc-1.0, so you have to use either
232744Swollman## -O# where # <= 4 or one of (-fno-ommit-frame-pointer or -fno-force-mem)
242744Swollman## This bug is reportedly fixed in pgcc >1.0, but this was not tested
252744SwollmanCFLAGS+=-fno-force-mem
262744Swollman
272744SwollmanLDFLAGS=-s -L. -lzdll -Zcrtdll
282744SwollmanLDSHARED=$(CC) -s -Zomf -Zdll -Zcrtdll
2943009Swollman
302744SwollmanVER=1.1.0
312744SwollmanZLIB=z.lib
322744SwollmanSHAREDLIB=z.dll
332744SwollmanSHAREDLIBIMP=zdll.lib
342744SwollmanLIBS=$(ZLIB) $(SHAREDLIB) $(SHAREDLIBIMP)
352744Swollman
362744SwollmanAR=emxomfar cr
372744SwollmanIMPLIB=emximp
382744SwollmanRANLIB=echo
392744SwollmanTAR=tar
4014709SwollmanSHELL=bash
4114709Swollman
422744Swollmanprefix=/usr/local
432744Swollmanexec_prefix = $(prefix)
442744Swollman
452744SwollmanOBJS = adler32.o compress.o crc32.o gzio.o uncompr.o deflate.o trees.o \
462744Swollman       zutil.o inflate.o infblock.o inftrees.o infcodes.o infutil.o inffast.o
472744Swollman
482744SwollmanTEST_OBJS = example.o minigzip.o
492744Swollman
502744SwollmanDISTFILES = README INDEX ChangeLog configure Make*[a-z0-9] *.[ch] descrip.mms \
512744Swollman  algorithm.txt zlib.3 msdos/Make*[a-z0-9] msdos/zlib.def msdos/zlib.rc \
522744Swollman  nt/Makefile.nt nt/zlib.dnt  contrib/README.contrib contrib/*.txt \
532744Swollman  contrib/asm386/*.asm contrib/asm386/*.c \
542744Swollman  contrib/asm386/*.bat contrib/asm386/zlibvc.d?? contrib/iostream/*.cpp \
552744Swollman  contrib/iostream/*.h  contrib/iostream2/*.h contrib/iostream2/*.cpp \
562744Swollman  contrib/untgz/Makefile contrib/untgz/*.c contrib/untgz/*.w32
572744Swollman
582744Swollmanall: example.exe minigzip.exe
592744Swollman
602744Swollmantest: all
612744Swollman	@LD_LIBRARY_PATH=.:$(LD_LIBRARY_PATH) ; export LD_LIBRARY_PATH; \
622744Swollman	echo hello world | ./minigzip | ./minigzip -d || \
632744Swollman	  echo '		*** minigzip test FAILED ***' ; \
642744Swollman	if ./example; then \
652744Swollman	  echo '		*** zlib test OK ***'; \
66	else \
67	  echo '		*** zlib test FAILED ***'; \
68	fi
69
70$(ZLIB): $(OBJS)
71	$(AR) $@ $(OBJS)
72	-@ ($(RANLIB) $@ || true) >/dev/null 2>&1
73
74$(SHAREDLIB): $(OBJS) os2/z.def
75	$(LDSHARED) -o $@ $^
76
77$(SHAREDLIBIMP): os2/z.def
78	$(IMPLIB) -o $@ $^
79
80example.exe: example.o $(LIBS)
81	$(CC) $(CFLAGS) -o $@ example.o $(LDFLAGS)
82
83minigzip.exe: minigzip.o $(LIBS)
84	$(CC) $(CFLAGS) -o $@ minigzip.o $(LDFLAGS)
85
86clean:
87	rm -f *.o *~ example minigzip libz.a libz.so* foo.gz
88
89distclean:	clean
90
91zip:
92	mv Makefile Makefile~; cp -p Makefile.in Makefile
93	rm -f test.c ztest*.c
94	v=`sed -n -e 's/\.//g' -e '/VERSION "/s/.*"\(.*\)".*/\1/p' < zlib.h`;\
95	zip -ul9 zlib$$v $(DISTFILES)
96	mv Makefile~ Makefile
97
98dist:
99	mv Makefile Makefile~; cp -p Makefile.in Makefile
100	rm -f test.c ztest*.c
101	d=zlib-`sed -n '/VERSION "/s/.*"\(.*\)".*/\1/p' < zlib.h`;\
102	rm -f $$d.tar.gz; \
103	if test ! -d ../$$d; then rm -f ../$$d; ln -s `pwd` ../$$d; fi; \
104	files=""; \
105	for f in $(DISTFILES); do files="$$files $$d/$$f"; done; \
106	cd ..; \
107	GZIP=-9 $(TAR) chofz $$d/$$d.tar.gz $$files; \
108	if test ! -d $$d; then rm -f $$d; fi
109	mv Makefile~ Makefile
110
111tags:
112	etags *.[ch]
113
114depend:
115	makedepend -- $(CFLAGS) -- *.[ch]
116
117# DO NOT DELETE THIS LINE -- make depend depends on it.
118
119adler32.o: zlib.h zconf.h
120compress.o: zlib.h zconf.h
121crc32.o: zlib.h zconf.h
122deflate.o: deflate.h zutil.h zlib.h zconf.h
123example.o: zlib.h zconf.h
124gzio.o: zutil.h zlib.h zconf.h
125infblock.o: infblock.h inftrees.h infcodes.h infutil.h zutil.h zlib.h zconf.h
126infcodes.o: zutil.h zlib.h zconf.h
127infcodes.o: inftrees.h infblock.h infcodes.h infutil.h inffast.h
128inffast.o: zutil.h zlib.h zconf.h inftrees.h
129inffast.o: infblock.h infcodes.h infutil.h inffast.h
130inflate.o: zutil.h zlib.h zconf.h infblock.h
131inftrees.o: zutil.h zlib.h zconf.h inftrees.h
132infutil.o: zutil.h zlib.h zconf.h infblock.h inftrees.h infcodes.h infutil.h
133minigzip.o: zlib.h zconf.h
134trees.o: deflate.h zutil.h zlib.h zconf.h trees.h
135uncompr.o: zlib.h zconf.h
136zutil.o: zutil.h zlib.h zconf.h
137