File: Makefile.Win32

package info (click to toggle)
mrtg 2.14.7-2
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 5,676 kB
  • ctags: 1,232
  • sloc: perl: 26,269; ansic: 4,560; sh: 1,407; makefile: 254; php: 227; awk: 225; csh: 49; exp: 16
file content (261 lines) | stat: -rw-r--r-- 6,958 bytes parent folder | download
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
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
# GNU Makefile for Win32 rateup.exe target * 05-Feb-2006
# for use with MingW32 gcc or Metrowerks CodeWarrior compiler
# use with: make -f Makefile.Win32 [all|clean|dist]

TARGET	= rateup
DESCR	= MRTG Rateup Command Utility $(RATEUP_VERSION_STR)
COPYR	= Distributed under the GNU General Public License
WWWURL	= http://www.mrtg.org/

# If you want to link with an icon you can specify here...
LNKICON	= images/favicon.ico

# Edit the path below to point to your install destination (for 'install' option.)
ifndef INSTDIR
	INSTDIR	= c:/mrtg/run
endif

# All library code is statically linked to avoid problems with other lib NLMs. 
# Base for the lib sources
ifndef LIBBASE
	LIBBASE	= ..
endif
# All library code is statically linked to avoid problems with other lib DLLs. 
# Edit the path below to point to your libgd sources or set environment var.
ifndef LIBGD
	LIBGD	= $(LIBBASE)/gd-2.0.33
endif
# Edit the path below to point to your libpng sources or set environment var.
ifndef LIBPNG
	LIBPNG	= $(LIBBASE)/libpng-1.2.8
endif
# Edit the path below to point to your zlib sources or set environment var.
ifndef ZLIBSDK
	ZLIBSDK	= $(LIBBASE)/zlib-1.2.3
endif

# The following line defines your compiler.
ifdef METROWERKS
	CC = mwcc
else
	CC = gcc
endif
# RM	= rm -f
CP	= cp -fav
# MV	= mv -f

ZIP	= zip -qzR9
ARCHIVE	= rateup-$(RATEUP_VERSION_STR)-w32.zip

# must be equal to DEBUG or NDEBUG
DB	= NDEBUG
# DB	= DEBUG
# Optimization: -O<n> or debugging: -g
ifeq ($(DB),NDEBUG)
	OPT	= -O2
	OBJDIR	= release
else
	OPT	= -g
	OBJDIR	= debug
endif

# Include the version info retrieved from source.
-include $(OBJDIR)/version.inc

# Global flags for all compilers
CFLAGS	= $(OPT) -D$(DB) -DHAVE_LIBPNG -DNONDLL

ifeq ($(CC),mwcc)
LD	= mwld
CFLAGS	+= -nostdinc -gccinc -msgstyle gcc -inline off -opt nointrinsics -inst mmx -proc 586
CFLAGS	+= -relax_pointers
#CFLAGS	+= -w on,nounused,nounusedexpr
#CFLAGS	+= -ansi strict
CFLAGS	+= -ir "$(METROWERKS)/MSL" -ir "$(METROWERKS)/Win32-x86 Support"
LD	= mwld
RC	= mwwinrc
LDFLAGS	= -nostdlib
LIBPATH	+= -lr "$(METROWERKS)/MSL" -lr "$(METROWERKS)/Win32-x86 Support"
LDLIBS	+= -lkernel32.lib -luser32.lib
LDLIBS	+= -lMSL_Runtime_x86.lib -lMSL_C_x86.lib -lMSL_Extras_x86.lib
LIBFILES= $(LDLIBS)
RCFLAGS	=
else
LD	= gcc
RC	= windres
LDFLAGS	= -s
RCFLAGS	= -I rc -O coff -i
CFLAGS	+= -Wall -Wno-format -Wno-unused # -pedantic
endif

LDLIBS	=

ifndef COPYR
	COPYR = Copyright (c) 2005 The Open Source Community.
