z/msdos/Makefile.msc

122 lines
3.2 KiB
Makefile
Raw Normal View History

2011-09-09 23:06:52 -07:00
# Makefile for zlib
# Microsoft C 5.1 or later
# To use, do "make makefile.msc"
2011-09-09 23:20:29 -07:00
# To compile in small model, set below: MODEL=S
2011-09-09 23:06:52 -07:00
2011-09-09 23:09:18 -07:00
# If you wish to reduce the memory requirements (default 256K for big
2011-09-09 23:20:29 -07:00
# objects plus a few K), you can add to the LOC macro below:
2011-09-09 23:09:18 -07:00
# -DMAX_MEM_LEVEL=7 -DMAX_WBITS=14
2011-09-09 23:07:35 -07:00
# See zconf.h for details about the memory requirements.
2011-09-09 23:06:52 -07:00
# ------------- Microsoft C 5.1 and later -------------
2011-09-09 23:20:29 -07:00
# Optional nonstandard preprocessor flags (e.g. -DMAX_MEM_LEVEL=7)
# should be added to the environment via "set LOCAL_ZLIB=-DFOO" or added
# to the declaration of LOC here:
LOC = $(LOCAL_ZLIB)
# Type for CPU required: 0: 8086, 1: 80186, 2: 80286, 3: 80386, etc.
CPU_TYP = 0
# Memory model: one of S, M, C, L (small, medium, compact, large)
MODEL=L
2011-09-09 23:06:52 -07:00
CC=cl
2011-09-09 23:20:29 -07:00
CFLAGS=-nologo -A$(MODEL) -G$(CPU_TYP) -W3 -Oait -Gs $(LOC)
#-Ox generates bad code with MSC 5.1
LIB_CFLAGS=-Zl $(CFLAGS)
2011-09-09 23:06:52 -07:00
LD=link
2011-09-09 23:20:29 -07:00
LDFLAGS=/noi/e/st:0x1500/noe/farcall/packcode
# "/farcall/packcode" are only useful for `large code' memory models
# but should be a "no-op" for small code models.
2011-09-09 23:06:52 -07:00
O=.obj
# variables
OBJ1 = adler32$(O) compress$(O) crc32$(O) gzio$(O) uncompr$(O) deflate$(O) \
trees$(O)
OBJP1 = adler32$(O)+compress$(O)+crc32$(O)+gzio$(O)+uncompr$(O)+deflate$(O)+\
trees$(O)
OBJ2 = zutil$(O) inflate$(O) infblock$(O) inftrees$(O) infcodes$(O) \
infutil$(O) inffast$(O)
OBJP2 = zutil$(O)+inflate$(O)+infblock$(O)+inftrees$(O)+infcodes$(O)+\
infutil$(O)+inffast$(O)
2011-09-09 23:20:29 -07:00
ZLIB_H = zlib.h zconf.h
ZUTIL_H = zutil.h $(ZLIB_H)
2011-09-09 23:17:02 -07:00
2011-09-09 23:20:29 -07:00
ZLIB_LIB = zlib_$(MODEL).lib
2011-09-09 23:06:52 -07:00
2011-09-09 23:20:29 -07:00
all: $(ZLIB_LIB) example.exe minigzip.exe
2011-09-09 23:06:52 -07:00
2011-09-09 23:20:29 -07:00
# individual dependencies and action rules:
adler32.obj: adler32.c $(ZLIB_H)
$(CC) -c $(LIB_CFLAGS) $*.c
2011-09-09 23:06:52 -07:00
2011-09-09 23:20:29 -07:00
compress.obj: compress.c $(ZLIB_H)
$(CC) -c $(LIB_CFLAGS) $*.c
2011-09-09 23:06:52 -07:00
2011-09-09 23:20:29 -07:00
crc32.obj: crc32.c $(ZLIB_H)
$(CC) -c $(LIB_CFLAGS) $*.c
2011-09-09 23:06:52 -07:00
2011-09-09 23:20:29 -07:00
deflate.obj: deflate.c deflate.h $(ZUTIL_H)
$(CC) -c $(LIB_CFLAGS) $*.c
2011-09-09 23:06:52 -07:00
2011-09-09 23:20:29 -07:00
gzio.obj: gzio.c $(ZUTIL_H)
$(CC) -c $(LIB_CFLAGS) $*.c
2011-09-09 23:06:52 -07:00
2011-09-09 23:20:29 -07:00
infblock.obj: infblock.c $(ZUTIL_H) infblock.h inftrees.h infcodes.h infutil.h
$(CC) -c $(LIB_CFLAGS) $*.c
2011-09-09 23:06:52 -07:00
2011-09-09 23:20:29 -07:00
infcodes.obj: infcodes.c $(ZUTIL_H) inftrees.h infutil.h infcodes.h inffast.h
$(CC) -c $(LIB_CFLAGS) $*.c
2011-09-09 23:06:52 -07:00
2011-09-09 23:20:29 -07:00
inflate.obj: inflate.c $(ZUTIL_H) infblock.h
$(CC) -c $(LIB_CFLAGS) $*.c
2011-09-09 23:06:52 -07:00
2011-09-09 23:20:29 -07:00
inftrees.obj: inftrees.c $(ZUTIL_H) inftrees.h
$(CC) -c $(LIB_CFLAGS) $*.c
2011-09-09 23:06:52 -07:00
2011-09-09 23:20:29 -07:00
infutil.obj: infutil.c $(ZUTIL_H) inftrees.h infutil.h
$(CC) -c $(LIB_CFLAGS) $*.c
2011-09-09 23:06:52 -07:00
2011-09-09 23:20:29 -07:00
inffast.obj: inffast.c $(ZUTIL_H) inftrees.h infutil.h inffast.h
$(CC) -c $(LIB_CFLAGS) $*.c
2011-09-09 23:06:52 -07:00
2011-09-09 23:20:29 -07:00
trees.obj: trees.c deflate.h $(ZUTIL_H)
$(CC) -c $(LIB_CFLAGS) $*.c
uncompr.obj: uncompr.c $(ZLIB_H)
$(CC) -c $(LIB_CFLAGS) $*.c
zutil.obj: zutil.c $(ZUTIL_H)
$(CC) -c $(LIB_CFLAGS) $*.c
2011-09-09 23:06:52 -07:00
2011-09-09 23:20:29 -07:00
example.obj: example.c $(ZLIB_H)
2011-09-09 23:06:52 -07:00
$(CC) -c $(CFLAGS) $*.c
2011-09-09 23:20:29 -07:00
minigzip.obj: minigzip.c $(ZLIB_H)
2011-09-09 23:06:52 -07:00
$(CC) -c $(CFLAGS) $*.c
# we must cut the command line to fit in the MS/DOS 128 byte limit:
2011-09-09 23:20:29 -07:00
$(ZLIB_LIB): $(OBJ1) $(OBJ2)
if exist $(ZLIB_LIB) del $(ZLIB_LIB)
lib $(ZLIB_LIB) $(OBJ1);
lib $(ZLIB_LIB) $(OBJ2);
2011-09-09 23:06:52 -07:00
2011-09-09 23:20:29 -07:00
example.exe: example.obj $(ZLIB_LIB)
$(LD) $(LDFLAGS) example.obj,,,$(ZLIB_LIB);
2011-09-09 23:06:52 -07:00
2011-09-09 23:20:29 -07:00
minigzip.exe: minigzip.obj $(ZLIB_LIB)
$(LD) $(LDFLAGS) minigzip.obj,,,$(ZLIB_LIB);
2011-09-09 23:06:52 -07:00
test: example.exe minigzip.exe
example
echo hello world | minigzip | minigzip -d
#clean:
# del *.obj
# del *.exe