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