• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Makefile for zlib under OS/2 using GCC (PGCC)
2# For conditions of distribution and use, see copyright notice in zlib.h
3
4# To compile and test, type:
5#   cp Makefile.os2 ..
6#   cd ..
7#   make -f Makefile.os2 test
8
9# This makefile will build a static library z.lib, a shared library
10# z.dll and a import library zdll.lib. You can use either z.lib or
11# zdll.lib by specifying either -lz or -lzdll on gcc's command line
12
13CC=gcc -Zomf -s
14
15CFLAGS=-O6 -Wall
16#CFLAGS=-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7
17#CFLAGS=-g -DDEBUG
18#CFLAGS=-O3 -Wall -Wwrite-strings -Wpointer-arith -Wconversion \
19#           -Wstrict-prototypes -Wmissing-prototypes
20
21#################### BUG WARNING: #####################
22## infcodes.c hits a bug in pgcc-1.0, so you have to use either
23## -O# where # <= 4 or one of (-fno-ommit-frame-pointer or -fno-force-mem)
24## This bug is reportedly fixed in pgcc >1.0, but this was not tested
25CFLAGS+=-fno-force-mem
26
27LDFLAGS=-s -L. -lzdll -Zcrtdll
28LDSHARED=$(CC) -s -Zomf -Zdll -Zcrtdll
29
30VER=1.1.0
31ZLIB=z.lib
32SHAREDLIB=z.dll
33SHAREDLIBIMP=zdll.lib
34LIBS=$(ZLIB) $(SHAREDLIB) $(SHAREDLIBIMP)
35
36AR=emxomfar cr
37IMPLIB=emximp
38RANLIB=echo
39TAR=tar
40SHELL=bash
41
42prefix=/usr/local
43exec_prefix = $(prefix)
44
45OBJS = adler32.o compress.o crc32.o gzio.o uncompr.o deflate.o trees.o \
46       zutil.o inflate.o infblock.o inftrees.o infcodes.o infutil.o inffast.o
47
48TEST_OBJS = example.o minigzip.o
49
50DISTFILES = README INDEX ChangeLog configure Make*[a-z0-9] *.[ch] descrip.mms \
51  algorithm.txt zlib.3 msdos/Make*[a-z0-9] msdos/zlib.def msdos/zlib.rc \
52  nt/Makefile.nt nt/zlib.dnt  contrib/README.contrib contrib/*.txt \
53  contrib/asm386/*.asm contrib/asm386/*.c \
54  contrib/asm386/*.bat contrib/asm386/zlibvc.d?? contrib/iostream/*.cpp \
55  contrib/iostream/*.h  contrib/iostream2/*.h contrib/iostream2/*.cpp \
56  contrib/untgz/Makefile contrib/untgz/*.c contrib/untgz/*.w32
57
58all: example.exe minigzip.exe
59
60test: all
61	@LD_LIBRARY_PATH=.:$(LD_LIBRARY_PATH) ; export LD_LIBRARY_PATH; \
62	echo hello world | ./minigzip | ./minigzip -d || \
63	  echo '		*** minigzip test FAILED ***' ; \
64	if ./example; then \
65	  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