-# Gnu Makefile for NetWare target * 20-Aug-2005
+# Gnu Makefile for NetWare target * 17-Aug-2006
# for use with gcc/nlmconv or Metrowerks CodeWarrior compiler
-# use with: make -f Makefile.NetWare [all|clean|dist]
+# use with: make -f Makefile.NetWare [all|clean|dist|distclean|help]
-SOURCE = rrd_tool
-#SOURCE = rrd_cgi
-TARGET = $(subst _,,$(SOURCE))
DESCR = Round Robin Database Tool $(RRD_VERSION_STR)
-COPYR = Copyright (c) 1997-2005 by Tobias Oetiker
+COPYR = Copyright (c) 1997-2006 by Tobias Oetiker
#WWWURL = http://ee-staff.ethz.ch/~oetiker/webtools/rrdtool/
WWWURL = http://www.rrdtool.org/
MTSAFE = YES
-#SCREEN = $(TARGET)
-STACK = 49152
+#SCREEN = $(DESCR)
+STACK = 65535
# Comment the line below if you dont want to load protected automatically.
#LDRING = 3
+# Set the default font used in graphs.
+ifndef RRD_DEFAULT_FONT
+#RRD_DEFAULT_FONT = "sys:/java/nwgfx/lib/x11/fonts/ttf/tt0003m_.ttf"
+RRD_DEFAULT_FONT = "DejaVuSansMono-Roman.ttf"
+#RRD_DEFAULT_FONT = "VeraMono.ttf"
+endif
+
# Vertical label angle: 90.0 (default) or 270.0
RRDGRAPH_YLEGEND_ANGLE = 90.0
+# Set to one if you want to have piecharts.
+WITH_PIECHART = 1
+
+# Set the extension used for rrdcgi.
+ifndef CGIEXT
+CGIEXT = nlm
+endif
+
# Edit the path below to point to your Novell NDK.
ifndef NDKBASE
NDKBASE = c:/novell
endif
-# Edit the path below to point to your install destination.
-# INSTDIR = /mnt/sys/mrtg/rrd
-INSTDIR = s:/mrtg/rrd
# Base for the lib sources
ifndef LIBBASE
-LIBBASE = ..
-endif
-# All library code is statically linked to avoid problems with other lib NLMs.
-# Edit the path below to point to your libgd sources or set environment var.
-ifndef LIBGD
-LIBGD = $(LIBBASE)/gd-2.0.33
+LIBBASE = ../..
endif
+# All library code is statically linked to avoid problems with other lib NLMs.
# Edit the path below to point to your libpng sources or set environment var.
ifndef LIBPNG
-LIBPNG = $(LIBBASE)/libpng-1.2.8
+LIBPNG = $(LIBBASE)/libpng-1.2.12
endif
# Edit the path below to point to your freetype sources or set environment var.
ifndef LIBFT2
-LIBFT2 = $(LIBBASE)/freetype-2.1.9
+LIBFT2 = $(LIBBASE)/freetype-2.2.1
endif
-# Edit the path below to point to your freetype sources or set environment var.
+# Edit the path below to point to your libart sources or set environment var.
ifndef LIBART
-LIBART = $(LIBBASE)/libart_lgpl-2.3.3
+LIBART = $(LIBBASE)/libart_lgpl-2.3.17
endif
# Edit the path below to point to your zlib sources or set environment var.
ifndef ZLIBSDK
ZLIBSDK = $(LIBBASE)/zlib-1.2.3
endif
-# Edit the path below to point to your zlib sources or set environment var.
-ifndef LIBCGI
-#LIBCGI = $(LIBBASE)/cgilib-0.4
-LIBCGI = d:/rrdtool-1.0.50/cgilib-0.4
+
+# Edit the path below to point to your distribution folder.
+ifndef DISTDIR
+DISTDIR = rrdtool-$(RRD_VERSION_STR)-nw
endif
+ARCHIVE = $(DISTDIR).zip
+
+# whatever...
+# NO_NULL_REALLOC = 1
# Edit the var below to point to your lib architecture.
ifndef LIBARCH
CC = gcc
endif
# RM = rm -f
-CP = cp -fv
+CP = cp -afv
# if you want to mark the target as MTSAFE you will need a tool for
# generating the xdc data for the linker; here's a minimal tool:
-# http://www.gknw.com/development/prgtools/mkxdc.zip
+# http://www.gknw.net/development/prgtools/mkxdc.zip
MPKXDC = mkxdc
+# CodeWarrior is too stupid to set the internal name properly when
+# the extension is not a NLM and not a registered type. So we need
+# to fix that after linking (since CGI isnt a known type - argh!):
+# http://www.gknw.net/development/prgtools/fixnlmname.zip
+FIXNLMN = fixnlmname #-q
+# Here you can find a native Win32 binary of the original awk:
+# http://www.gknw.net/development/prgtools/awk.zip
+AWK = awk
+ZIP = zip -qzR9
# must be equal to DEBUG or NDEBUG
DB = NDEBUG
# Global flags for all compilers
CFLAGS = $(OPT) -D$(DB) -nostdinc -DNETWARE -DN_PLAT_NLM -D_POSIX_SOURCE
-CFLAGS += -DHAVE_CONFIG_H=1
-#CFLAGS += -DHAVE_LIBPNG
-
-CP = cp -af
+CFLAGS += -DHAVE_CONFIG_H
ifeq ($(CC),mwccnlm)
LD = mwldnlm
-LDFLAGS = -nostdlib $(PRELUDE) $(OBJS) $(LIBS) -o $(OBJDIR)/$(TARGET).nlm -commandfile
+LDFLAGS = -nostdlib $^ $(PRELUDE) $(LDLIBS) -o $@ -commandfile
+AR = $(LD)
+ARFLAGS = -type library -w nocmdline $(OBJS) -o
+LIBEXT = lib
CFLAGS += -gccinc -inline off -opt nointrinsics -proc 586
CFLAGS += -relax_pointers
-#CFLAGS += -w on,nounused,nounusedexpr -ansi strict
+#CFLAGS += -w on,nounused,nounusedexpr # -ansi strict
ifeq ($(LIBARCH),LIBC)
PRELUDE = $(SDK_LIBC)/imports/libcpre.o
CFLAGS += -align 4
else
LD = nlmconv
LDFLAGS = -T
-CFLAGS += -fno-builtin -fpack-struct -fpcc-struct-return
+AR = ar
+ARFLAGS = -cq
+LIBEXT = a
+CFLAGS += -fno-builtin -fpack-struct -fpcc-struct-return -fno-strict-aliasing
CFLAGS += -Wall -Wno-unused # -pedantic
ifeq ($(LIBARCH),LIBC)
PRELUDE = $(SDK_LIBC)/imports/libcpre.gcc.o
ifeq ($(MTSAFE),NO)
XDCOPT = -u
endif
-ifdef XDCOPT
- XDCDATA = $(OBJDIR)/$(TARGET).xdc
-endif
ifndef COPYR
- COPYR = Copyright (c) 2005 The Open Source Community.
+ COPYR = Copyright (c) 2006 The Open Source Community.
endif
ifndef DESCR
- DESCR = $(TARGET) Command Extension
+ DESCR = $(notdir $(@:.def=)) Command Extension
endif
DESCR += ($(LIBARCH)) - $(CC) build
SDK_CLIB = $(NDK_ROOT)/nwsdk
SDK_LIBC = $(NDK_ROOT)/libc
+INCLUDES = -I. -I$(LIBPNG) -I$(LIBFT2)/include -I$(LIBART) -I$(ZLIBSDK)
+
ifeq ($(LIBARCH),LIBC)
- INCLUDES = -I$(SDK_LIBC)/include -I$(SDK_LIBC)/include/nks
+ INCLUDES += -I$(SDK_LIBC)/include -I$(SDK_LIBC)/include/nks
else
- INCLUDES = -I$(SDK_CLIB)/include/nlm -I$(SDK_CLIB)/include
-endif
-
-INCLUDES += -I. -I$(LIBGD) -I$(LIBPNG) -I$(LIBFT2)/include -I$(LIBART) -I$(ZLIBSDK)
-ifeq ($(SOURCE),rrd_cgi)
-INCLUDES += -I$(LIBCGI)
+ INCLUDES += -I$(SDK_CLIB)/include/nlm -I$(SDK_CLIB)/include
endif
CFLAGS += $(INCLUDES)
-vpath %.c . $(LIBGD) $(LIBPNG) $(LIBART)/libart_lgpl $(ZLIBSDK) $(LIBCGI)
+vpath %.c . $(LIBPNG) $(LIBART)/libart_lgpl $(ZLIBSDK)
RRDLIBOBJS = \
$(OBJDIR)/rrd_afm.o \
$(OBJDIR)/pngsize.o \
$(EOLIST)
-GD2LIBOBJS = \
- $(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)
-
PNGLIBOBJS = \
$(OBJDIR)/png.o \
$(OBJDIR)/pngerror.o \
ARTLIBOBJS = \
$(patsubst $(LIBART)/libart_lgpl/%.c,$(OBJDIR)/%.o,$(wildcard $(LIBART)/libart_lgpl/art_*.c))
-OBJS = $(RRDLIBOBJS) $(XLIBOBJS) $(GD2LIBOBJS) $(PNGLIBOBJS) $(ARTLIBOBJS) $(ZLIBOBJS)
-ifeq ($(SOURCE),rrd_cgi)
-OBJS += $(OBJDIR)/cgi.o
-endif
-OBJS += $(OBJDIR)/$(SOURCE).o
+OBJS := $(RRDLIBOBJS) $(XLIBOBJS) $(PNGLIBOBJS) $(ARTLIBOBJS) $(ZLIBOBJS)
+OBJCGI := $(OBJS) $(OBJDIR)/rrd_cgi.o
+OBJTOOL := $(OBJS) $(OBJDIR)/rrd_tool.o
-LIBS = $(LIBFT2)/builds/netware/libc/libft2.lib
+LDLIBS += $(LIBFT2)/builds/netware/libc/libft2.$(LIBEXT)
-all: $(OBJDIR) config.h $(OBJDIR)/$(TARGET).nlm
+all: rrdtool rrdcgi
-dist: all
- -$(RM) $(OBJDIR)/*.o $(OBJDIR)/$(TARGET).map $(OBJDIR)/$(TARGET).ncv
- -$(RM) $(OBJDIR)/$(TARGET).def $(XDCDATA)
- -$(RM) config.h
+rrdtool: $(OBJDIR) config.h $(OBJDIR)/rrdtool.nlm
+rrdcgi: $(OBJDIR) config.h $(OBJDIR)/rrdcgi.$(CGIEXT)
+librrd: $(OBJDIR) config.h $(OBJDIR)/librrd.$(LIBEXT)
-install: all
- @[ -d $(INSTDIR) ] || mkdir $(INSTDIR)
- @$(CP) $(TARGET).nlm $(INSTDIR)
+dist: all $(DISTDIR) $(DISTDIR)/readme.txt
+# @-$(CP) $(OBJDIR)/librrd.$(LIBEXT) $(DISTDIR)
+ @-$(CP) $(OBJDIR)/rrdcgi.$(CGIEXT) $(DISTDIR)
+ @-$(CP) $(OBJDIR)/rrdtool.nlm $(DISTDIR)
+ @-$(CP) $(RRD_DEFAULT_FONT) $(DISTDIR)
+ @-$(CP) ../CHANGES $(DISTDIR)
+ @-$(CP) ../COPYING $(DISTDIR)
+ @-$(CP) ../COPYRIGHT $(DISTDIR)
+ @-$(CP) ../NEWS $(DISTDIR)
+ @-$(CP) ../README $(DISTDIR)
+ @echo Creating $(ARCHIVE)
+ @$(ZIP) $(ARCHIVE) $(DISTDIR)/* < $(DISTDIR)/readme.txt
clean:
-$(RM) -r $(OBJDIR)
-$(RM) config.h
+distclean: clean
+ -$(RM) -r $(DISTDIR)
+ -$(RM) $(ARCHIVE)
+
$(OBJDIR):
- @mkdir $(OBJDIR)
+ @mkdir $@
+
+$(DISTDIR):
+ @mkdir $@
$(OBJDIR)/%.o: %.c
@echo Compiling $<
@$(CC) $(CFLAGS) -c $< -o $@
-$(OBJDIR)/version.inc: ../configure $(OBJDIR) get_ver.awk
+$(OBJDIR)/version.inc: ../configure.ac $(OBJDIR) get_ver.awk
@echo Creating $@
- @awk -f get_ver.awk $< > $@
+ @$(AWK) -f get_ver.awk $< > $@
+
+$(OBJDIR)/rrdcgi.$(CGIEXT): $(OBJCGI) $(OBJDIR)/rrdcgi.def $(OBJDIR)/rrdcgi.xdc
+ @echo Linking $@
+ @-$(RM) $@
+ @$(LD) $(LDFLAGS) $(@:.$(CGIEXT)=.def)
+ifneq ($(CGIEXT),nlm)
+ifeq ($(LD),mwldnlm)
+ @$(FIXNLMN) $@
+endif
+endif
-$(OBJDIR)/$(TARGET).nlm: $(OBJDIR) $(OBJS) $(OBJDIR)/version.inc $(OBJDIR)/$(TARGET).def $(XDCDATA)
+$(OBJDIR)/rrdtool.nlm: $(OBJTOOL) $(OBJDIR)/rrdtool.def $(OBJDIR)/rrdtool.xdc
@echo Linking $@
@-$(RM) $@
- @$(LD) $(LDFLAGS) $(OBJDIR)/$(TARGET).def
+ @$(LD) $(LDFLAGS) $(@:.nlm=.def)
+
+$(OBJDIR)/librrd.$(LIBEXT): $(OBJS)
+ @echo Creating $@
+ @-$(RM) $@
+ @$(AR) $(ARFLAGS) $@ $^
$(OBJDIR)/%.xdc: Makefile.NetWare
@echo Creating $@
ifdef STACK
@echo $(DL)stack $(STACK)$(DL) >> $@
endif
- @echo $(DL)threadname "$(TARGET)"$(DL) >> $@
+ @echo $(DL)threadname "$(notdir $(@:.def=))"$(DL) >> $@
ifdef SCREEN
@echo $(DL)screenname "$(SCREEN)"$(DL) >> $@
else
ifeq ($(LDRING),3)
@echo $(DL)flag_on 512$(DL) >> $@
endif
-ifdef XDCDATA
- @echo $(DL)xdcdata $(XDCDATA)$(DL) >> $@
+ifdef XDCOPT
+ @echo $(DL)xdcdata $(@:.def=.xdc)$(DL) >> $@
endif
ifeq ($(LD),nlmconv)
- @echo $(DL)input $(OBJS) $(LIBS)$(DL) >> $@
+ @echo $(DL)input $(OBJS) $(LDLIBS)$(DL) >> $@
@echo $(DL)input $(PRELUDE)$(DL) >> $@
- @echo $(DL)output $(TARGET).nlm$(DL) >> $@
+ @echo $(DL)output $(notdir $(@:.def=.nlm))$(DL) >> $@
endif
config.h: Makefile.NetWare
@echo $(DL)#define TIME_WITH_SYS_TIME 1$(DL) >> $@
@echo $(DL)#define HAVE_ZLIB_H 1$(DL) >> $@
@echo $(DL)#define HAVE_LIBZ 1$(DL) >> $@
+ifdef NO_NULL_REALLOC
+ @echo $(DL)#define NO_NULL_REALLOC 1$(DL) >> $@
+ @echo $(DL)#define rrd_realloc(a,b) ( (a) == NULL ? malloc( (b) ) : realloc( (a) , (b) ))$(DL) >> $@
+else
@echo $(DL)#define rrd_realloc(a,b) realloc((a), (b))$(DL) >> $@
-# @echo $(DL)#define rrd_realloc(a,b) ( (a) == NULL ? malloc( (b) ) : realloc( (a) , (b) ))$(DL) >> $@
+endif
@echo $(DL)#define RRDGRAPH_YLEGEND_ANGLE $(RRDGRAPH_YLEGEND_ANGLE)$(DL) >> $@
- @echo $(DL)#define RRD_DEFAULT_FONT "arial.ttf"$(DL) >> $@
+ @echo $(DL)#define RRD_DEFAULT_FONT $(RRD_DEFAULT_FONT)$(DL) >> $@
+ifdef WITH_PIECHART
+ @echo $(DL)#define WITH_PIECHART 1$(DL) >> $@
+endif
+
+$(DISTDIR)/readme.txt: Makefile.NetWare
+ @echo Creating $@
+ @echo $(DL)This is a binary distribution for NetWare platform.$(DL) > $@
+ @echo $(DL)RRDTool version $(RRD_VERSION_STR)$(DL) >> $@
+ @echo $(DL)Please download the complete RRDTool package for$(DL) >> $@
+ @echo $(DL)any further documentation:$(DL) >> $@
+ @echo $(DL)$(WWWURL)$(DL) >> $@
+
+help:
+ @echo $(DL)===========================================================$(DL)
+ @echo $(DL)Novell NDK Base = $(NDKBASE)$(DL)
+ @echo $(DL)libpng Source = $(LIBPNG)$(DL)
+ @echo $(DL)libart Source = $(LIBART)$(DL)
+ @echo $(DL)Freetype 2 SDK = $(LIBFT2)$(DL)
+ @echo $(DL)Zlib SDK = $(ZLIBSDK)$(DL)
+ @echo $(DL)===========================================================$(DL)
+ @echo $(DL)RRDTool $(RRD_VERSION_STR) - available targets are:$(DL)
+ @echo $(DL)$(MAKE) all$(DL)
+ @echo $(DL)$(MAKE) rrdtool$(DL)
+ @echo $(DL)$(MAKE) rrdcgi$(DL)
+ @echo $(DL)$(MAKE) librrd$(DL)
+ @echo $(DL)$(MAKE) clean$(DL)
+ @echo $(DL)$(MAKE) dist$(DL)
+ @echo $(DL)$(MAKE) distclean$(DL)
+ @echo $(DL)===========================================================$(DL)