kusano fc6ab3
# Makefile for zlib under OS/2 using GCC (PGCC)
kusano fc6ab3
# For conditions of distribution and use, see copyright notice in zlib.h
kusano fc6ab3
kusano fc6ab3
# To compile and test, type:
kusano fc6ab3
#   cp Makefile.os2 ..
kusano fc6ab3
#   cd ..
kusano fc6ab3
#   make -f Makefile.os2 test
kusano fc6ab3
kusano fc6ab3
# This makefile will build a static library z.lib, a shared library
kusano fc6ab3
# z.dll and a import library zdll.lib. You can use either z.lib or
kusano fc6ab3
# zdll.lib by specifying either -lz or -lzdll on gcc's command line
kusano fc6ab3
kusano fc6ab3
CC=gcc -Zomf -s
kusano fc6ab3
kusano fc6ab3
CFLAGS=-O6 -Wall
kusano fc6ab3
#CFLAGS=-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7
kusano fc6ab3
#CFLAGS=-g -DDEBUG
kusano fc6ab3
#CFLAGS=-O3 -Wall -Wwrite-strings -Wpointer-arith -Wconversion \
kusano fc6ab3
#           -Wstrict-prototypes -Wmissing-prototypes
kusano fc6ab3
kusano fc6ab3
#################### BUG WARNING: #####################
kusano fc6ab3
## infcodes.c hits a bug in pgcc-1.0, so you have to use either
kusano fc6ab3
## -O# where # <= 4 or one of (-fno-ommit-frame-pointer or -fno-force-mem)
kusano fc6ab3
## This bug is reportedly fixed in pgcc >1.0, but this was not tested
kusano fc6ab3
CFLAGS+=-fno-force-mem
kusano fc6ab3
kusano fc6ab3
LDFLAGS=-s -L. -lzdll -Zcrtdll
kusano fc6ab3
LDSHARED=$(CC) -s -Zomf -Zdll -Zcrtdll
kusano fc6ab3
kusano fc6ab3
VER=1.1.0
kusano fc6ab3
ZLIB=z.lib
kusano fc6ab3
SHAREDLIB=z.dll
kusano fc6ab3
SHAREDLIBIMP=zdll.lib
kusano fc6ab3
LIBS=$(ZLIB) $(SHAREDLIB) $(SHAREDLIBIMP)
kusano fc6ab3
kusano fc6ab3
AR=emxomfar cr
kusano fc6ab3
IMPLIB=emximp
kusano fc6ab3
RANLIB=echo
kusano fc6ab3
TAR=tar
kusano fc6ab3
SHELL=bash
kusano fc6ab3
kusano fc6ab3
prefix=/usr/local
kusano fc6ab3
exec_prefix = $(prefix)
kusano fc6ab3
kusano fc6ab3
OBJS = adler32.o compress.o crc32.o gzio.o uncompr.o deflate.o trees.o \
kusano fc6ab3
       zutil.o inflate.o infblock.o inftrees.o infcodes.o infutil.o inffast.o
kusano fc6ab3
kusano fc6ab3
TEST_OBJS = example.o minigzip.o
kusano fc6ab3
kusano fc6ab3
DISTFILES = README INDEX ChangeLog configure Make*[a-z0-9] *.[ch] descrip.mms \
kusano fc6ab3
  algorithm.txt zlib.3 msdos/Make*[a-z0-9] msdos/zlib.def msdos/zlib.rc \
