1# Makefile for libpng
2# 16-bit Borland C++ (Note: All modules are compiled in C mode)
3# To build the library, do:
4#       "make -fmakefile.bor -DMODEL=c"
5# or:   "make -fmakefile.bor -DMODEL=l"
6#
7# ------------ Borland C++ ------------
8
9### Absolutely necessary for this makefile to work
10.AUTODEPEND
11
12## Where zlib.h, zconf.h and zlib_MODEL.lib are
13ZLIB_DIR=..\zlib
14
15## Compiler, linker, librarian and other tools
16CC=bcc
17LD=bcc
18LIB=tlib
19CP=copy
20
21!ifndef MODEL
22MODEL=l
23!endif
24
25MODEL_ARG=-m$(MODEL)
26
27#TARGET_CPU=3
28# 2 = 286, 3 = 386, etc.
29!ifndef TARGET_CPU
30TARGET_CPU=2
31!endif
32
33# Use this if you don't want Borland's fancy exception handling
34# (for Borland C++ 4.0 or later)
35#NOEHLIB=noeh$(MODEL).lib
36
37!ifdef DEBUG
38CDEBUG=-v
39LDEBUG=-v
40!else
41CDEBUG=
42LDEBUG=
43!endif
44
45# STACKOFLOW=1
46!ifdef STACKOFLOW
47CDEBUG=$(CDEBUG) -N
48LDEBUG=$(LDEBUG) -N
49!endif
50
51# -X- turn on dependency generation in the object file
52# -w  set all warnings on
53# -O2 optimize for speed
54# -Z  global optimization
55CPPFLAGS=-I$(ZLIB_DIR)
56CFLAGS=-O2 -Z -X- -w -$(TARGET_CPU) $(MODEL_ARG) $(CDEBUG)
57
58# -M  generate map file
59LDFLAGS=-M -L$(ZLIB_DIR) $(MODEL_ARG) $(LDEBUG)
60
61# Pre-built configuration
62# See scripts\pnglibconf.mak for more options
63!ifndef PNGLIBCONF_H_PREBUILT
64PNGLIBCONF_H_PREBUILT = scripts\pnglibconf.h.prebuilt
65!endif
66
67## Variables
68
69OBJS = \
70	png.obj \
71	pngerror.obj \
72	pngget.obj \
73	pngmem.obj \
74	pngpread.obj \
75	pngread.obj \
76	pngrio.obj \
77	pngrtran.obj \
78	pngrutil.obj \
79	pngset.obj \
80	pngtrans.obj \
81	pngwio.obj \
82	pngwrite.obj \
83	pngwtran.obj \
84	pngwutil.obj
85
86LIBOBJS = \
87	+png.obj \
88	+pngerror.obj \
89	+pngget.obj \
90	+pngmem.obj \
91	+pngpread.obj \
92	+pngread.obj \
93	+pngrio.obj \
94	+pngrtran.obj \
95	+pngrutil.obj \
96	+pngset.obj \
97	+pngtrans.obj \
98	+pngwio.obj \
99	+pngwrite.obj \
100	+pngwtran.obj \
101	+pngwutil.obj
102
103LIBNAME=libpng$(MODEL).lib
104
105## Implicit rules
106
107# Braces let make "batch" calls to the compiler,
108# 2 calls instead of 12; space is important.
109.c.obj:
110	$(CC) $(CPPFLAGS) $(CFLAGS) -c {$*.c }
111
112.c.exe:
113	$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) $*.c \
114	  $(LIBNAME) zlib_$(MODEL).lib $(NOEHLIB)
115
116## Major targets
117
118all: libpng pngtest
119
120# try !include scripts\pnglibconf.mak for more options
121pnglibconf.h: $(PNGLIBCONF_H_PREBUILT)
122	$(CP) $(PNGLIBCONF_H_PREBUILT) $@
123
124libpng: $(LIBNAME)
125
126pngtest: pngtest$(MODEL).exe
127
128test: pngtest$(MODEL).exe
129	pngtest$(MODEL)
130
131## Minor Targets
132
133png.obj: png.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
134pngerror.obj: pngerror.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
135pngget.obj: pngget.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
136pngmem.obj: pngmem.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
137pngpread.obj: pngpread.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
138pngread.obj: pngread.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
139pngrio.obj: pngrio.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
140pngrtran.obj: pngrtran.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
141pngrutil.obj: pngrutil.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
142pngset.obj: pngset.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
143pngtrans.obj: pngtrans.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
144pngwio.obj: pngwio.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
145pngwrite.obj: pngwrite.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
146pngwtran.obj: pngwtran.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
147pngwutil.obj: pngwutil.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
148
149$(LIBNAME): $(OBJS)
150	-del $(LIBNAME)
151	$(LIB) $(LIBNAME) @&&|
152$(LIBOBJS), libpng$(MODEL)
153|
154
155pngtest$(MODEL).obj: pngtest.c png.h pngconf.h pnglibconf.h
156	$(CC) $(CFLAGS) -opngtest$(MODEL) -c pngtest.c
157
158pngtest$(MODEL).exe: pngtest$(MODEL).obj
159	$(LD) $(LDFLAGS) pngtest$(MODEL).obj $(LIBNAME) zlib_$(MODEL).lib $(NOEHLIB)
160
161# Clean up anything else you want
162clean:
163	-del pnglibconf.h
164	-del *.obj
165	-del *.exe
166	-del *.lib
167	-del *.lst
168	-del *.map
169
170# End of makefile for libpng
171