liyujie
2025-08-28 786ff4f4ca2374bdd9177f2e24b503d43e7a3b93
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# Makefile for zlib.  Modified for emx/rsxnt by Chr. Spieler, 6/16/98.
# Copyright (C) 1995-1998 Jean-loup Gailly.
# For conditions of distribution and use, see copyright notice in zlib.h
 
# To compile, or to compile and test, type:
#
#   make -fmakefile.emx;  make test -fmakefile.emx
#
 
CC=gcc -Zwin32
 
#CFLAGS=-MMD -O
#CFLAGS=-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7
#CFLAGS=-MMD -g -DZLIB_DEBUG
CFLAGS=-MMD -O3 $(BUTT) -Wall -Wwrite-strings -Wpointer-arith -Wconversion \
             -Wstrict-prototypes -Wmissing-prototypes
 
# 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
LDLIBS=-L. -lzlib
LD=$(CC) -s -o
LDSHARED=$(CC)
 
INCL=zlib.h zconf.h
LIBS=zlib.a
 
AR=ar rcs
 
prefix=/usr/local
exec_prefix = $(prefix)
 
OBJS = adler32.o compress.o crc32.o deflate.o gzclose.o gzlib.o gzread.o \
       gzwrite.o infback.o inffast.o inflate.o inftrees.o trees.o uncompr.o zutil.o
 
TEST_OBJS = example.o minigzip.o
 
all: example.exe minigzip.exe
 
test: all
   ./example
   echo hello world | .\minigzip | .\minigzip -d
 
%.o : %.c
   $(CC) $(CFLAGS) -c $< -o $@
 
zlib.a: $(OBJS)
   $(AR) $@ $(OBJS)
 
%.exe : %.o $(LIBS)
   $(LD) $@ $< $(LDLIBS)
 
 
.PHONY : clean
 
clean:
   $(RM) *.d
   $(RM) *.o
   $(RM) *.exe
   $(RM) zlib.a
   $(RM) foo.gz
 
DEPS := $(wildcard *.d)
ifneq ($(DEPS),)
include $(DEPS)
endif