1# Makefile for libpng
2# 32-bit Borland C++ (Note: All modules are compiled in C mode)
3# To build the library, do:
4#       "make -fmakefile.bc32"
5#
6# -------------------- 32-bit Borland C++ --------------------
7
8### Absolutely necessary for this makefile to work
9.AUTODEPEND
10
11## Where zlib.h, zconf.h and zlib.lib are
12ZLIB_DIR=..\zlib
13
14## Compiler, linker and lib stuff
15CC=bcc32
16LD=bcc32
17LIB=tlib
18
19# -3 = 386, -4 = 486, -5 = Pentium etc.
20!ifndef TARGET_CPU
21#TARGET_CPU=-6
22!endif
23
24# Use this if you don't want Borland's fancy exception handling
25# (Caution: doesn't work with CBuilderX)
26#NOEHLIB=noeh32.lib
27
28!ifdef DEBUG
29CDEBUG=-v
30LDEBUG=-v
31!else
32CDEBUG=
33LDEBUG=
34!endif
35
36# STACKOFLOW=1
37!ifdef STACKOFLOW
38CDEBUG=$(CDEBUG) -N
39LDEBUG=$(LDEBUG) -N
40!endif
41
42# -O2 optimize for speed
43# -d  merge duplicate strings
44# -k- turn off standard stack frame
45# -w  display all warnings
46CPPFLAGS=-I$(ZLIB_DIR)
47CFLAGS=-O2 -d -k- -w $(TARGET_CPU) $(CDEBUG)
48
49# -M  generate map file
50LDFLAGS=-L$(ZLIB_DIR) -M $(LDEBUG)
51
52## Variables
53OBJS = \
54	png.obj \
55	pngerror.obj \
56	pngget.obj \
57	pngmem.obj \
58	pngpread.obj \
59	pngread.obj \
60	pngrio.obj \
61	pngrtran.obj \
62	pngrutil.obj \
63	pngset.obj \
64	pngtrans.obj \
65	pngwio.obj \
66	pngwrite.obj \
67	pngwtran.obj \
68	pngwutil.obj
69
70LIBOBJS = \
71	+png.obj \
72	+pngerror.obj \
73	+pngget.obj \
74	+pngmem.obj \
75	+pngpread.obj \
76	+pngread.obj \
77	+pngrio.obj \
78	+pngrtran.obj \
79	+pngrutil.obj \
80	+pngset.obj \
81	+pngtrans.obj \
82	+pngwio.obj \
83	+pngwrite.obj \
84	+pngwtran.obj \
85	+pngwutil.obj
86
87LIBNAME=libpng.lib
88
89## Implicit rules
90# Braces let make "batch" calls to the compiler,
91# 2 calls instead of 12; space is important.
92.c.obj:
93	$(CC) $(CPPFLAGS) $(CFLAGS) -c {$*.c }
94
95.c.exe:
96	$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) $*.c \
97	  $(LIBNAME) zlib.lib $(NOEHLIB)
98
99.obj.exe:
100	$(LD) $(LDFLAGS) $*.obj $(LIBNAME) zlib.lib $(NOEHLIB)
101
102## Major targets
103all: libpng pngtest
104
105libpng: $(LIBNAME)
106
107pngtest: pngtest.exe
108
109test: pngtest.exe
110	pngtest
111
112## Minor Targets
113
114# see scripts\pnglibconf.mak for how to make this file
115# with different options
116pnglibconf.h: scripts\pnglibconf.h.prebuilt
117	copy scripts\pnglibconf.h.prebuilt $@
118
119png.obj: png.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
120pngerror.obj: pngerror.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
121pngget.obj: pngget.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
122pngmem.obj: pngmem.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
123pngpread.obj: pngpread.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
124pngread.obj: pngread.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
125pngrio.obj: pngrio.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
126pngrtran.obj: pngrtran.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
127pngrutil.obj: pngrutil.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
128pngset.obj: pngset.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
129pngtrans.obj: pngtrans.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
130pngwio.obj: pngwio.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
131pngwrite.obj: pngwrite.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
132pngwtran.obj: pngwtran.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
133pngwutil.obj: pngwutil.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
134pngtest.obj: pngtest.c png.h pngconf.h pnglibconf.h
135
136$(LIBNAME): $(OBJS)
137	-del $(LIBNAME)
138	$(LIB) $(LIBNAME) @&&|
139$(LIBOBJS), libpng
140|
141
142# Cleanup
143clean:
144	-del pnglibconf.h
145	-del *.obj
146	-del $(LIBNAME)
147	-del pngtest.exe
148	-del *.lst
149	-del *.map
150	-del *.tds
151	-del pngout.png
152
153# End of makefile for libpng
154