Makefile 2.1 KB
Newer Older
M
Mark Adler 已提交
1 2 3 4
# Makefile for zlib
# Copyright (C) 1995 Jean-loup Gailly.
# For conditions of distribution and use, see copyright notice in zlib.h 

M
Mark Adler 已提交
5 6
CC=cc
CFLAGS=-O
M
Mark Adler 已提交
7
#CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7"
M
Mark Adler 已提交
8 9 10 11 12
#CFLAGS=-g -DDEBUG
LDFLAGS=-L. -lgz

RANLIB=ranlib

M
Mark Adler 已提交
13 14
prefix=/usr/local

M
Mark Adler 已提交
15
OBJS = adler32.o compress.o crc32.o gzio.o uncompr.o deflate.o trees.o \
M
Mark Adler 已提交
16
       zutil.o inflate.o infblock.o inftrees.o infcodes.o infutil.o inffast.o
M
Mark Adler 已提交
17 18 19 20 21 22 23 24 25

TEST_OBJS = example.o minigzip.o inftest.o

all: example minigzip inftest

test: all
	./example
	echo hello world | ./minigzip | ./minigzip -d 

M
Mark Adler 已提交
26 27 28 29 30 31 32 33
install: libgz.a
	-@mkdir $(prefix)/include
	-@mkdir $(prefix)/lib
	cp zlib.h zconf.h $(prefix)/include
	chmod 644 $(prefix)/include/zlib.h $(prefix)/include/zconf.h
	cp libgz.a $(prefix)/lib
	chmod 644 $(prefix)/lib/libgz.a

M
Mark Adler 已提交
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
libgz.a: $(OBJS)
	ar rc $@ $(OBJS)
	$(RANLIB) $@

example: example.o libgz.a
	$(CC) $(CFLAGS) -o $@ example.o $(LDFLAGS)

minigzip: minigzip.o libgz.a
	$(CC) $(CFLAGS) -o $@ minigzip.o $(LDFLAGS)

inftest: inftest.o libgz.a
	$(CC) $(CFLAGS) -o $@ inftest.o $(LDFLAGS)

clean:
	rm -f *.o example minigzip inftest libgz.a foo.gz

zip:
M
Mark Adler 已提交
51
	zip -ul9 zlib README ChangeLog Makefile Makefile.??? Makefile.?? *.[ch]
M
Mark Adler 已提交
52 53 54

tgz:
	cd ..; tar cfz zlib/zlib.tgz zlib/README zlib/ChangeLog zlib/Makefile \
M
Mark Adler 已提交
55
		zlib/Makefile.??? zlib/Makefile.?? zlib/*.[ch]
M
Mark Adler 已提交
56 57 58 59 60 61 62 63 64 65

# DO NOT DELETE THIS LINE -- make depend depends on it.

adler32.o: zutil.h zlib.h zconf.h
compress.o: zlib.h zconf.h
crc32.o: zutil.h zlib.h zconf.h
deflate.o: deflate.h zutil.h zlib.h zconf.h
example.o: zlib.h zconf.h
gzio.o: zutil.h zlib.h zconf.h
infblock.o: zutil.h zlib.h zconf.h infblock.h inftrees.h infcodes.h infutil.h
M
Mark Adler 已提交
66 67
infcodes.o: zutil.h zlib.h zconf.h inftrees.h infutil.h infcodes.h inffast.h
inffast.o: zutil.h zlib.h zconf.h inftrees.h infutil.h inffast.h
M
Mark Adler 已提交
68 69 70 71 72 73 74 75
inflate.o: zutil.h zlib.h zconf.h infblock.h
inftest.o: zutil.h zlib.h zconf.h
inftrees.o: zutil.h zlib.h zconf.h inftrees.h
infutil.o: zutil.h zlib.h zconf.h inftrees.h infutil.h
minigzip.o: zlib.h zconf.h
trees.o: deflate.h zutil.h zlib.h zconf.h
uncompr.o: zlib.h zconf.h
zutil.o: zutil.h zlib.h zconf.h