Compile time improvments for NetWare and Win32 -- Guenter Knauf gk.gknw.de
[rrdtool.git] / src / Makefile.NetWare
index 417c40a..c01e73d 100644 (file)
@@ -1,17 +1,19 @@
-# Gnu Makefile for NetWare target * 20-Aug-2005
+# Gnu Makefile for NetWare target * 04-Jan-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] [BINEXT=cgi]
+
+# What to build
+ifndef BINEXT
+BINEXT = nlm
+endif
 
-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
+STACK  = 65535
 # Comment the line below if you dont want to load protected automatically.
 #LDRING        = 3
 
@@ -28,7 +30,7 @@ INSTDIR       = s:/mrtg/rrd
 
 # Base for the lib sources
 ifndef LIBBASE
-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.
@@ -45,7 +47,7 @@ LIBFT2        = $(LIBBASE)/freetype-2.1.9
 endif
 # Edit the path below to point to your freetype 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
@@ -53,8 +55,7 @@ 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
+LIBCGI = $(LIBBASE)/cgilib-0.5
 endif
 
 # Edit the var below to point to your lib architecture.
@@ -70,7 +71,7 @@ else
        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
@@ -93,17 +94,15 @@ endif
 
 # 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) $(OBJS) $(LDLIBS) -o $(OBJDIR)/$(TARGET).nlm -commandfile
+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
@@ -115,7 +114,8 @@ endif
 else
 LD     = nlmconv
 LDFLAGS        = -T
-CFLAGS += -fno-builtin -fpack-struct -fpcc-struct-return
+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
@@ -140,7 +140,7 @@ 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
@@ -151,15 +151,14 @@ NDK_ROOT = $(NDKBASE)/ndk
 SDK_CLIB = $(NDK_ROOT)/nwsdk
 SDK_LIBC = $(NDK_ROOT)/libc
 
+INCLUDES = -I. -I$(LIBGD) -I$(LIBPNG) -I$(LIBFT2)/include -I$(LIBART) -I$(ZLIBSDK)
+ifeq ($(BINEXT),cgi)
+INCLUDES += -I$(LIBCGI)
+endif
 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)
@@ -260,19 +259,28 @@ ZLIBOBJS  += \
        $(EOLIST)
 endif
 
+CGIOBJS        = \
+       $(OBJDIR)/cgi.o \
+       $(OBJDIR)/cookies.o \
+       $(EOLIST)
+
 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
+
+ifeq ($(BINEXT),cgi)
+OBJS   += $(CGIOBJS) $(OBJDIR)/rrd_cgi.o
+TARGET = rrdcgi
+else
+OBJS   += $(OBJDIR)/rrd_tool.o
+TARGET = rrdtool
 endif
-OBJS   += $(OBJDIR)/$(SOURCE).o
 
-LIBS   = $(LIBFT2)/builds/netware/libc/libft2.lib
+LDLIBS += $(LIBFT2)/builds/netware/libc/libft2.$(LIBEXT)
 
 
-all: $(OBJDIR) config.h $(OBJDIR)/$(TARGET).nlm
+all: $(OBJDIR) config.h $(OBJDIR)/$(TARGET).$(BINEXT)
 
 dist: all
        -$(RM) $(OBJDIR)/*.o $(OBJDIR)/$(TARGET).map $(OBJDIR)/$(TARGET).ncv
@@ -281,7 +289,7 @@ dist: all
 
 install: all
        @[ -d $(INSTDIR) ] || mkdir $(INSTDIR)
-       @$(CP) $(TARGET).nlm $(INSTDIR)
+       @$(CP) $(TARGET).$(BINEXT) $(INSTDIR)
 
 clean:
        -$(RM) -r $(OBJDIR)
@@ -294,11 +302,11 @@ $(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 $< > $@
 
-$(OBJDIR)/$(TARGET).nlm: $(OBJDIR) $(OBJS) $(OBJDIR)/version.inc $(OBJDIR)/$(TARGET).def $(XDCDATA)
+$(OBJDIR)/$(TARGET).$(BINEXT): $(OBJDIR) $(OBJS) $(OBJDIR)/version.inc $(OBJDIR)/$(TARGET).def $(XDCDATA)
        @echo Linking $@
        @-$(RM) $@
        @$(LD) $(LDFLAGS) $(OBJDIR)/$(TARGET).def
@@ -360,7 +368,7 @@ ifdef XDCDATA
        @echo $(DL)xdcdata $(XDCDATA)$(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) >> $@
 endif