Makefile.dj2 2.6 KB
Newer Older
M
Mark Adler 已提交
1
# Makefile for zlib.  Modified for djgpp v2.0 by F. J. Donahoe, 3/15/96.
M
Mark Adler 已提交
2
# Copyright (C) 1995-1998 Jean-loup Gailly.
M
Mark Adler 已提交
3
# For conditions of distribution and use, see copyright notice in zlib.h
M
Mark Adler 已提交
4

M
Mark Adler 已提交
5
# To compile, or to compile and test, type:
M
Mark Adler 已提交
6
#
M
Mark Adler 已提交
7
#   make -fmakefile.dj2;  make test -fmakefile.dj2
M
Mark Adler 已提交
8
#
M
Mark Adler 已提交
9
# To install libz.a, zconf.h and zlib.h in the djgpp directories, type:
M
Mark Adler 已提交
10
#
M
Mark Adler 已提交
11
#    make install -fmakefile.dj2
M
Mark Adler 已提交
12
#
M
Mark Adler 已提交
13 14 15 16 17 18 19 20 21 22 23 24
# after first defining LIBRARY_PATH and INCLUDE_PATH in djgpp.env as
# in the sample below if the pattern of the DJGPP distribution is to
# be followed.  Remember that, while <sp>'es around <=> are ignored in
# makefiles, they are *not* in batch files or in djgpp.env.
# - - - - -
# [make]
# INCLUDE_PATH=%\>;INCLUDE_PATH%%\DJDIR%\include
# LIBRARY_PATH=%\>;LIBRARY_PATH%%\DJDIR%\lib
# BUTT=-m486
# - - - - -
# Alternately, these variables may be defined below, overriding the values
# in djgpp.env, as
M
Mark Adler 已提交
25 26
# INCLUDE_PATH=c:\usr\include
# LIBRARY_PATH=c:\usr\lib
M
Mark Adler 已提交
27 28 29 30 31

CC=gcc

#CFLAGS=-MMD -O
#CFLAGS=-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7
32
#CFLAGS=-MMD -g -DZLIB_DEBUG
M
Mark Adler 已提交
33 34 35
CFLAGS=-MMD -O3 $(BUTT) -Wall -Wwrite-strings -Wpointer-arith -Wconversion \
             -Wstrict-prototypes -Wmissing-prototypes

M
Mark Adler 已提交
36 37 38 39 40 41
# If cp.exe is available, replace "copy /Y" with "cp -fp" .
CP=copy /Y
# If gnu install.exe is available, replace $(CP) with ginstall.
INSTALL=$(CP)
# The default value of RM is "rm -f."  If "rm.exe" is found, comment out:
RM=del
M
Mark Adler 已提交
42 43 44 45
LDLIBS=-L. -lz
LD=$(CC) -s -o
LDSHARED=$(CC)

M
Mark Adler 已提交
46
INCL=zlib.h zconf.h
M
Mark Adler 已提交
47 48 49 50 51 52 53
LIBS=libz.a

AR=ar rcs

prefix=/usr/local
exec_prefix = $(prefix)

M
Mark Adler 已提交
54
OBJS = adler32.o compress.o crc32.o gzclose.o gzlib.o gzread.o gzwrite.o \
M
Mark Adler 已提交
55
       uncompr.o deflate.o trees.o zutil.o inflate.o infback.o inftrees.o inffast.o
M
Mark Adler 已提交
56 57 58

OBJA =
# to use the asm code: make OBJA=match.o
M
Mark Adler 已提交
59 60 61 62 63

TEST_OBJS = example.o minigzip.o

all: example.exe minigzip.exe

M
Mark Adler 已提交
64
check: test
M
Mark Adler 已提交
65 66
test: all
	./example
M
Mark Adler 已提交
67
	echo hello world | .\minigzip | .\minigzip -d
M
Mark Adler 已提交
68 69 70 71

%.o : %.c
	$(CC) $(CFLAGS) -c $< -o $@

M
Mark Adler 已提交
72 73
libz.a: $(OBJS) $(OBJA)
	$(AR) $@ $(OBJS) $(OBJA)
M
Mark Adler 已提交
74 75 76 77

%.exe : %.o $(LIBS)
	$(LD) $@ $< $(LDLIBS)

M
Mark Adler 已提交
78 79 80
# INCLUDE_PATH and LIBRARY_PATH were set for [make] in djgpp.env .

.PHONY : uninstall clean
M
Mark Adler 已提交
81

M
Mark Adler 已提交
82 83 84
install: $(INCL) $(LIBS)
	-@if not exist $(INCLUDE_PATH)\nul mkdir $(INCLUDE_PATH)
	-@if not exist $(LIBRARY_PATH)\nul mkdir $(LIBRARY_PATH)
M
Mark Adler 已提交
85 86 87
	$(INSTALL) zlib.h $(INCLUDE_PATH)
	$(INSTALL) zconf.h $(INCLUDE_PATH)
	$(INSTALL) libz.a $(LIBRARY_PATH)
M
Mark Adler 已提交
88 89

uninstall:
M
Mark Adler 已提交
90 91 92
	$(RM) $(INCLUDE_PATH)\zlib.h
	$(RM) $(INCLUDE_PATH)\zconf.h
	$(RM) $(LIBRARY_PATH)\libz.a
M
Mark Adler 已提交
93 94

clean:
M
Mark Adler 已提交
95 96 97 98 99
	$(RM) *.d
	$(RM) *.o
	$(RM) *.exe
	$(RM) libz.a
	$(RM) foo.gz
M
Mark Adler 已提交
100 101 102 103 104

DEPS := $(wildcard *.d)
ifneq ($(DEPS),)
include $(DEPS)
endif