summaryrefslogtreecommitdiff
blob: 6693772dbe6738703ee75fafc0fdd830a5ae63e6 (plain)
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
# Makefile for libpng
# 16-bit Borland C++ (Note: All modules are compiled in C mode)
# To build the library, do:
#       "make -fmakefile.bor -DMODEL=c"
# or:   "make -fmakefile.bor -DMODEL=l"
#
# ------------ Borland C++ ------------

### Absolutely necessary for this makefile to work
.AUTODEPEND

## Where zlib.h, zconf.h and zlib_MODEL.lib are
ZLIB_DIR=..\zlib

## Compiler, linker, librarian and other tools
CC=bcc
LD=bcc
LIB=tlib
CP=copy

!ifndef MODEL
MODEL=l
!endif

MODEL_ARG=-m$(MODEL)

#TARGET_CPU=3
# 2 = 286, 3 = 386, etc.
!ifndef TARGET_CPU
TARGET_CPU=2
!endif

# Use this if you don't want Borland's fancy exception handling
# (for Borland C++ 4.0 or later)
#NOEHLIB=noeh$(MODEL).lib

!ifdef DEBUG
CDEBUG=-v
LDEBUG=-v
!else
CDEBUG=
LDEBUG=
!endif

# STACKOFLOW=1
!ifdef STACKOFLOW
CDEBUG=$(CDEBUG) -N
LDEBUG=$(LDEBUG) -N
!endif

# -X- turn on dependency generation in the object file
# -w  set all warnings on
# -O2 optimize for speed
# -Z  global optimization
CPPFLAGS=-I$(ZLIB_DIR)
CFLAGS=-O2 -Z -X- -w -$(TARGET_CPU) $(MODEL_ARG) $(CDEBUG)

# -M  generate map file
LDFLAGS=-M -L$(ZLIB_DIR) $(MODEL_ARG) $(LDEBUG)

# Pre-built configuration
# See scripts\pnglibconf.mak for more options
!ifndef PNGLIBCONF_H_PREBUILT
PNGLIBCONF_H_PREBUILT = scripts\pnglibconf.h.prebuilt
!endif

## Variables

OBJS = \
	png.obj \
	pngerror.obj \
	pngget.obj \
	pngmem.obj \
	pngpread.obj \
	pngread.obj \
	pngrio.obj \
	pngrtran.obj \
	pngrutil.obj \
	pngset.obj \
	pngtrans.obj \
	pngwio.obj \
	pngwrite.obj \
	pngwtran.obj \
	pngwutil.obj

LIBOBJS = \
	+png.obj \
	+pngerror.obj \
	+pngget.obj \
	+pngmem.obj \
	+pngpread.obj \
	+pngread.obj \
	+pngrio.obj \
	+pngrtran.obj \
	+pngrutil.obj \
	+pngset.obj \
	+pngtrans.obj \
	+pngwio.obj \
	+pngwrite.obj \
	+pngwtran.obj \
	+pngwutil.obj

LIBNAME=libpng$(MODEL).lib

## Implicit rules

# Braces let make "batch" calls to the compiler,
# 2 calls instead of 12; space is important.
.c.obj:
	$(CC) $(CPPFLAGS) $(CFLAGS) -c {$*.c }

.c.exe:
	$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) $*.c \
	  $(LIBNAME) zlib_$(MODEL).lib $(NOEHLIB)

## Major targets

all: libpng pngtest

# try !include scripts\pnglibconf.mak for more options
pnglibconf.h: $(PNGLIBCONF_H_PREBUILT)
	$(CP) $(PNGLIBCONF_H_PREBUILT) $@

libpng: $(LIBNAME)

pngtest: pngtest$(MODEL).exe

test: pngtest$(MODEL).exe
	pngtest$(MODEL)

## Minor Targets

png.obj: png.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngerror.obj: pngerror.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngget.obj: pngget.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngmem.obj: pngmem.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngpread.obj: pngpread.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngread.obj: pngread.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngrio.obj: pngrio.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngrtran.obj: pngrtran.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngrutil.obj: pngrutil.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngset.obj: pngset.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngtrans.obj: pngtrans.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngwio.obj: pngwio.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngwrite.obj: pngwrite.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngwtran.obj: pngwtran.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngwutil.obj: pngwutil.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h

$(LIBNAME): $(OBJS)
	-del $(LIBNAME)
	$(LIB) $(LIBNAME) @&&|
$(LIBOBJS), libpng$(MODEL)
|

pngtest$(MODEL).obj: pngtest.c png.h pngconf.h pnglibconf.h
	$(CC) $(CFLAGS) -opngtest$(MODEL) -c pngtest.c

pngtest$(MODEL).exe: pngtest$(MODEL).obj
	$(LD) $(LDFLAGS) pngtest$(MODEL).obj $(LIBNAME) zlib_$(MODEL).lib $(NOEHLIB)

# Clean up anything else you want
clean:
	-del pnglibconf.h
	-del *.obj
	-del *.exe
	-del *.lib
	-del *.lst
	-del *.map

# End of makefile for libpng