make sure the image size only gets printed from rrd_tool when --imageinfo is NOT...
[rrdtool.git] / src / Makefile.NetWare
1 # Gnu Makefile for NetWare target * 14-Jan-2006
2 # for use with gcc/nlmconv or Metrowerks CodeWarrior compiler
3 # use with: make -f Makefile.NetWare [all|clean|dist] [BINEXT=cgi]
4
5 # What to build
6 ifndef BINEXT
7 BINEXT  = nlm
8 endif
9
10 DESCR   = Round Robin Database Tool $(RRD_VERSION_STR)
11 COPYR   = Copyright (c) 1997-2006 by Tobias Oetiker
12 #WWWURL = http://ee-staff.ethz.ch/~oetiker/webtools/rrdtool/
13 WWWURL  = http://www.rrdtool.org/
14 MTSAFE  = YES
15 #SCREEN = $(TARGET)
16 STACK   = 65535
17 # Comment the line below if you dont want to load protected automatically.
18 #LDRING = 3
19
20 # Set the default font used in graphs.
21 RRD_DEFAULT_FONT = "arial.ttf"
22
23 # Vertical label angle: 90.0 (default) or 270.0
24 RRDGRAPH_YLEGEND_ANGLE = 90.0
25
26 # Edit the path below to point to your Novell NDK.
27 ifndef NDKBASE
28 NDKBASE = c:/novell
29 endif
30 # Edit the path below to point to your install destination.
31 # INSTDIR = /mnt/sys/mrtg/rrd
32 INSTDIR = s:/mrtg/rrd
33
34 # Base for the lib sources
35 ifndef LIBBASE
36 LIBBASE = ../..
37 endif
38 # All library code is statically linked to avoid problems with other lib NLMs. 
39 # Edit the path below to point to your libpng sources or set environment var.
40 ifndef LIBPNG
41 LIBPNG  = $(LIBBASE)/libpng-1.2.8
42 endif
43 # Edit the path below to point to your freetype sources or set environment var.
44 ifndef LIBFT2
45 LIBFT2  = $(LIBBASE)/freetype-2.1.9
46 endif
47 # Edit the path below to point to your freetype sources or set environment var.
48 ifndef LIBART
49 LIBART  = $(LIBBASE)/libart_lgpl-2.3.17
50 endif
51 # Edit the path below to point to your zlib sources or set environment var.
52 ifndef ZLIBSDK
53 ZLIBSDK = $(LIBBASE)/zlib-1.2.3
54 endif
55 # Edit the path below to point to your zlib sources or set environment var.
56 ifndef LIBCGI
57 LIBCGI  = $(LIBBASE)/cgilib-0.5
58 endif
59
60 # whatever...
61 # NO_NULL_REALLOC = 1
62
63 # Edit the var below to point to your lib architecture.
64 ifndef LIBARCH
65 # LIBARCH = CLIB
66 LIBARCH = LIBC
67 endif
68
69 # The following line defines your compiler.
70 ifdef METROWERKS
71         CC = mwccnlm
72 else
73         CC = gcc
74 endif
75 # RM    = rm -f
76 CP      = cp -afv
77 # if you want to mark the target as MTSAFE you will need a tool for
78 # generating the xdc data for the linker; here's a minimal tool:
79 # http://www.gknw.com/development/prgtools/mkxdc.zip
80 MPKXDC  = mkxdc
81
82 # must be equal to DEBUG or NDEBUG
83 DB      = NDEBUG
84 # DB    = DEBUG
85 # Optimization: -O<n> or debugging: -g
86 ifeq ($(DB),NDEBUG)
87         OPT     = -O2
88         OBJDIR  = release
89 else
90         OPT     = -g
91         OBJDIR  = debug
92 endif
93
94 # Include the version info retrieved from source.
95 -include $(OBJDIR)/version.inc
96
97 # Global flags for all compilers
98 CFLAGS  = $(OPT) -D$(DB) -nostdinc -DNETWARE -DN_PLAT_NLM -D_POSIX_SOURCE
99 CFLAGS  += -DHAVE_CONFIG_H
100
101 ifeq ($(CC),mwccnlm)
102 LD      = mwldnlm
103 LDFLAGS = -nostdlib $(PRELUDE) $(OBJS) $(LDLIBS) -o $(OBJDIR)/$(TARGET).nlm -commandfile
104 LIBEXT  = lib
105 CFLAGS  += -gccinc -inline off -opt nointrinsics -proc 586
106 CFLAGS  += -relax_pointers
107 #CFLAGS += -w on,nounused,nounusedexpr # -ansi strict
108 ifeq ($(LIBARCH),LIBC)
109         PRELUDE = $(SDK_LIBC)/imports/libcpre.o
110         CFLAGS += -align 4
111 else
112         PRELUDE = "$(METROWERKS)/Novell Support/libraries/runtime/prelude.obj"
113         CFLAGS += -include "$(METROWERKS)/Novell Support/headers/nlm_prefix.h"
114         CFLAGS += -align 1
115 endif
116 else
117 LD      = nlmconv
118 LDFLAGS = -T
119 LIBEXT  = a
120 CFLAGS  += -fno-builtin -fpack-struct -fpcc-struct-return -fno-strict-aliasing
121 CFLAGS  += -Wall -Wno-unused # -pedantic
122 ifeq ($(LIBARCH),LIBC)
123         PRELUDE = $(SDK_LIBC)/imports/libcpre.gcc.o
124 else
125         PRELUDE = $(NDK_ROOT)/pre/prelude.o
126         CFLAGS += -include $(NDKBASE)/nlmconv/genlm.h
127 endif
128 endif
129
130 ifeq ($(findstring linux,$(OSTYPE)),linux)
131 #include $(NDKBASE)/nlmconv/ncpfs.inc
132 DL      = '
133 endif
134
135 ifeq ($(MTSAFE),YES)
136         XDCOPT = -n
137 endif
138 ifeq ($(MTSAFE),NO)
139         XDCOPT = -u
140 endif
141 ifdef XDCOPT
142         XDCDATA = $(OBJDIR)/$(TARGET).xdc
143 endif
144 ifndef COPYR
145         COPYR = Copyright (c) 2006 The Open Source Community.
146 endif
147 ifndef DESCR
148         DESCR = $(TARGET) Command Extension
149 endif
150 DESCR += ($(LIBARCH)) - $(CC) build
151
152 NDK_ROOT = $(NDKBASE)/ndk
153 SDK_CLIB = $(NDK_ROOT)/nwsdk
154 SDK_LIBC = $(NDK_ROOT)/libc
155
156 INCLUDES = -I. -I$(LIBPNG) -I$(LIBFT2)/include -I$(LIBART) -I$(ZLIBSDK)
157 ifeq ($(BINEXT),cgi)
158 INCLUDES += -I$(LIBCGI)
159 endif
160 ifeq ($(LIBARCH),LIBC)
161         INCLUDES += -I$(SDK_LIBC)/include -I$(SDK_LIBC)/include/nks
162 else
163         INCLUDES += -I$(SDK_CLIB)/include/nlm -I$(SDK_CLIB)/include
164 endif
165
166 CFLAGS += $(INCLUDES)
167
168 vpath %.c . $(LIBPNG) $(LIBART)/libart_lgpl $(ZLIBSDK) $(LIBCGI)
169
170 RRDLIBOBJS      = \
171         $(OBJDIR)/rrd_afm.o \
172         $(OBJDIR)/rrd_afm_data.o \
173         $(OBJDIR)/rrd_create.o \
174         $(OBJDIR)/rrd_diff.o \
175         $(OBJDIR)/rrd_dump.o \
176         $(OBJDIR)/rrd_error.o \
177         $(OBJDIR)/rrd_fetch.o \
178         $(OBJDIR)/rrd_first.o \
179         $(OBJDIR)/rrd_format.o \
180         $(OBJDIR)/rrd_gfx.o \
181         $(OBJDIR)/rrd_graph.o \
182         $(OBJDIR)/rrd_graph_helper.o \
183         $(OBJDIR)/rrd_hw.o \
184         $(OBJDIR)/rrd_info.o \
185         $(OBJDIR)/rrd_last.o \
186         $(OBJDIR)/rrd_nan_inf.o \
187         $(OBJDIR)/rrd_open.o \
188         $(OBJDIR)/rrd_resize.o \
189         $(OBJDIR)/rrd_restore.o \
190         $(OBJDIR)/rrd_rpncalc.o \
191         $(OBJDIR)/rrd_tune.o \
192         $(OBJDIR)/rrd_update.o \
193         $(OBJDIR)/rrd_version.o \
194         $(OBJDIR)/rrd_xport.o \
195         $(OBJDIR)/rrd_thread_safe.o \
196         $(EOLIST)
197
198 XLIBOBJS        = \
199         $(OBJDIR)/art_rgba_svp.o \
200         $(OBJDIR)/getopt.o \
201         $(OBJDIR)/getopt1.o \
202         $(OBJDIR)/hash_32.o \
203         $(OBJDIR)/parsetime.o \
204         $(OBJDIR)/pngsize.o \
205         $(EOLIST)
206
207 PNGLIBOBJS      = \
208         $(OBJDIR)/png.o \
209         $(OBJDIR)/pngerror.o \
210         $(OBJDIR)/pngget.o \
211         $(OBJDIR)/pngmem.o \
212         $(OBJDIR)/pngpread.o \
213         $(OBJDIR)/pngread.o \
214         $(OBJDIR)/pngrio.o \
215         $(OBJDIR)/pngrtran.o \
216         $(OBJDIR)/pngrutil.o \
217         $(OBJDIR)/pngset.o \
218         $(OBJDIR)/pngtrans.o \
219         $(OBJDIR)/pngwio.o \
220         $(OBJDIR)/pngwrite.o \
221         $(OBJDIR)/pngwtran.o \
222         $(OBJDIR)/pngwutil.o \
223         $(EOLIST)
224 ifeq "$(wildcard $(LIBPNG)/pnggccrd.c)" "$(LIBPNG)/pnggccrd.c"
225 PNGLIBOBJS      += \
226         $(OBJDIR)/pnggccrd.o \
227         $(OBJDIR)/pngvcrd.o \
228         $(EOLIST)
229 endif
230
231 ZLIBOBJS        = \
232         $(OBJDIR)/adler32.o \
233         $(OBJDIR)/compress.o \
234         $(OBJDIR)/crc32.o \
235         $(OBJDIR)/deflate.o \
236         $(OBJDIR)/inflate.o \
237         $(OBJDIR)/inffast.o \
238         $(OBJDIR)/inftrees.o \
239         $(OBJDIR)/trees.o \
240         $(OBJDIR)/zutil.o \
241         $(EOLIST)
242 ifeq "$(wildcard $(ZLIBSDK)/infblock.c)" "$(ZLIBSDK)/infblock.c"
243 ZLIBOBJS        += \
244         $(OBJDIR)/infblock.o \
245         $(OBJDIR)/infcodes.o \
246         $(OBJDIR)/infutil.o \
247         $(EOLIST)
248 endif
249
250 CGIOBJS = \
251         $(OBJDIR)/cgi.o \
252         $(OBJDIR)/cookies.o \
253         $(EOLIST)
254
255 ARTLIBOBJS      = \
256         $(patsubst $(LIBART)/libart_lgpl/%.c,$(OBJDIR)/%.o,$(wildcard $(LIBART)/libart_lgpl/art_*.c))
257
258 OBJS    = $(RRDLIBOBJS) $(XLIBOBJS) $(PNGLIBOBJS) $(ARTLIBOBJS) $(ZLIBOBJS)
259
260 ifeq ($(BINEXT),cgi)
261 OBJS    += $(CGIOBJS) $(OBJDIR)/rrd_cgi.o
262 TARGET  = rrdcgi
263 else
264 OBJS    += $(OBJDIR)/rrd_tool.o
265 TARGET  = rrdtool
266 endif
267
268 LDLIBS  += $(LIBFT2)/builds/netware/libc/libft2.$(LIBEXT)
269
270
271 all: $(OBJDIR) config.h $(OBJDIR)/$(TARGET).$(BINEXT)
272
273 dist: all
274         -$(RM) $(OBJDIR)/*.o $(OBJDIR)/$(TARGET).map $(OBJDIR)/$(TARGET).ncv
275         -$(RM) $(OBJDIR)/$(TARGET).def $(XDCDATA)
276         -$(RM) config.h
277
278 install: all
279         @[ -d $(INSTDIR) ] || mkdir $(INSTDIR)
280         @$(CP) $(TARGET).$(BINEXT) $(INSTDIR)
281
282 clean:
283         -$(RM) -r $(OBJDIR)
284         -$(RM) config.h
285
286 $(OBJDIR):
287         @mkdir $(OBJDIR)
288
289 $(OBJDIR)/%.o: %.c
290         @echo Compiling $<
291         @$(CC) $(CFLAGS) -c $< -o $@
292
293 $(OBJDIR)/version.inc: ../configure.ac $(OBJDIR) get_ver.awk
294         @echo Creating $@
295         @awk -f get_ver.awk $< > $@
296
297 $(OBJDIR)/$(TARGET).$(BINEXT): $(OBJDIR) $(OBJS) $(OBJDIR)/version.inc $(OBJDIR)/$(TARGET).def $(XDCDATA)
298         @echo Linking $@
299         @-$(RM) $@
300         @$(LD) $(LDFLAGS) $(OBJDIR)/$(TARGET).def
301
302 $(OBJDIR)/%.xdc: Makefile.NetWare
303         @echo Creating $@
304         @$(MPKXDC) $(XDCOPT) $@
305
306 $(OBJDIR)/%.def: Makefile.NetWare $(OBJDIR)/version.inc
307         @echo $(DL)# DEF Linker File for use with gcc and nlmconv$(DL) > $@
308         @echo $(DL)# or with Codewarrior command line compiler.$(DL) >> $@
309         @echo $(DL)# Do not edit this file - it is created by make!$(DL) >> $@
310         @echo $(DL)# All your changes will be lost!!$(DL) >> $@
311         @echo $(DL)#$(DL) >> $@
312         @echo $(DL)copyright "$(COPYR)"$(DL) >> $@
313         @echo $(DL)description "$(DESCR)"$(DL) >> $@
314         @echo $(DL)version $(RRD_VERSION)$(DL) >> $@
315 ifdef NLMTYPE
316         @echo $(DL)type $(NLMTYPE)$(DL) >> $@
317 else
318         @echo $(DL)type 0$(DL) >> $@
319 endif
320 ifdef STACK
321         @echo $(DL)stack $(STACK)$(DL) >> $@
322 endif
323         @echo $(DL)threadname "$(TARGET)"$(DL) >> $@
324 ifdef SCREEN
325         @echo $(DL)screenname "$(SCREEN)"$(DL) >> $@
326 else
327         @echo $(DL)screenname "DEFAULT"$(DL) >> $@
328 endif
329 ifeq ($(DB),DEBUG)
330         @echo $(DL)debug$(DL) >> $@
331 endif
332 ifeq ($(LIBARCH),CLIB)
333         @echo $(DL)start _Prelude$(DL) >> $@
334         @echo $(DL)exit _Stop$(DL) >> $@
335         @echo $(DL)import @$(NDK_ROOT)/nwsdk/imports/clib.imp$(DL) >> $@
336         @echo $(DL)import @$(NDK_ROOT)/nwsdk/imports/threads.imp$(DL) >> $@
337         @echo $(DL)import @$(NDK_ROOT)/nwsdk/imports/nlmlib.imp$(DL) >> $@
338         @echo $(DL)module clib$(DL) >> $@
339 else
340         @echo $(DL)start _LibCPrelude$(DL) >> $@
341         @echo $(DL)exit _LibCPostlude$(DL) >> $@
342         @echo $(DL)check _LibCCheckUnload$(DL) >> $@
343         @echo $(DL)import @$(NDK_ROOT)/libc/imports/libc.imp$(DL) >> $@
344         @echo $(DL)import @$(NDK_ROOT)/libc/imports/netware.imp$(DL) >> $@
345         @echo $(DL)module libc$(DL) >> $@
346         @echo $(DL)pseudopreemption$(DL) >> $@
347         @echo $(DL)flag_on 64$(DL) >> $@
348 endif
349 ifeq ($(LDRING),0)
350         @echo $(DL)flag_on 16$(DL) >> $@
351 endif
352 ifeq ($(LDRING),3)
353         @echo $(DL)flag_on 512$(DL) >> $@
354 endif
355 ifdef XDCDATA
356         @echo $(DL)xdcdata $(XDCDATA)$(DL) >> $@
357 endif
358 ifeq ($(LD),nlmconv)
359         @echo $(DL)input $(OBJS) $(LDLIBS)$(DL) >> $@
360         @echo $(DL)input $(PRELUDE)$(DL) >> $@
361         @echo $(DL)output $(TARGET).nlm$(DL) >> $@
362 endif
363
364 config.h: Makefile.NetWare
365         @echo Creating $@
366         @echo $(DL)/* $@ for NetWare target.$(DL) > $@
367         @echo $(DL)** Do not edit this file - it is created by make!$(DL) >> $@
368         @echo $(DL)** All your changes will be lost!!$(DL) >> $@
369         @echo $(DL)*/$(DL) >> $@
370         @echo $(DL)#define OS "i586-pc-NetWare"$(DL) >> $@
371         @echo $(DL)#define PACKAGE_VERSION "$(RRD_VERSION_STR)"$(DL) >> $@
372         @echo $(DL)#define PACKAGE_BUGREPORT "tobi@oetiker.ch"$(DL) >> $@
373         @echo $(DL)#define NUMVERS $(RRD_NUMVERS)$(DL) >> $@
374         @echo $(DL)#define HAVE_ASSERT_H 1$(DL) >> $@
375         @echo $(DL)#define HAVE_DLFCN_H 1$(DL) >> $@
376         @echo $(DL)#define HAVE_DLOPEN 1$(DL) >> $@
377         @echo $(DL)#define HAVE_ERR_H 1$(DL) >> $@
378         @echo $(DL)#define HAVE_ERRNO_H 1$(DL) >> $@
379         @echo $(DL)#define HAVE_FCNTL_H 1$(DL) >> $@
380         @echo $(DL)#define HAVE_FIONBIO 1$(DL) >> $@
381         @echo $(DL)#define HAVE_FLOAT_H 1$(DL) >> $@
382         @echo $(DL)#define HAVE_GETTIMEOFDAY 1$(DL) >> $@
383         @echo $(DL)#define HAVE_INTTYPES_H 1$(DL) >> $@
384         @echo $(DL)#define HAVE_LIMITS_H 1$(DL) >> $@
385         @echo $(DL)#define HAVE_LONGLONG 1$(DL) >> $@
386         @echo $(DL)#define HAVE_LOCALE_H 1$(DL) >> $@
387         @echo $(DL)#define HAVE_MALLOC_H 1$(DL) >> $@
388         @echo $(DL)#define HAVE_MATH_H 1$(DL) >> $@
389         @echo $(DL)#define HAVE_MBSTOWCS 1$(DL) >> $@
390         @echo $(DL)#define HAVE_MEMMOVE 1$(DL) >> $@
391         @echo $(DL)#define HAVE_MKTIME 1$(DL) >> $@
392         @echo $(DL)#define HAVE_SELECT 1$(DL) >> $@
393         @echo $(DL)#define HAVE_SETLOCALE 1$(DL) >> $@
394         @echo $(DL)#define HAVE_SETJMP_H 1$(DL) >> $@
395 #       @echo $(DL)#define HAVE_SIGNAL 1$(DL) >> $@
396         @echo $(DL)#define HAVE_SNPRINTF 1$(DL) >> $@
397         @echo $(DL)#define HAVE_STDARG_H 1$(DL) >> $@
398         @echo $(DL)#define HAVE_STDDEF_H 1$(DL) >> $@
399         @echo $(DL)#define HAVE_STDINT_H 1$(DL) >> $@
400         @echo $(DL)#define HAVE_STDLIB_H 1$(DL) >> $@
401         @echo $(DL)#define HAVE_STRCASECMP 1$(DL) >> $@
402         @echo $(DL)#define HAVE_STRDUP 1$(DL) >> $@
403         @echo $(DL)#define HAVE_STRFTIME 1$(DL) >> $@
404         @echo $(DL)#define HAVE_STRING_H 1$(DL) >> $@
405         @echo $(DL)#define HAVE_STRLCAT 1$(DL) >> $@
406         @echo $(DL)#define HAVE_STRLCPY 1$(DL) >> $@
407         @echo $(DL)#define HAVE_STRSTR 1$(DL) >> $@
408         @echo $(DL)#define HAVE_SYS_PARAM_H 1$(DL) >> $@
409         @echo $(DL)#define HAVE_SYS_SELECT_H 1$(DL) >> $@
410         @echo $(DL)#define HAVE_SYS_STAT_H 1$(DL) >> $@
411         @echo $(DL)#define HAVE_SYS_TIME_H 1$(DL) >> $@
412         @echo $(DL)#define HAVE_SYS_TYPES_H 1$(DL) >> $@
413         @echo $(DL)#define HAVE_TERMIOS_H 1$(DL) >> $@
414         @echo $(DL)#define HAVE_TIME_H 1$(DL) >> $@
415         @echo $(DL)#define HAVE_TZSET 1$(DL) >> $@
416         @echo $(DL)#define HAVE_UNAME 1$(DL) >> $@
417         @echo $(DL)#define HAVE_VPRINTF 1$(DL) >> $@
418         @echo $(DL)#define HAVE_UNISTD_H 1$(DL) >> $@
419         @echo $(DL)#define STDC_HEADERS 1$(DL) >> $@
420         @echo $(DL)#define TIME_WITH_SYS_TIME 1$(DL) >> $@
421         @echo $(DL)#define HAVE_ZLIB_H 1$(DL) >> $@
422         @echo $(DL)#define HAVE_LIBZ 1$(DL) >> $@
423 ifdef NO_NULL_REALLOC
424         @echo $(DL)#define NO_NULL_REALLOC 1$(DL) >> $@
425         @echo $(DL)#define rrd_realloc(a,b) ( (a) == NULL ? malloc( (b) ) : realloc( (a) , (b) ))$(DL) >> $@
426 else
427         @echo $(DL)#define rrd_realloc(a,b) realloc((a), (b))$(DL) >> $@
428 endif
429         @echo $(DL)#define RRDGRAPH_YLEGEND_ANGLE $(RRDGRAPH_YLEGEND_ANGLE)$(DL) >> $@
430         @echo $(DL)#define RRD_DEFAULT_FONT $(RRD_DEFAULT_FONT)$(DL) >> $@
431
432 $(OBJDIR)/readme.txt: Makefile.NetWare
433         @echo Creating $@
434         @echo $(DL)This is a binary distribution for NetWare platform.$(DL) > $@
435         @echo $(DL)MRTG rrdtool version $(RRD_VERSION_STR)$(DL) >> $@
436         @echo $(DL)Please download the complete RRD package for$(DL) >> $@
437         @echo $(DL)any further documentation:$(DL) >> $@
438         @echo $(DL)http://www.rrdtool.org/$(DL) >> $@
439
440