endif
ifndef DESCR
	DESCR = $(TARGET) Command Extension
endif
DESCR += - $(CC) build

INCLUDES += -I$(LIBGD) -I$(LIBPNG) -I$(ZLIBSDK)

CFLAGS += $(INCLUDES)

vpath %.c src $(LIBGD) $(LIBPNG) $(ZLIBSDK)

GDOBJS	= \
	$(OBJDIR)/gd.o \
	$(OBJDIR)/gd_io.o \
	$(OBJDIR)/gd_io_dp.o \
	$(OBJDIR)/gd_io_file.o \
	$(OBJDIR)/gd_io_ss.o \
	$(OBJDIR)/gd_png.o \
	$(OBJDIR)/gd_ss.o \
	$(OBJDIR)/gdcache.o \
	$(OBJDIR)/gdfonts.o \
	$(OBJDIR)/gdhelpers.o \
	$(OBJDIR)/gdtables.o \
	$(EOLIST)
ifeq "$(wildcard $(LIBGD)/gd_security.c)" "$(LIBGD)/gd_security.c"
GDOBJS	+= \
	$(OBJDIR)/gd_security.o \
	$(EOLIST)
endif

PNGOBJS	= \
	$(OBJDIR)/png.o \
	$(OBJDIR)/pngerror.o \
	$(OBJDIR)/pnggccrd.o \
	$(OBJDIR)/pngget.o \
	$(OBJDIR)/pngmem.o \
	$(OBJDIR)/pngpread.o \
	$(OBJDIR)/pngread.o \
	$(OBJDIR)/pngrio.o \
	$(OBJDIR)/pngrtran.o \
	$(OBJDIR)/pngrutil.o \
	$(OBJDIR)/pngset.o \
	$(OBJDIR)/pngtrans.o \
	$(OBJDIR)/pngvcrd.o \
	$(OBJDIR)/pngwio.o \
	$(OBJDIR)/pngwrite.o \
	$(OBJDIR)/pngwtran.o \
	$(OBJDIR)/pngwutil.o \
	$(EOLIST)

ZLIBOBJS	= \
	$(OBJDIR)/adler32.o \
	$(OBJDIR)/compress.o \
	$(OBJDIR)/crc32.o \
	$(OBJDIR)/deflate.o \
	$(OBJDIR)/inflate.o \
	$(OBJDIR)/inffast.o \
	$(OBJDIR)/inftrees.o \
	$(OBJDIR)/trees.o \
	$(OBJDIR)/zutil.o \
	$(EOLIST)
ifeq "$(wildcard $(ZLIBSDK)/infblock.c)" "$(ZLIBSDK)/infblock.c"
ZLIBOBJS	+= \
	$(OBJDIR)/infblock.o \
	$(OBJDIR)/infcodes.o \
	$(OBJDIR)/infutil.o \
	$(EOLIST)
endif

OBJS	= $(GDOBJS) $(PNGOBJS) $(ZLIBOBJS) $(OBJDIR)/$(TARGET).o
ifndef NO_OWN_STRFTIME
	OBJS	+= $(OBJDIR)/strftime.o
	DEFS	= -Dstrftime=strftime_
endif


all: $(OBJDIR) $(OBJDIR)/$(TARGET).exe

