1 # Gnu Makefile for Win32 target * 20-Aug-2005\r
2 # for use with MingW32 gcc or Metrowerks CodeWarrior compiler\r
3 # use with: make -f Makefile.Win32 [all|clean|dist]\r
4 \r
5 SOURCE = rrd_tool\r
6 #SOURCE = rrd_cgi\r
7 TARGET = $(subst _,,$(SOURCE))\r
8 #DESCR = Round Robin Database Tool $(RRD_VERSION_STR)\r
9 DESCR = Round Robin Database Tool\r
10 COPYR = Copyright (c) 1997-2005 by Tobias Oetiker\r
11 #WWWURL = http://ee-staff.ethz.ch/~oetiker/webtools/rrdtool/\r
12 WWWURL = http://www.rrdtool.org/\r
13 \r
14 # Edit the path below to point to your install destination.\r
15 # INSTDIR = /mnt/sys/mrtg/rrd\r
16 INSTDIR = c:/mrtg/rrd\r
17 \r
18 # Base for the lib sources\r
19 ifndef LIBBASE\r
20 LIBBASE = d:/projects/cw\r
21 endif\r
22 # All library code is statically linked to avoid problems with other lib NLMs. \r
23 # Edit the path below to point to your libgd sources or set environment var.\r
24 ifndef LIBGD\r
25 LIBGD = $(LIBBASE)/gd-2.0.15\r
26 endif\r
27 # Edit the path below to point to your libpng sources or set environment var.\r
28 ifndef LIBPNG\r
29 LIBPNG = $(LIBBASE)/libpng-1.2.8\r
30 endif\r
31 # Edit the path below to point to your freetype sources or set environment var.\r
32 ifndef LIBFT2\r
33 #LIBFT2 = $(LIBBASE)/freetype-2.1.9\r
34 LIBFT2 = $(LIBBASE)/../mingw32/freetype-2.1.9\r
35 endif\r
36 # Edit the path below to point to your freetype sources or set environment var.\r
37 ifndef LIBART\r
38 LIBART = $(LIBBASE)/libart_lgpl-2.3.3\r
39 endif\r
40 # Edit the path below to point to your zlib sources or set environment var.\r
41 ifndef ZLIBSDK\r
42 ZLIBSDK = $(LIBBASE)/zlib-1.2.3\r
43 endif\r
44 # Edit the path below to point to your zlib sources or set environment var.\r
45 ifndef LIBCGI\r
46 #LIBCGI = $(LIBBASE)/cgilib-0.4\r
47 LIBCGI = d:/rrdtool-1.0.50/cgilib-0.4\r
48 endif\r
49 \r
50 # The following line defines your compiler.\r
51 ifdef METROWERKS\r
52 CC = mwcc\r
53 else\r
54 CC = gcc\r
55 endif\r
56 # RM = rm -f\r
57 CP = cp -fv\r
58 \r
59 # must be equal to DEBUG or NDEBUG\r
60 DB = NDEBUG\r
61 # DB = DEBUG\r
62 # Optimization: -O<n> or debugging: -g\r
63 ifeq ($(DB),NDEBUG)\r
64 OPT = -O2\r
65 OBJDIR = release\r
66 else\r
67 OPT = -g\r
68 OBJDIR = debug\r
69 endif\r
70 \r
71 # Include the version info retrieved from source.\r
72 -include $(OBJDIR)/version.inc\r
73 \r
74 # Global flags for all compilers\r
75 CFLAGS = $(OPT) -D$(DB) -DHAVE_CONFIG_H\r
76 \r
77 ifeq ($(CC),mwcc)\r
78 LD = mwld\r
79 CFLAGS += -gccinc -msgstyle gcc -inline off -opt nointrinsics -inst mmx -proc 586\r
80 #CFLAGS += -w on,nounused,nounusedexpr\r
81 #CFLAGS += -ansi strict\r
82 CFLAGS += -ir "$(METROWERKS)/MSL" -ir "$(METROWERKS)/Win32-x86 Support"\r
83 LD = mwld\r
84 RC = mwwinrc\r
85 LDFLAGS = -nostdlib\r
86 LIBPATH += -lr "$(METROWERKS)/MSL" -lr "$(METROWERKS)/Win32-x86 Support"\r
87 LDLIBS += -lkernel32.lib -luser32.lib\r
88 LDLIBS += -lMSL_Runtime_x86.lib -lMSL_C_x86.lib -lMSL_Extras_x86.lib\r
89 LIBEXT = lib\r
90 RCFLAGS =\r
91 else\r
92 LD = gcc\r
93 RC = windres\r
94 LDFLAGS = -s\r
95 LIBEXT = a\r
96 RCFLAGS = -I rc -O coff -i\r
97 CFLAGS += -fno-strict-aliasing -Wall -Wno-format -Wno-unused # -pedantic\r
98 endif\r
99 \r
100 ifndef COPYR\r
101 COPYR = Copyright (c) 2005 The Open Source Community.\r
102 endif\r
103 ifndef DESCR\r
104 DESCR = $(TARGET) Command Extension\r
105 endif\r
106 DESCR += - $(CC) build\r
107 \r
108 INCLUDES += -I. -I$(LIBGD) -I$(LIBPNG) -I$(LIBFT2)/include -I$(LIBART) -I$(ZLIBSDK)\r
109 ifeq ($(SOURCE),rrd_cgi)\r
110 INCLUDES += -I$(LIBCGI)\r
111 endif\r
112 \r
113 CFLAGS += $(INCLUDES)\r
114 \r
115 vpath %.c . $(LIBGD) $(LIBPNG) $(LIBART)/libart_lgpl $(ZLIBSDK) $(LIBCGI)\r
116 \r
117 RRDLIBOBJS = \\r
118 $(OBJDIR)/rrd_afm.o \\r
119 $(OBJDIR)/rrd_afm_data.o \\r
120 $(OBJDIR)/rrd_create.o \\r
121 $(OBJDIR)/rrd_diff.o \\r
122 $(OBJDIR)/rrd_dump.o \\r
123 $(OBJDIR)/rrd_error.o \\r
124 $(OBJDIR)/rrd_fetch.o \\r
125 $(OBJDIR)/rrd_first.o \\r
126 $(OBJDIR)/rrd_format.o \\r
127 $(OBJDIR)/rrd_gfx.o \\r
128 $(OBJDIR)/rrd_graph.o \\r
129 $(OBJDIR)/rrd_graph_helper.o \\r
130 $(OBJDIR)/rrd_hw.o \\r
131 $(OBJDIR)/rrd_info.o \\r
132 $(OBJDIR)/rrd_last.o \\r
133 $(OBJDIR)/rrd_nan_inf.o \\r
134 $(OBJDIR)/rrd_open.o \\r
135 $(OBJDIR)/rrd_resize.o \\r
136 $(OBJDIR)/rrd_restore.o \\r
137 $(OBJDIR)/rrd_rpncalc.o \\r
138 $(OBJDIR)/rrd_tune.o \\r
139 $(OBJDIR)/rrd_update.o \\r
140 $(OBJDIR)/rrd_version.o \\r
141 $(OBJDIR)/rrd_xport.o \\r
142 $(OBJDIR)/rrd_not_thread_safe.o \\r
143 $(EOLIST)\r
144 \r
145 XLIBOBJS = \\r
146 $(OBJDIR)/art_rgba_svp.o \\r
147 $(OBJDIR)/getopt.o \\r
148 $(OBJDIR)/getopt1.o \\r
149 $(OBJDIR)/hash_32.o \\r
150 $(OBJDIR)/parsetime.o \\r
151 $(OBJDIR)/pngsize.o \\r
152 $(OBJDIR)/strftime.o \\r
153 $(EOLIST)\r
154 \r
155 GD2LIBOBJS = \\r
156 $(OBJDIR)/gd.o \\r
157 $(OBJDIR)/gd_io.o \\r
158 $(OBJDIR)/gd_io_dp.o \\r
159 $(OBJDIR)/gd_io_file.o \\r
160 $(OBJDIR)/gd_io_ss.o \\r
161 $(OBJDIR)/gd_png.o \\r
162 $(OBJDIR)/gd_ss.o \\r
163 $(OBJDIR)/gdcache.o \\r
164 $(OBJDIR)/gdfonts.o \\r
165 $(OBJDIR)/gdhelpers.o \\r
166 $(OBJDIR)/gdtables.o \\r
167 $(EOLIST)\r
168 \r
169 PNGLIBOBJS = \\r
170 $(OBJDIR)/png.o \\r
171 $(OBJDIR)/pngerror.o \\r
172 $(OBJDIR)/pngget.o \\r
173 $(OBJDIR)/pngmem.o \\r
174 $(OBJDIR)/pngpread.o \\r
175 $(OBJDIR)/pngread.o \\r
176 $(OBJDIR)/pngrio.o \\r
177 $(OBJDIR)/pngrtran.o \\r
178 $(OBJDIR)/pngrutil.o \\r
179 $(OBJDIR)/pngset.o \\r
180 $(OBJDIR)/pngtrans.o \\r
181 $(OBJDIR)/pngwio.o \\r
182 $(OBJDIR)/pngwrite.o \\r
183 $(OBJDIR)/pngwtran.o \\r
184 $(OBJDIR)/pngwutil.o \\r
185 $(EOLIST)\r
186 ifeq "$(wildcard $(LIBPNG)/pnggccrd.c)" "$(LIBPNG)/pnggccrd.c"\r
187 PNGLIBOBJS += \\r
188 $(OBJDIR)/pnggccrd.o \\r
189 $(OBJDIR)/pngvcrd.o \\r
190 $(EOLIST)\r
191 endif\r
192 \r
193 ZLIBOBJS = \\r
194 $(OBJDIR)/adler32.o \\r
195 $(OBJDIR)/compress.o \\r
196 $(OBJDIR)/crc32.o \\r
197 $(OBJDIR)/deflate.o \\r
198 $(OBJDIR)/inflate.o \\r
199 $(OBJDIR)/inffast.o \\r
200 $(OBJDIR)/inftrees.o \\r
201 $(OBJDIR)/trees.o \\r
202 $(OBJDIR)/zutil.o \\r
203 $(EOLIST)\r
204 ifeq "$(wildcard $(ZLIBSDK)/infblock.c)" "$(ZLIBSDK)/infblock.c"\r
205 ZLIBOBJS += \\r
206 $(OBJDIR)/infblock.o \\r
207 $(OBJDIR)/infcodes.o \\r
208 $(OBJDIR)/infutil.o \\r
209 $(EOLIST)\r
210 endif\r
211 \r
212 ARTLIBOBJS = \\r
213 $(patsubst $(LIBART)/libart_lgpl/%.c,$(OBJDIR)/%.o,$(wildcard $(LIBART)/libart_lgpl/art_*.c))\r
214 \r
215 OBJS = $(RRDLIBOBJS) $(XLIBOBJS) $(GD2LIBOBJS) $(PNGLIBOBJS) $(ARTLIBOBJS) $(ZLIBOBJS)\r
216 ifeq ($(SOURCE),rrd_cgi)\r
217 OBJS += $(OBJDIR)/cgi.o\r
218 endif\r
219 OBJS += $(OBJDIR)/$(SOURCE).o\r
220 \r
221 LDLIBS = $(LIBFT2)/objs/freetype.$(LIBEXT)\r
222 \r
223 \r
224 all: $(OBJDIR) config.h $(OBJDIR)/$(TARGET).exe\r
225 \r
226 dist: all\r
227 -$(RM) $(OBJDIR)/*.o $(OBJDIR)/$(TARGET).map $(OBJDIR)/$(TARGET).ncv\r
228 -$(RM) $(OBJDIR)/$(TARGET).def $(OBJDIR)/$(TARGET).res\r
229 \r
230 install: all\r
231 @[ -d $(INSTDIR) ] || mkdir $(INSTDIR)\r
232 @$(CP) $(TARGET).exe $(INSTDIR)\r
233 \r
234 clean:\r
235 -$(RM) -r $(OBJDIR)\r
236 -$(RM) config.h\r
237 \r
238 $(OBJDIR):\r
239 @mkdir $(OBJDIR)\r
240 \r
241 $(OBJDIR)/version.inc: ../configure $(OBJDIR) get_ver.awk\r
242 @echo Creating $@\r
243 @awk -f get_ver.awk $< > $@\r
244 \r
245 $(OBJDIR)/%.o: %.c\r
246 @echo Compiling $<\r
247 @$(CC) $(CFLAGS) -c $< -o $@\r
248 \r
249 $(OBJDIR)/$(TARGET).exe: $(OBJS) $(OBJDIR)/$(TARGET).res\r
250 @echo Linking $@\r
251 @-$(RM) $@\r
252 @$(LD) $(LDFLAGS) $^ -o $@ $(LIBPATH) $(LDLIBS)\r
253 \r
254 $(OBJDIR)/%.res: $(OBJDIR)/%.rc\r
255 @echo Creating $@\r
256 @$(RC) $(RCFLAGS) $< -o $@\r
257 \r
258 $(OBJDIR)/%.rc: Makefile.Win32 $(OBJDIR)/version.inc \r
259 @echo 1 VERSIONINFO > $@\r
260 @echo FILEVERSION $(RRD_VERSION),0 >> $@\r
261 @echo PRODUCTVERSION $(RRD_VERSION),0 >> $@\r
262 @echo FILEFLAGSMASK 0x3fL >> $@\r
263 @echo FILEOS 0x40004L >> $@\r
264 @echo FILEFLAGS 0x0L >> $@\r
265 @echo FILETYPE 0x1L >> $@\r
266 @echo FILESUBTYPE 0x0L >> $@\r
267 @echo BEGIN >> $@\r
268 @echo BLOCK "StringFileInfo" >> $@\r
269 @echo BEGIN >> $@\r
270 @echo BLOCK "040904E4" >> $@\r
271 @echo BEGIN >> $@\r
272 @echo VALUE "LegalCopyright","$(COPYR)\0" >> $@\r
273 # @echo VALUE "CompanyName","$(COMPANY)\0" >> $@\r
274 @echo VALUE "ProductName","$(TARGET).exe\0" >> $@\r
275 @echo VALUE "ProductVersion","$(RRD_VERSION_STR)\0" >> $@\r
276 @echo VALUE "License","Released under GPL.\0" >> $@\r
277 @echo VALUE "FileDescription","$(DESCR)\0" >> $@\r
278 @echo VALUE "FileVersion","$(RRD_VERSION_STR)\0" >> $@\r
279 @echo VALUE "InternalName","$(TARGET)\0" >> $@\r
280 @echo VALUE "OriginalFilename","$(TARGET).exe\0" >> $@\r
281 ifdef WWWURL\r
282 @echo VALUE "WWW","$(WWWURL)\0" >> $@\r
283 endif\r
284 @echo END >> $@\r
285 @echo END >> $@\r
286 @echo BLOCK "VarFileInfo" >> $@\r
287 @echo BEGIN >> $@\r
288 @echo VALUE "Translation", 0x409, 1252 >> $@\r
289 @echo END >> $@\r
290 @echo END >> $@\r
291 ifdef ICON\r
292 @echo 1 ICON DISCARDABLE "$(ICON)" >> $@\r
293 endif\r
294 \r
295 config.h: Makefile.Win32 $(OBJDIR)/version.inc\r
296 @echo Creating $@\r
297 @echo $(DL)/* $@ for NetWare target.$(DL) > $@\r
298 @echo $(DL)** Do not edit this file - it is created by make!$(DL) >> $@\r
299 @echo $(DL)** All your changes will be lost!!$(DL) >> $@\r
300 @echo $(DL)*/$(DL) >> $@\r
301 @echo $(DL)#define OS "i586-pc-Win32"$(DL) >> $@\r
302 @echo $(DL)#define PACKAGE_VERSION "$(RRD_VERSION_STR)"$(DL) >> $@\r
303 @echo $(DL)#define PACKAGE_BUGREPORT "tobi@oetiker.ch"$(DL) >> $@\r
304 @echo $(DL)#define NUMVERS $(RRD_NUMVERS)$(DL) >> $@\r
305 @echo $(DL)#define HAVE_ASSERT_H 1$(DL) >> $@\r
306 @echo $(DL)#define HAVE_DLFCN_H 1$(DL) >> $@\r
307 @echo $(DL)#define HAVE_DLOPEN 1$(DL) >> $@\r
308 @echo $(DL)#define HAVE_ERR_H 1$(DL) >> $@\r
309 @echo $(DL)#define HAVE_ERRNO_H 1$(DL) >> $@\r
310 @echo $(DL)#define HAVE_FCNTL_H 1$(DL) >> $@\r
311 @echo $(DL)#define HAVE_FIONBIO 1$(DL) >> $@\r
312 # @echo $(DL)#define HAVE_GETTIMEOFDAY 1$(DL) >> $@\r
313 @echo $(DL)#define HAVE_INTTYPES_H 1$(DL) >> $@\r
314 @echo $(DL)#define HAVE_LIMITS_H 1$(DL) >> $@\r
315 @echo $(DL)#define HAVE_LONGLONG 1$(DL) >> $@\r
316 @echo $(DL)#define HAVE_LOCALE_H 1$(DL) >> $@\r
317 @echo $(DL)#define HAVE_MALLOC_H 1$(DL) >> $@\r
318 @echo $(DL)#define HAVE_MATH_H 1$(DL) >> $@\r
319 @echo $(DL)#define HAVE_MBSTOWCS 1$(DL) >> $@\r
320 @echo $(DL)#define HAVE_SELECT 1$(DL) >> $@\r
321 @echo $(DL)#define HAVE_SETJMP_H 1$(DL) >> $@\r
322 # @echo $(DL)#define HAVE_SIGNAL 1$(DL) >> $@\r
323 @echo $(DL)#define HAVE_SNPRINTF 1$(DL) >> $@\r
324 @echo $(DL)#define HAVE_STDARG_H 1$(DL) >> $@\r
325 @echo $(DL)#define HAVE_STDDEF_H 1$(DL) >> $@\r
326 @echo $(DL)#define HAVE_STDINT_H 1$(DL) >> $@\r
327 @echo $(DL)#define HAVE_STDLIB_H 1$(DL) >> $@\r
328 # @echo $(DL)#define HAVE_STRCASECMP 1$(DL) >> $@\r
329 @echo $(DL)#define HAVE_STRDUP 1$(DL) >> $@\r
330 @echo $(DL)#define HAVE_STRFTIME 1$(DL) >> $@\r
331 @echo $(DL)#define HAVE_STRING_H 1$(DL) >> $@\r
332 @echo $(DL)#define HAVE_STRLCAT 1$(DL) >> $@\r
333 @echo $(DL)#define HAVE_STRLCPY 1$(DL) >> $@\r
334 @echo $(DL)#define HAVE_STRSTR 1$(DL) >> $@\r
335 @echo $(DL)#define HAVE_SYS_PARAM_H 1$(DL) >> $@\r
336 @echo $(DL)#define HAVE_SYS_SELECT_H 1$(DL) >> $@\r
337 @echo $(DL)#define HAVE_SYS_STAT_H 1$(DL) >> $@\r
338 @echo $(DL)#define HAVE_SYS_TIME_H 1$(DL) >> $@\r
339 @echo $(DL)#define HAVE_TERMIOS_H 1$(DL) >> $@\r
340 @echo $(DL)#define HAVE_TIME_H 1$(DL) >> $@\r
341 @echo $(DL)#define HAVE_UNAME 1$(DL) >> $@\r
342 # @echo $(DL)#define HAVE_UNISTD_H 1$(DL) >> $@\r
343 @echo $(DL)#define STDC_HEADERS 1$(DL) >> $@\r
344 @echo $(DL)#define TIME_WITH_SYS_TIME 1$(DL) >> $@\r
345 @echo $(DL)#define HAVE_ZLIB_H 1$(DL) >> $@\r
346 @echo $(DL)#define HAVE_LIBZ 1$(DL) >> $@\r
347 @echo $(DL)#define rrd_realloc(a,b) realloc((a), (b))$(DL) >> $@\r
348 @echo $(DL)#define RRDGRAPH_YLEGEND_ANGLE 90.0$(DL) >> $@\r
349 \r
350 \r