kusano fc6ab3
  nt/Makefile.nt nt/zlib.dnt  contrib/README.contrib contrib/*.txt \
kusano fc6ab3
  contrib/asm386/*.asm contrib/asm386/*.c \
kusano fc6ab3
  contrib/asm386/*.bat contrib/asm386/zlibvc.d?? contrib/iostream/*.cpp \
kusano fc6ab3
  contrib/iostream/*.h  contrib/iostream2/*.h contrib/iostream2/*.cpp \
kusano fc6ab3
  contrib/untgz/Makefile contrib/untgz/*.c contrib/untgz/*.w32
kusano fc6ab3
kusano fc6ab3
all: example.exe minigzip.exe
kusano fc6ab3
kusano fc6ab3
test: all
kusano fc6ab3
	@LD_LIBRARY_PATH=.:$(LD_LIBRARY_PATH) ; export LD_LIBRARY_PATH; \
kusano fc6ab3
	echo hello world | ./minigzip | ./minigzip -d || \
kusano fc6ab3
	  echo '		*** minigzip test FAILED ***' ; \
kusano fc6ab3
	if ./example; then \
kusano fc6ab3
	  echo '		*** zlib test OK ***'; \
kusano fc6ab3
	else \
kusano fc6ab3
	  echo '		*** zlib test FAILED ***'; \
kusano fc6ab3
	fi
kusano fc6ab3
kusano fc6ab3
$(ZLIB): $(OBJS)
kusano fc6ab3
	$(AR) $@ $(OBJS)
kusano fc6ab3
	-@ ($(RANLIB) $@ || true) >/dev/null 2>&1
kusano fc6ab3
kusano fc6ab3
$(SHAREDLIB): $(OBJS) os2/z.def
kusano fc6ab3
	$(LDSHARED) -o $@ $^
kusano fc6ab3
kusano fc6ab3
$(SHAREDLIBIMP): os2/z.def
kusano fc6ab3
	$(IMPLIB) -o $@ $^
kusano fc6ab3
kusano fc6ab3
example.exe: example.o $(LIBS)
kusano fc6ab3
	$(CC) $(CFLAGS) -o $@ example.o $(LDFLAGS)
kusano fc6ab3
kusano fc6ab3
minigzip.exe: minigzip.o $(LIBS)
kusano fc6ab3
	$(CC) $(CFLAGS) -o $@ minigzip.o $(LDFLAGS)
kusano fc6ab3
kusano fc6ab3
clean:
kusano fc6ab3
	rm -f *.o *~ example minigzip libz.a libz.so* foo.gz
kusano fc6ab3
kusano fc6ab3
distclean:	clean
kusano fc6ab3
kusano fc6ab3
zip:
kusano fc6ab3
	mv Makefile Makefile~; cp -p Makefile.in Makefile
kusano fc6ab3
	rm -f test.c ztest*.c
kusano fc6ab3
	v=`sed -n -e 's/\.//g' -e '/VERSION "/s/.*"\(.*\)".*/\1/p' < zlib.h`;\
kusano fc6ab3
	zip -ul9 zlib$$v $(DISTFILES)
kusano fc6ab3
	mv Makefile~ Makefile
kusano fc6ab3
kusano fc6ab3
dist:
kusano fc6ab3
	mv Makefile Makefile~; cp -p Makefile.in Makefile
kusano fc6ab3
	rm -f test.c ztest*.c
kusano fc6ab3
	d=zlib-`sed -n '/VERSION "/s/.*"\(.*\)".*/\1/p' < zlib.h`;\
kusano fc6ab3
	rm -f $$d.tar.gz; \
kusano fc6ab3
	if test ! -d ../$$d; then rm -f ../$$d; ln -s `pwd` ../$$d; fi; \
kusano fc6ab3
	files=""; \
kusano fc6ab3
	for f in $(DISTFILES); do files="$$files $$d/$$f"; done; \
kusano fc6ab3
	cd ..; \
kusano fc6ab3
	GZIP=-9 $(TAR) chofz $$d/$$d.tar.gz $$files; \
kusano fc6ab3
	if test ! -d $$d; then rm -f $$d; fi
kusano fc6ab3
	mv Makefile~ Makefile
kusano fc6ab3
kusano fc6ab3
tags:
kusano fc6ab3
	etags *.[ch]
kusano fc6ab3
kusano fc6ab3
depend:
kusano fc6ab3
	makedepend -- $(CFLAGS) -- *.[ch]
kusano fc6ab3
kusano fc6ab3
# DO NOT DELETE THIS LINE -- make depend depends on it.
kusano fc6ab3
kusano fc6ab3
adler32.o: zlib.h zconf.h
kusano fc6ab3
compress.o: zlib.h zconf.h
kusano fc6ab3
crc32.o: zlib.h zconf.h
kusano fc6ab3
deflate.o: deflate.h zutil.h zlib.h zconf.h
kusano fc6ab3
example.o: zlib.h zconf.h
kusano fc6ab3
gzio.o: zutil.h zlib.h zconf.h
kusano fc6ab3
infblock.o: infblock.h inftrees.h infcodes.h infutil.h zutil.h zlib.h zconf.h
kusano fc6ab3
infcodes.o: zutil.h zlib.h zconf.h
kusano fc6ab3
infcodes.o: inftrees.h infblock.h infcodes.h infutil.h inffast.h
kusano fc6ab3
inffast.o: zutil.h zlib.h zconf.h inftrees.h
kusano fc6ab3
inffast.o: infblock.h infcodes.h infutil.h inffast.h
kusano fc6ab3
inflate.o: zutil.h zlib.h zconf.h infblock.h
kusano fc6ab3
inftrees.o: zutil.h zlib.h zconf.h inftrees.h
kusano fc6ab3
infutil.o: zutil.h zlib.h zconf.h infblock.h inftrees.h infcodes.h infutil.h
kusano fc6ab3
minigzip.o: zlib.h zconf.h
kusano fc6ab3
trees.o: deflate.h zutil.h zlib.h zconf.h trees.h
kusano fc6ab3
uncompr.o: zlib.h zconf.h
kusano fc6ab3
zutil.o: zutil.h zlib.h zconf.h