dist: all $(OBJDIR)/readme.txt
	-$(RM) $(OBJDIR)/*.o $(OBJDIR)/$(TARGET).map $(OBJDIR)/$(TARGET).ncv
	-$(RM) $(OBJDIR)/$(TARGET).def $(OBJDIR)/$(TARGET).res $(OBJDIR)/$(TARGET).rc
	-$(RM) $(OBJDIR)/version.inc
	@-$(CP) -a COPYRIGHT $(OBJDIR)
	@echo Creating $(ARCHIVE)
	@$(ZIP) $(ARCHIVE) $(OBJDIR)/* < $(OBJDIR)/readme.txt

install: all
	@[ -d $(INSTDIR) ] || mkdir $(INSTDIR)
	@$(CP) $(TARGET).exe $(INSTDIR)

clean:
	-$(RM) -r $(OBJDIR)

cleandist: clean
	-$(RM) $(ARCHIVE)

$(OBJDIR):
	@mkdir $(OBJDIR)

$(OBJDIR)/version.inc: $(TARGET).c $(OBJDIR)
	@echo Creating $@
	@awk -f get_ver.awk $< > $@

$(OBJDIR)/$(TARGET).o: $(TARGET).c
	@echo Compiling $<
	@$(CC) $(CFLAGS) $(DEFS) -c $< -o $@

$(OBJDIR)/%.o: %.c
	@echo Compiling $<
	@$(CC) $(CFLAGS) -c $< -o $@

$(OBJDIR)/$(TARGET).exe: $(OBJS) $(OBJDIR)/$(TARGET).res
	@echo Linking $@
	@-$(RM) $@
	@$(LD) $(LDFLAGS) $^ -o $@ $(LIBPATH) $(LIBFILES)

$(OBJDIR)/%.res: $(OBJDIR)/%.rc
	@echo Creating $@
	@$(RC) $(RCFLAGS) $< -o $@

$(OBJDIR)/%.rc: Makefile.Win32 $(OBJDIR)/version.inc 
	@echo 1 VERSIONINFO > $@
	@echo  FILEVERSION $(RATEUP_VERSION),0 >> $@
	@echo  PRODUCTVERSION $(RATEUP_VERSION),0 >> $@
	@echo  FILEFLAGSMASK 0x3fL >> $@
	@echo  FILEOS 0x40004L >> $@
	@echo  FILEFLAGS 0x0L >> $@
	@echo  FILETYPE 0x1L >> $@
	@echo  FILESUBTYPE 0x0L >> $@
	@echo BEGIN >> $@
	@echo   BLOCK "StringFileInfo" >> $@
	@echo   BEGIN >> $@
	@echo     BLOCK "040904E4" >> $@
	@echo     BEGIN >> $@
	@echo       VALUE "LegalCopyright","$(COPYR)\0" >> $@
#	@echo       VALUE "CompanyName","$(COMPANY)\0" >> $@
	@echo       VALUE "ProductName","$(TARGET).exe\0" >> $@
	@echo       VALUE "ProductVersion","$(RATEUP_VERSION_STR)\0" >> $@
	@echo       VALUE "License","Released under GPL.\0" >> $@
	@echo       VALUE "FileDescription","$(DESCR)\0" >> $@
	@echo       VALUE "FileVersion","$(RATEUP_VERSION_STR)\0" >> $@
	@echo       VALUE "InternalName","$(TARGET)\0" >> $@
	@echo       VALUE "OriginalFilename","$(TARGET).exe\0" >> $@
ifdef WWWURL
	@echo       VALUE "WWW","$(WWWURL)\0" >> $@
endif
	@echo     END >> $@
	@echo   END >> $@
	@echo   BLOCK "VarFileInfo" >> $@
	@echo   BEGIN >> $@
	@echo     VALUE "Translation", 0x409, 1252 >> $@
	@echo   END >> $@
	@echo END >> $@
ifdef LNKICON
	@echo 10 ICON DISCARDABLE "$(LNKICON)" >> $@
endif

$(OBJDIR)/readme.txt: Makefile.Win32
	@echo Creating $@
	@echo $(DL)This is a binary distribution for Win32 platform.$(DL) > $@
	@echo $(DL)MRTG rateup version $(RATEUP_VERSION_STR)$(DL) >> $@
	@echo $(DL)Please download the complete MRTG package for$(DL) >> $@
	@echo $(DL)any further documentation:$(DL) >> $@
	@echo $(DL)http://www.mrtg.org/$(DL) >> $@