Home | History | Annotate | Download | only in os2
      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 
     13 CC=gcc -Zomf -s
     14 
     15 CFLAGS=-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
     25 CFLAGS+=-fno-force-mem
     26 
     27 LDFLAGS=-s -L. -lzdll -Zcrtdll
     28 LDSHARED=$(CC) -s -Zomf -Zdll -Zcrtdll
     29 
     30 VER=1.1.0
     31 ZLIB=z.lib
     32 SHAREDLIB=z.dll
     33 SHAREDLIBIMP=zdll.lib
     34 LIBS=$(ZLIB) $(SHAREDLIB) $(SHAREDLIBIMP)
     35 
     36 AR=emxomfar cr
     37 IMPLIB=emximp
     38 RANLIB=echo
     39 TAR=tar
     40 SHELL=bash
     41 
     42 prefix=/usr/local
     43 exec_prefix = $(prefix)
     44 
     45 OBJS = 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 
     48 TEST_OBJS = example.o minigzip.o
     49 
     50 DISTFILES = 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 
     58 all: example.exe minigzip.exe
     59 
     60 test: 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 
     80 example.exe: example.o $(LIBS)
     81 	$(CC) $(CFLAGS) -o $@ example.o $(LDFLAGS)
     82 
     83 minigzip.exe: minigzip.o $(LIBS)
     84 	$(CC) $(CFLAGS) -o $@ minigzip.o $(LDFLAGS)
     85 
     86 clean:
     87 	rm -f *.o *~ example minigzip libz.a libz.so* foo.gz
     88 
     89 distclean:	clean
     90 
     91 zip:
     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 
     98 dist:
     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 
    111 tags:
    112 	etags *.[ch]
    113 
    114 depend:
    115 	makedepend -- $(CFLAGS) -- *.[ch]
    116 
    117 # DO NOT DELETE THIS LINE -- make depend depends on it.
    118 
    119 adler32.o: zlib.h zconf.h
    120 compress.o: zlib.h zconf.h
    121 crc32.o: zlib.h zconf.h
    122 deflate.o: deflate.h zutil.h zlib.h zconf.h
    123 example.o: zlib.h zconf.h
    124 gzio.o: zutil.h zlib.h zconf.h
    125 infblock.o: infblock.h inftrees.h infcodes.h infutil.h zutil.h zlib.h zconf.h
    126 infcodes.o: zutil.h zlib.h zconf.h
    127 infcodes.o: inftrees.h infblock.h infcodes.h infutil.h inffast.h
    128 inffast.o: zutil.h zlib.h zconf.h inftrees.h
    129 inffast.o: infblock.h infcodes.h infutil.h inffast.h
    130 inflate.o: zutil.h zlib.h zconf.h infblock.h
    131 inftrees.o: zutil.h zlib.h zconf.h inftrees.h
    132 infutil.o: zutil.h zlib.h zconf.h infblock.h inftrees.h infcodes.h infutil.h
    133 minigzip.o: zlib.h zconf.h
    134 trees.o: deflate.h zutil.h zlib.h zconf.h trees.h
    135 uncompr.o: zlib.h zconf.h
    136 zutil.o: zutil.h zlib.h zconf.h
    137