summaryrefslogtreecommitdiff
path: root/Build/source/libs/libpng/libpng-1.2.39/contrib/gregbook/Makefile.mingw32
blob: e70a59aef2bae8e7b1dad7c5cd6ed31ff2129a0e (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
# Sample makefile for rpng-win / rpng2-win / wpng using mingw32-gcc and make.
# Greg Roelofs
# Last modified:  2 June 2007
#
#	The programs built by this makefile are described in the book,
#	"PNG:  The Definitive Guide," by Greg Roelofs (O'Reilly and
#	Associates, 1999).  Go buy a copy, eh?  Well, OK, it's not
#	generally for sale anymore, but it's the thought that counts,
#	right?  (Hint:  http://www.libpng.org/pub/png/book/ )
#
# Invoke this makefile from a DOS-prompt window via:
#
#	make -f Makefile.mingw32
#
# This makefile assumes libpng and zlib have already been built or downloaded
# and are in subdirectories at the same level as the current subdirectory
# (as indicated by the PNGDIR and ZDIR macros below).  It makes no assumptions
# at all about the mingw32 installation tree (W32DIR).  Edit as appropriate.
#
# Note that the names of the dynamic and static libpng and zlib libraries
# used below may change in later releases of the libraries.  This makefile
# builds both statically and dynamically linked executables by default.
# (You need only one set, but for testing it can be handy to have both.)


# macros --------------------------------------------------------------------

#PNGDIR = ../..#		for libpng-x.y.z/contrib/gregbook builds
PNGDIR = ../libpng-win32
PNGINC = -I$(PNGDIR)
PNGLIBd = $(PNGDIR)/libpng.dll.a	# dynamically linked
PNGLIBs = $(PNGDIR)/libpng.a		# statically linked, local libpng

#ZDIR = ../../../zlib-win32#	for libpng-x.y.z/contrib/gregbook builds
ZDIR = ../zlib-win32
ZINC = -I$(ZDIR)
ZLIBd = $(ZDIR)/libzdll.a
ZLIBs = $(ZDIR)/libz.a

# change this to be the path where mingw32 installs its stuff:
W32DIR =
#W32DIR = /usr/local/cross-tools/i386-mingw32msvc
W32INC = -I$(W32DIR)/include
W32LIB = $(W32DIR)/lib/libuser32.a $(W32DIR)/lib/libgdi32.a

CC = gcc
#CC = i386-mingw32msvc-gcc #	e.g., Linux -> Win32 cross-compilation
LD = $(CC)
RM = rm -f
CFLAGS = -O -Wall $(INCS) $(MINGW_CCFLAGS)
# [note that -Wall is a gcc-specific compilation flag ("most warnings on")]
# [-ansi, -pedantic and -W can also be used]
LDFLAGS = $(MINGW_LDFLAGS)
O = .o
E = .exe

INCS = $(PNGINC) $(ZINC) $(W32INC)
RLIBSd = $(PNGLIBd) $(ZLIBd) $(W32LIB) -lm
RLIBSs = $(PNGLIBs) $(ZLIBs) $(W32LIB) -lm
WLIBSd = $(PNGLIBd) $(ZLIBd)
WLIBSs = $(PNGLIBs) $(ZLIBs)

RPNG   = rpng-win
RPNG2  = rpng2-win
WPNG   = wpng

ROBJSd  = $(RPNG)$(O) readpng.pic$(O)
ROBJS2d = $(RPNG2)$(O) readpng2.pic$(O)
WOBJSd  = $(WPNG)$(O) writepng.pic$(O)

RPNGs  = $(RPNG)-static
RPNG2s = $(RPNG2)-static
WPNGs  = $(WPNG)-static

ROBJSs  = $(RPNG)$(O) readpng$(O)
ROBJS2s = $(RPNG2)$(O) readpng2$(O)
WOBJSs  = $(WPNG)$(O) writepng$(O)

STATIC_EXES  = $(RPNGs)$(E) $(RPNG2s)$(E) $(WPNGs)$(E)
DYNAMIC_EXES = $(RPNG)$(E) $(RPNG2)$(E) $(WPNG)$(E)

EXES = $(STATIC_EXES) $(DYNAMIC_EXES)


# implicit make rules -------------------------------------------------------

.c$(O):
	$(CC) -c $(CFLAGS) $<

%.pic$(O): %.c
	$(CC) -c $(CFLAGS) -DPNG_BUILD_DLL -o $@ $<


# dependencies --------------------------------------------------------------

all:  $(EXES)

$(RPNGs)$(E): $(ROBJSs)
	$(LD) $(LDFLAGS) -o $@ $(ROBJSs) $(RLIBSs)

$(RPNG)$(E): $(ROBJSd)
	$(LD) $(LDFLAGS) -o $@ $(ROBJSd) $(RLIBSd)

$(RPNG2s)$(E): $(ROBJS2s)
	$(LD) $(LDFLAGS) -o $@ $(ROBJS2s) $(RLIBSs)

$(RPNG2)$(E): $(ROBJS2d)
	$(LD) $(LDFLAGS) -o $@ $(ROBJS2d) $(RLIBSd)

$(WPNGs)$(E): $(WOBJSs)
	$(LD) $(LDFLAGS) -o $@ $(WOBJSs) $(WLIBSs)

$(WPNG)$(E): $(WOBJSd)
	$(LD) $(LDFLAGS) -o $@ $(WOBJSd) $(WLIBSd)

$(RPNG)$(O):	$(RPNG).c readpng.h
$(RPNG2)$(O):	$(RPNG2).c readpng2.h
$(WPNG)$(O):	$(WPNG).c writepng.h

readpng$(O) readpng.pic$(O):	readpng.c readpng.h
readpng2$(O) readpng2.pic$(O):	readpng2.c readpng2.h
writepng$(O) writepng.pic$(O):	writepng.c writepng.h


# maintenance ---------------------------------------------------------------

clean:
	$(RM) $(EXES)
	$(RM) $(ROBJSs) $(ROBJS2s) $(WOBJSs)
	$(RM) $(ROBJSd) $(ROBJS2d) $(WOBJSd)