From 22ecdee73cbb51ac7c3301ce39749f819ea72d0e Mon Sep 17 00:00:00 2001 From: oetiker Date: Tue, 23 Aug 2005 21:18:23 +0000 Subject: [PATCH] fixes for compiling rrdtool with win32 mingw and netware -- Guenter Knauf git-svn-id: svn://svn.oetiker.ch/rrdtool/branches/1.2/program@674 a5681a0c-68f1-0310-ab6d-d61299d08faa --- Makefile.am | 2 +- src/Makefile.NetWare | 421 +++++++++++++++++++++++++++++++++++++++++++++++++++ src/Makefile.Win32 | 350 ++++++++++++++++++++++++++++++++++++++++++ src/Makefile.am | 4 +- src/get_ver.awk | 18 +++ src/rrd_afm.c | 4 +- src/rrd_dump.c | 2 + src/rrd_tool.c | 4 - src/rrd_tool.h | 9 +- src/rrd_update.c | 12 +- src/rrdtool.dsp | 4 +- src/rrdtool.vcproj | 4 +- 12 files changed, 817 insertions(+), 17 deletions(-) create mode 100644 src/Makefile.NetWare create mode 100644 src/Makefile.Win32 create mode 100644 src/get_ver.awk diff --git a/Makefile.am b/Makefile.am index 0e4263a..9fbe6d0 100644 --- a/Makefile.am +++ b/Makefile.am @@ -6,7 +6,7 @@ SUBDIRS = src bindings doc examples # the following files are not mentioned in any other Makefile EXTRA_DIST = COPYRIGHT CHANGES NT-BUILD-TIPS.txt TODO CONTRIBUTORS THREADS \ - rrdtool.spec + rrdtool.spec confignt/config.h CLEANFILES = config.cache diff --git a/src/Makefile.NetWare b/src/Makefile.NetWare new file mode 100644 index 0000000..17320c0 --- /dev/null +++ b/src/Makefile.NetWare @@ -0,0 +1,421 @@ +# Gnu Makefile for NetWare target * 20-Aug-2005 +# for use with gcc/nlmconv or Metrowerks CodeWarrior compiler +# use with: make -f Makefile.NetWare [all|clean|dist] + +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 +#WWWURL = http://ee-staff.ethz.ch/~oetiker/webtools/rrdtool/ +WWWURL = http://www.rrdtool.org/ +MTSAFE = YES +#SCREEN = $(TARGET) +STACK = 49152 +# Comment the line below if you dont want to load protected automatically. +#LDRING = 3 + +# 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 = d:/projects/cw +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 +endif +# Edit the path below to point to your libpng sources or set environment var. +ifndef LIBPNG +LIBPNG = $(LIBBASE)/libpng-1.2.8 +endif +# Edit the path below to point to your freetype sources or set environment var. +ifndef LIBFT2 +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 +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 +endif + +# Edit the var below to point to your lib architecture. +ifndef LIBARCH +# LIBARCH = CLIB +LIBARCH = LIBC +endif + +# The following line defines your compiler. +ifdef METROWERKS + CC = mwccnlm +else + CC = gcc +endif +# RM = rm -f +CP = cp -fv +# 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 +MPKXDC = mkxdc + +# must be equal to DEBUG or NDEBUG +DB = NDEBUG +# DB = DEBUG +# Optimization: -O or debugging: -g +ifeq ($(DB),NDEBUG) + OPT = -O2 + OBJDIR = release +else + OPT = -g + OBJDIR = debug +endif + +# Include the version info retrieved from source. +-include $(OBJDIR)/version.inc + +# 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 + +ifeq ($(CC),mwccnlm) +LD = mwldnlm +LDFLAGS = -nostdlib $(PRELUDE) $(OBJS) $(LIBS) -o $(OBJDIR)/$(TARGET).nlm -commandfile +CFLAGS += -gccinc -inline off -opt nointrinsics -proc 586 +CFLAGS += -relax_pointers +#CFLAGS += -w on,nounused,nounusedexpr -ansi strict +ifeq ($(LIBARCH),LIBC) + PRELUDE = $(SDK_LIBC)/imports/libcpre.o + CFLAGS += -align 4 +else + PRELUDE = "$(METROWERKS)/Novell Support/libraries/runtime/prelude.obj" + CFLAGS += -include "$(METROWERKS)/Novell Support/headers/nlm_prefix.h" + CFLAGS += -align 1 +endif +else +LD = nlmconv +LDFLAGS = -T +CFLAGS += -fno-builtin -fpack-struct -fpcc-struct-return +CFLAGS += -Wall -Wno-unused # -pedantic +ifeq ($(LIBARCH),LIBC) + PRELUDE = $(SDK_LIBC)/imports/libcpre.gcc.o +else + PRELUDE = $(NDK_ROOT)/pre/prelude.o + CFLAGS += -include $(NDKBASE)/nlmconv/genlm.h +endif +endif + +ifeq ($(findstring linux,$(OSTYPE)),linux) +#include $(NDKBASE)/nlmconv/ncpfs.inc +DL = ' +endif + +ifeq ($(MTSAFE),YES) + XDCOPT = -n +endif +ifeq ($(MTSAFE),NO) + XDCOPT = -u +endif +ifdef XDCOPT + XDCDATA = $(OBJDIR)/$(TARGET).xdc +endif +ifndef COPYR + COPYR = Copyright (c) 2005 The Open Source Community. +endif +ifndef DESCR + DESCR = $(TARGET) Command Extension +endif +DESCR += ($(LIBARCH)) - $(CC) build + +NDK_ROOT = $(NDKBASE)/ndk +SDK_CLIB = $(NDK_ROOT)/nwsdk +SDK_LIBC = $(NDK_ROOT)/libc + +ifeq ($(LIBARCH),LIBC) + 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) +endif + +CFLAGS += $(INCLUDES) + +vpath %.c . $(LIBGD) $(LIBPNG) $(LIBART)/libart_lgpl $(ZLIBSDK) $(LIBCGI) + +RRDLIBOBJS = \ + $(OBJDIR)/rrd_afm.o \ + $(OBJDIR)/rrd_afm_data.o \ + $(OBJDIR)/rrd_create.o \ + $(OBJDIR)/rrd_diff.o \ + $(OBJDIR)/rrd_dump.o \ + $(OBJDIR)/rrd_error.o \ + $(OBJDIR)/rrd_fetch.o \ + $(OBJDIR)/rrd_first.o \ + $(OBJDIR)/rrd_format.o \ + $(OBJDIR)/rrd_gfx.o \ + $(OBJDIR)/rrd_graph.o \ + $(OBJDIR)/rrd_graph_helper.o \ + $(OBJDIR)/rrd_hw.o \ + $(OBJDIR)/rrd_info.o \ + $(OBJDIR)/rrd_last.o \ + $(OBJDIR)/rrd_nan_inf.o \ + $(OBJDIR)/rrd_open.o \ + $(OBJDIR)/rrd_resize.o \ + $(OBJDIR)/rrd_restore.o \ + $(OBJDIR)/rrd_rpncalc.o \ + $(OBJDIR)/rrd_tune.o \ + $(OBJDIR)/rrd_update.o \ + $(OBJDIR)/rrd_version.o \ + $(OBJDIR)/rrd_xport.o \ + $(OBJDIR)/rrd_thread_safe.o \ + $(EOLIST) + +XLIBOBJS = \ + $(OBJDIR)/art_rgba_svp.o \ + $(OBJDIR)/getopt.o \ + $(OBJDIR)/getopt1.o \ + $(OBJDIR)/hash_32.o \ + $(OBJDIR)/parsetime.o \ + $(OBJDIR)/pngsize.o \ + $(OBJDIR)/strftime.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 \ + $(OBJDIR)/pngget.o \ + $(OBJDIR)/pngmem.o \ + $(OBJDIR)/pngpread.o \ + $(OBJDIR)/pngread.o \ + $(OBJDIR)/pngrio.o \ + $(OBJDIR)/pngrtran.o \ + $(OBJDIR)/pngrutil.o \ + $(OBJDIR)/pngset.o \ + $(OBJDIR)/pngtrans.o \ + $(OBJDIR)/pngwio.o \ + $(OBJDIR)/pngwrite.o \ + $(OBJDIR)/pngwtran.o \ + $(OBJDIR)/pngwutil.o \ + $(EOLIST) +ifeq "$(wildcard $(LIBPNG)/pnggccrd.c)" "$(LIBPNG)/pnggccrd.c" +PNGLIBOBJS += \ + $(OBJDIR)/pnggccrd.o \ + $(OBJDIR)/pngvcrd.o \ + $(EOLIST) +endif + +ZLIBOBJS = \ + $(OBJDIR)/adler32.o \ + $(OBJDIR)/compress.o \ + $(OBJDIR)/crc32.o \ + $(OBJDIR)/deflate.o \ + $(OBJDIR)/inflate.o \ + $(OBJDIR)/inffast.o \ + $(OBJDIR)/inftrees.o \ + $(OBJDIR)/trees.o \ + $(OBJDIR)/zutil.o \ + $(EOLIST) +ifeq "$(wildcard $(ZLIBSDK)/infblock.c)" "$(ZLIBSDK)/infblock.c" +ZLIBOBJS += \ + $(OBJDIR)/infblock.o \ + $(OBJDIR)/infcodes.o \ + $(OBJDIR)/infutil.o \ + $(EOLIST) +endif + +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 + +LIBS = $(LIBFT2)/builds/netware/libc/libft2.lib + + +all: $(OBJDIR) config.h $(OBJDIR)/$(TARGET).nlm + +dist: all + -$(RM) $(OBJDIR)/*.o $(OBJDIR)/$(TARGET).map $(OBJDIR)/$(TARGET).ncv + -$(RM) $(OBJDIR)/$(TARGET).def $(XDCDATA) + -$(RM) config.h + +install: all + @[ -d $(INSTDIR) ] || mkdir $(INSTDIR) + @$(CP) $(TARGET).nlm $(INSTDIR) + +clean: + -$(RM) -r $(OBJDIR) + -$(RM) config.h + +$(OBJDIR): + @mkdir $(OBJDIR) + +$(OBJDIR)/%.o: %.c + @echo Compiling $< + @$(CC) $(CFLAGS) -c $< -o $@ + +$(OBJDIR)/version.inc: ../configure $(OBJDIR) get_ver.awk + @echo Creating $@ + @awk -f get_ver.awk $< > $@ + +$(OBJDIR)/$(TARGET).nlm: $(OBJDIR) $(OBJS) $(OBJDIR)/version.inc $(OBJDIR)/$(TARGET).def $(XDCDATA) + @echo Linking $@ + @-$(RM) $@ + @$(LD) $(LDFLAGS) $(OBJDIR)/$(TARGET).def + +$(OBJDIR)/%.xdc: Makefile.NetWare + @echo Creating $@ + @$(MPKXDC) $(XDCOPT) $@ + +$(OBJDIR)/%.def: Makefile.NetWare $(OBJDIR)/version.inc + @echo $(DL)# DEF Linker File for use with gcc and nlmconv$(DL) > $@ + @echo $(DL)# or with Codewarrior command line compiler.$(DL) >> $@ + @echo $(DL)# Do not edit this file - it is created by make!$(DL) >> $@ + @echo $(DL)# All your changes will be lost!!$(DL) >> $@ + @echo $(DL)#$(DL) >> $@ + @echo $(DL)copyright "$(COPYR)"$(DL) >> $@ + @echo $(DL)description "$(DESCR)"$(DL) >> $@ + @echo $(DL)version $(RRD_VERSION)$(DL) >> $@ +ifdef NLMTYPE + @echo $(DL)type $(NLMTYPE)$(DL) >> $@ +else + @echo $(DL)type 0$(DL) >> $@ +endif +ifdef STACK + @echo $(DL)stack $(STACK)$(DL) >> $@ +endif + @echo $(DL)threadname "$(TARGET)"$(DL) >> $@ +ifdef SCREEN + @echo $(DL)screenname "$(SCREEN)"$(DL) >> $@ +else + @echo $(DL)screenname "DEFAULT"$(DL) >> $@ +endif +ifeq ($(DB),DEBUG) + @echo $(DL)debug$(DL) >> $@ +endif +ifeq ($(LIBARCH),CLIB) + @echo $(DL)start _Prelude$(DL) >> $@ + @echo $(DL)exit _Stop$(DL) >> $@ + @echo $(DL)import @$(NDK_ROOT)/nwsdk/imports/clib.imp$(DL) >> $@ + @echo $(DL)import @$(NDK_ROOT)/nwsdk/imports/threads.imp$(DL) >> $@ + @echo $(DL)import @$(NDK_ROOT)/nwsdk/imports/nlmlib.imp$(DL) >> $@ + @echo $(DL)module clib$(DL) >> $@ +else + @echo $(DL)start _LibCPrelude$(DL) >> $@ + @echo $(DL)exit _LibCPostlude$(DL) >> $@ + @echo $(DL)check _LibCCheckUnload$(DL) >> $@ + @echo $(DL)import @$(NDK_ROOT)/libc/imports/libc.imp$(DL) >> $@ + @echo $(DL)import @$(NDK_ROOT)/libc/imports/netware.imp$(DL) >> $@ + @echo $(DL)module libc$(DL) >> $@ + @echo $(DL)pseudopreemption$(DL) >> $@ + @echo $(DL)flag_on 64$(DL) >> $@ +endif +ifeq ($(LDRING),0) + @echo $(DL)flag_on 16$(DL) >> $@ +endif +ifeq ($(LDRING),3) + @echo $(DL)flag_on 512$(DL) >> $@ +endif +ifdef XDCDATA + @echo $(DL)xdcdata $(XDCDATA)$(DL) >> $@ +endif +ifeq ($(LD),nlmconv) + @echo $(DL)input $(OBJS) $(LIBS)$(DL) >> $@ + @echo $(DL)input $(PRELUDE)$(DL) >> $@ + @echo $(DL)output $(TARGET).nlm$(DL) >> $@ +endif + +config.h: Makefile.NetWare + @echo Creating $@ + @echo $(DL)/* $@ for NetWare target.$(DL) > $@ + @echo $(DL)** Do not edit this file - it is created by make!$(DL) >> $@ + @echo $(DL)** All your changes will be lost!!$(DL) >> $@ + @echo $(DL)*/$(DL) >> $@ + @echo $(DL)#define OS "i586-pc-NetWare"$(DL) >> $@ + @echo $(DL)#define PACKAGE_VERSION "$(RRD_VERSION_STR)"$(DL) >> $@ + @echo $(DL)#define PACKAGE_BUGREPORT "tobi@oetiker.ch"$(DL) >> $@ + @echo $(DL)#define NUMVERS $(RRD_NUMVERS)$(DL) >> $@ + @echo $(DL)#define HAVE_ASSERT_H 1$(DL) >> $@ + @echo $(DL)#define HAVE_DLFCN_H 1$(DL) >> $@ + @echo $(DL)#define HAVE_DLOPEN 1$(DL) >> $@ + @echo $(DL)#define HAVE_ERR_H 1$(DL) >> $@ + @echo $(DL)#define HAVE_ERRNO_H 1$(DL) >> $@ + @echo $(DL)#define HAVE_FCNTL_H 1$(DL) >> $@ + @echo $(DL)#define HAVE_FIONBIO 1$(DL) >> $@ + @echo $(DL)#define HAVE_GETTIMEOFDAY 1$(DL) >> $@ + @echo $(DL)#define HAVE_INTTYPES_H 1$(DL) >> $@ + @echo $(DL)#define HAVE_LIMITS_H 1$(DL) >> $@ + @echo $(DL)#define HAVE_LONGLONG 1$(DL) >> $@ + @echo $(DL)#define HAVE_LOCALE_H 1$(DL) >> $@ + @echo $(DL)#define HAVE_MALLOC_H 1$(DL) >> $@ + @echo $(DL)#define HAVE_MATH_H 1$(DL) >> $@ + @echo $(DL)#define HAVE_MBSTOWCS 1$(DL) >> $@ + @echo $(DL)#define HAVE_SELECT 1$(DL) >> $@ + @echo $(DL)#define HAVE_SETJMP_H 1$(DL) >> $@ +# @echo $(DL)#define HAVE_SIGNAL 1$(DL) >> $@ + @echo $(DL)#define HAVE_SNPRINTF 1$(DL) >> $@ + @echo $(DL)#define HAVE_STDARG_H 1$(DL) >> $@ + @echo $(DL)#define HAVE_STDDEF_H 1$(DL) >> $@ + @echo $(DL)#define HAVE_STDINT_H 1$(DL) >> $@ + @echo $(DL)#define HAVE_STDLIB_H 1$(DL) >> $@ + @echo $(DL)#define HAVE_STRCASECMP 1$(DL) >> $@ + @echo $(DL)#define HAVE_STRDUP 1$(DL) >> $@ + @echo $(DL)#define HAVE_STRFTIME 1$(DL) >> $@ + @echo $(DL)#define HAVE_STRING_H 1$(DL) >> $@ + @echo $(DL)#define HAVE_STRLCAT 1$(DL) >> $@ + @echo $(DL)#define HAVE_STRLCPY 1$(DL) >> $@ + @echo $(DL)#define HAVE_STRSTR 1$(DL) >> $@ + @echo $(DL)#define HAVE_SYS_PARAM_H 1$(DL) >> $@ + @echo $(DL)#define HAVE_SYS_SELECT_H 1$(DL) >> $@ + @echo $(DL)#define HAVE_SYS_STAT_H 1$(DL) >> $@ + @echo $(DL)#define HAVE_SYS_TIME_H 1$(DL) >> $@ + @echo $(DL)#define HAVE_TERMIOS_H 1$(DL) >> $@ + @echo $(DL)#define HAVE_TIME_H 1$(DL) >> $@ + @echo $(DL)#define HAVE_UNAME 1$(DL) >> $@ + @echo $(DL)#define HAVE_UNISTD_H 1$(DL) >> $@ + @echo $(DL)#define STDC_HEADERS 1$(DL) >> $@ + @echo $(DL)#define TIME_WITH_SYS_TIME 1$(DL) >> $@ + @echo $(DL)#define HAVE_ZLIB_H 1$(DL) >> $@ + @echo $(DL)#define HAVE_LIBZ 1$(DL) >> $@ + @echo $(DL)#define rrd_realloc(a,b) realloc((a), (b))$(DL) >> $@ + @echo $(DL)#define RRDGRAPH_YLEGEND_ANGLE 90.0$(DL) >> $@ + + diff --git a/src/Makefile.Win32 b/src/Makefile.Win32 new file mode 100644 index 0000000..eccfee0 --- /dev/null +++ b/src/Makefile.Win32 @@ -0,0 +1,350 @@ +# Gnu Makefile for Win32 target * 20-Aug-2005 +# for use with MingW32 gcc or Metrowerks CodeWarrior compiler +# use with: make -f Makefile.Win32 [all|clean|dist] + +SOURCE = rrd_tool +#SOURCE = rrd_cgi +TARGET = $(subst _,,$(SOURCE)) +#DESCR = Round Robin Database Tool $(RRD_VERSION_STR) +DESCR = Round Robin Database Tool +COPYR = Copyright (c) 1997-2005 by Tobias Oetiker +#WWWURL = http://ee-staff.ethz.ch/~oetiker/webtools/rrdtool/ +WWWURL = http://www.rrdtool.org/ + +# Edit the path below to point to your install destination. +# INSTDIR = /mnt/sys/mrtg/rrd +INSTDIR = c:/mrtg/rrd + +# Base for the lib sources +ifndef LIBBASE +LIBBASE = d:/projects/cw +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.15 +endif +# Edit the path below to point to your libpng sources or set environment var. +ifndef LIBPNG +LIBPNG = $(LIBBASE)/libpng-1.2.8 +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)/../mingw32/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 +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 +endif + +# The following line defines your compiler. +ifdef METROWERKS + CC = mwcc +else + CC = gcc +endif +# RM = rm -f +CP = cp -fv + +# must be equal to DEBUG or NDEBUG +DB = NDEBUG +# DB = DEBUG +# Optimization: -O or debugging: -g +ifeq ($(DB),NDEBUG) + OPT = -O2 + OBJDIR = release +else + OPT = -g + OBJDIR = debug +endif + +# Include the version info retrieved from source. +-include $(OBJDIR)/version.inc + +# Global flags for all compilers +CFLAGS = $(OPT) -D$(DB) -DHAVE_CONFIG_H + +ifeq ($(CC),mwcc) +LD = mwld +CFLAGS += -gccinc -msgstyle gcc -inline off -opt nointrinsics -inst mmx -proc 586 +#CFLAGS += -w on,nounused,nounusedexpr +#CFLAGS += -ansi strict +CFLAGS += -ir "$(METROWERKS)/MSL" -ir "$(METROWERKS)/Win32-x86 Support" +LD = mwld +RC = mwwinrc +LDFLAGS = -nostdlib +LIBPATH += -lr "$(METROWERKS)/MSL" -lr "$(METROWERKS)/Win32-x86 Support" +LDLIBS += -lkernel32.lib -luser32.lib +LDLIBS += -lMSL_Runtime_x86.lib -lMSL_C_x86.lib -lMSL_Extras_x86.lib +LIBEXT = lib +RCFLAGS = +else +LD = gcc +RC = windres +LDFLAGS = -s +LIBEXT = a +RCFLAGS = -I rc -O coff -i +CFLAGS += -Wall -Wno-format -Wno-unused # -pedantic +endif + +ifndef COPYR + COPYR = Copyright (c) 2005 The Open Source Community. +endif +ifndef DESCR + DESCR = $(TARGET) Command Extension +endif +DESCR += - $(CC) build + +INCLUDES += -I. -I$(LIBGD) -I$(LIBPNG) -I$(LIBFT2)/include -I$(LIBART) -I$(ZLIBSDK) +ifeq ($(SOURCE),rrd_cgi) +INCLUDES += -I$(LIBCGI) +endif + +CFLAGS += $(INCLUDES) + +vpath %.c . $(LIBGD) $(LIBPNG) $(LIBART)/libart_lgpl $(ZLIBSDK) $(LIBCGI) + +RRDLIBOBJS = \ + $(OBJDIR)/rrd_afm.o \ + $(OBJDIR)/rrd_afm_data.o \ + $(OBJDIR)/rrd_create.o \ + $(OBJDIR)/rrd_diff.o \ + $(OBJDIR)/rrd_dump.o \ + $(OBJDIR)/rrd_error.o \ + $(OBJDIR)/rrd_fetch.o \ + $(OBJDIR)/rrd_first.o \ + $(OBJDIR)/rrd_format.o \ + $(OBJDIR)/rrd_gfx.o \ + $(OBJDIR)/rrd_graph.o \ + $(OBJDIR)/rrd_graph_helper.o \ + $(OBJDIR)/rrd_hw.o \ + $(OBJDIR)/rrd_info.o \ + $(OBJDIR)/rrd_last.o \ + $(OBJDIR)/rrd_nan_inf.o \ + $(OBJDIR)/rrd_open.o \ + $(OBJDIR)/rrd_resize.o \ + $(OBJDIR)/rrd_restore.o \ + $(OBJDIR)/rrd_rpncalc.o \ + $(OBJDIR)/rrd_tune.o \ + $(OBJDIR)/rrd_update.o \ + $(OBJDIR)/rrd_version.o \ + $(OBJDIR)/rrd_xport.o \ + $(OBJDIR)/rrd_not_thread_safe.o \ + $(EOLIST) + +XLIBOBJS = \ + $(OBJDIR)/art_rgba_svp.o \ + $(OBJDIR)/getopt.o \ + $(OBJDIR)/getopt1.o \ + $(OBJDIR)/hash_32.o \ + $(OBJDIR)/parsetime.o \ + $(OBJDIR)/pngsize.o \ + $(OBJDIR)/strftime.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 \ + $(OBJDIR)/pngget.o \ + $(OBJDIR)/pngmem.o \ + $(OBJDIR)/pngpread.o \ + $(OBJDIR)/pngread.o \ + $(OBJDIR)/pngrio.o \ + $(OBJDIR)/pngrtran.o \ + $(OBJDIR)/pngrutil.o \ + $(OBJDIR)/pngset.o \ + $(OBJDIR)/pngtrans.o \ + $(OBJDIR)/pngwio.o \ + $(OBJDIR)/pngwrite.o \ + $(OBJDIR)/pngwtran.o \ + $(OBJDIR)/pngwutil.o \ + $(EOLIST) +ifeq "$(wildcard $(LIBPNG)/pnggccrd.c)" "$(LIBPNG)/pnggccrd.c" +PNGLIBOBJS += \ + $(OBJDIR)/pnggccrd.o \ + $(OBJDIR)/pngvcrd.o \ + $(EOLIST) +endif + +ZLIBOBJS = \ + $(OBJDIR)/adler32.o \ + $(OBJDIR)/compress.o \ + $(OBJDIR)/crc32.o \ + $(OBJDIR)/deflate.o \ + $(OBJDIR)/inflate.o \ + $(OBJDIR)/inffast.o \ + $(OBJDIR)/inftrees.o \ + $(OBJDIR)/trees.o \ + $(OBJDIR)/zutil.o \ + $(EOLIST) +ifeq "$(wildcard $(ZLIBSDK)/infblock.c)" "$(ZLIBSDK)/infblock.c" +ZLIBOBJS += \ + $(OBJDIR)/infblock.o \ + $(OBJDIR)/infcodes.o \ + $(OBJDIR)/infutil.o \ + $(EOLIST) +endif + +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 + +LDLIBS = $(LIBFT2)/objs/freetype.$(LIBEXT) + + +all: $(OBJDIR) config.h $(OBJDIR)/$(TARGET).exe + +dist: all + -$(RM) $(OBJDIR)/*.o $(OBJDIR)/$(TARGET).map $(OBJDIR)/$(TARGET).ncv + -$(RM) $(OBJDIR)/$(TARGET).def $(OBJDIR)/$(TARGET).res + +install: all + @[ -d $(INSTDIR) ] || mkdir $(INSTDIR) + @$(CP) $(TARGET).exe $(INSTDIR) + +clean: + -$(RM) -r $(OBJDIR) + -$(RM) config.h + +$(OBJDIR): + @mkdir $(OBJDIR) + +$(OBJDIR)/version.inc: ../configure $(OBJDIR) get_ver.awk + @echo Creating $@ + @awk -f get_ver.awk $< > $@ + +$(OBJDIR)/%.o: %.c + @echo Compiling $< + @$(CC) $(CFLAGS) -c $< -o $@ + +$(OBJDIR)/$(TARGET).exe: $(OBJS) $(OBJDIR)/$(TARGET).res + @echo Linking $@ + @-$(RM) $@ + @$(LD) $(LDFLAGS) $^ -o $@ $(LIBPATH) $(LDLIBS) + +$(OBJDIR)/%.res: $(OBJDIR)/%.rc + @echo Creating $@ + @$(RC) $(RCFLAGS) $< -o $@ + +$(OBJDIR)/%.rc: Makefile.Win32 $(OBJDIR)/version.inc + @echo 1 VERSIONINFO > $@ + @echo FILEVERSION $(RRD_VERSION),0 >> $@ + @echo PRODUCTVERSION $(RRD_VERSION),0 >> $@ + @echo FILEFLAGSMASK 0x3fL >> $@ + @echo FILEOS 0x40004L >> $@ + @echo FILEFLAGS 0x0L >> $@ + @echo FILETYPE 0x1L >> $@ + @echo FILESUBTYPE 0x0L >> $@ + @echo BEGIN >> $@ + @echo BLOCK "StringFileInfo" >> $@ + @echo BEGIN >> $@ + @echo BLOCK "040904E4" >> $@ + @echo BEGIN >> $@ + @echo VALUE "LegalCopyright","$(COPYR)\0" >> $@ +# @echo VALUE "CompanyName","$(COMPANY)\0" >> $@ + @echo VALUE "ProductName","$(TARGET).exe\0" >> $@ + @echo VALUE "ProductVersion","$(RRD_VERSION_STR)\0" >> $@ + @echo VALUE "License","Released under GPL.\0" >> $@ + @echo VALUE "FileDescription","$(DESCR)\0" >> $@ + @echo VALUE "FileVersion","$(RRD_VERSION_STR)\0" >> $@ + @echo VALUE "InternalName","$(TARGET)\0" >> $@ + @echo VALUE "OriginalFilename","$(TARGET).exe\0" >> $@ +ifdef WWWURL + @echo VALUE "WWW","$(WWWURL)\0" >> $@ +endif + @echo END >> $@ + @echo END >> $@ + @echo BLOCK "VarFileInfo" >> $@ + @echo BEGIN >> $@ + @echo VALUE "Translation", 0x409, 1252 >> $@ + @echo END >> $@ + @echo END >> $@ +ifdef ICON + @echo 1 ICON DISCARDABLE "$(ICON)" >> $@ +endif + +config.h: Makefile.Win32 $(OBJDIR)/version.inc + @echo Creating $@ + @echo $(DL)/* $@ for NetWare target.$(DL) > $@ + @echo $(DL)** Do not edit this file - it is created by make!$(DL) >> $@ + @echo $(DL)** All your changes will be lost!!$(DL) >> $@ + @echo $(DL)*/$(DL) >> $@ + @echo $(DL)#define OS "i586-pc-Win32"$(DL) >> $@ + @echo $(DL)#define PACKAGE_VERSION "$(RRD_VERSION_STR)"$(DL) >> $@ + @echo $(DL)#define PACKAGE_BUGREPORT "tobi@oetiker.ch"$(DL) >> $@ + @echo $(DL)#define NUMVERS $(RRD_NUMVERS)$(DL) >> $@ + @echo $(DL)#define HAVE_ASSERT_H 1$(DL) >> $@ + @echo $(DL)#define HAVE_DLFCN_H 1$(DL) >> $@ + @echo $(DL)#define HAVE_DLOPEN 1$(DL) >> $@ + @echo $(DL)#define HAVE_ERR_H 1$(DL) >> $@ + @echo $(DL)#define HAVE_ERRNO_H 1$(DL) >> $@ + @echo $(DL)#define HAVE_FCNTL_H 1$(DL) >> $@ + @echo $(DL)#define HAVE_FIONBIO 1$(DL) >> $@ +# @echo $(DL)#define HAVE_GETTIMEOFDAY 1$(DL) >> $@ + @echo $(DL)#define HAVE_INTTYPES_H 1$(DL) >> $@ + @echo $(DL)#define HAVE_LIMITS_H 1$(DL) >> $@ + @echo $(DL)#define HAVE_LONGLONG 1$(DL) >> $@ + @echo $(DL)#define HAVE_LOCALE_H 1$(DL) >> $@ + @echo $(DL)#define HAVE_MALLOC_H 1$(DL) >> $@ + @echo $(DL)#define HAVE_MATH_H 1$(DL) >> $@ + @echo $(DL)#define HAVE_MBSTOWCS 1$(DL) >> $@ + @echo $(DL)#define HAVE_SELECT 1$(DL) >> $@ + @echo $(DL)#define HAVE_SETJMP_H 1$(DL) >> $@ +# @echo $(DL)#define HAVE_SIGNAL 1$(DL) >> $@ + @echo $(DL)#define HAVE_SNPRINTF 1$(DL) >> $@ + @echo $(DL)#define HAVE_STDARG_H 1$(DL) >> $@ + @echo $(DL)#define HAVE_STDDEF_H 1$(DL) >> $@ + @echo $(DL)#define HAVE_STDINT_H 1$(DL) >> $@ + @echo $(DL)#define HAVE_STDLIB_H 1$(DL) >> $@ +# @echo $(DL)#define HAVE_STRCASECMP 1$(DL) >> $@ + @echo $(DL)#define HAVE_STRDUP 1$(DL) >> $@ + @echo $(DL)#define HAVE_STRFTIME 1$(DL) >> $@ + @echo $(DL)#define HAVE_STRING_H 1$(DL) >> $@ + @echo $(DL)#define HAVE_STRLCAT 1$(DL) >> $@ + @echo $(DL)#define HAVE_STRLCPY 1$(DL) >> $@ + @echo $(DL)#define HAVE_STRSTR 1$(DL) >> $@ + @echo $(DL)#define HAVE_SYS_PARAM_H 1$(DL) >> $@ + @echo $(DL)#define HAVE_SYS_SELECT_H 1$(DL) >> $@ + @echo $(DL)#define HAVE_SYS_STAT_H 1$(DL) >> $@ + @echo $(DL)#define HAVE_SYS_TIME_H 1$(DL) >> $@ + @echo $(DL)#define HAVE_TERMIOS_H 1$(DL) >> $@ + @echo $(DL)#define HAVE_TIME_H 1$(DL) >> $@ + @echo $(DL)#define HAVE_UNAME 1$(DL) >> $@ +# @echo $(DL)#define HAVE_UNISTD_H 1$(DL) >> $@ + @echo $(DL)#define STDC_HEADERS 1$(DL) >> $@ + @echo $(DL)#define TIME_WITH_SYS_TIME 1$(DL) >> $@ + @echo $(DL)#define HAVE_ZLIB_H 1$(DL) >> $@ + @echo $(DL)#define HAVE_LIBZ 1$(DL) >> $@ + @echo $(DL)#define rrd_realloc(a,b) realloc((a), (b))$(DL) >> $@ + @echo $(DL)#define RRDGRAPH_YLEGEND_ANGLE 90.0$(DL) >> $@ + + diff --git a/src/Makefile.am b/src/Makefile.am index 5d2e809..6bee6b7 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -4,7 +4,6 @@ # #ACLOCAL_M4 = $(top_srcdir)/config/aclocal.m4 #AUTOHEADER = @AUTOHEADER@ --localdir=$(top_srcdir)/config -DEFS += -DMAKE_TIMESTAMP=\""$(shell date)"\" fontsdir = $(datadir)/rrdtool/fonts fonts_DATA = DejaVuSansMono-Roman.ttf @@ -133,4 +132,5 @@ rrdtool_LDADD = librrd.la # strftime is here because we do not usually need it. unices have propper # iso date support -EXTRA_DIST= rrdtool.dsp rrdtool.dsw strftime.c strftime.h $(fonts_DATA) +EXTRA_DIST= rrdtool.dsp rrdtool.dsw strftime.c strftime.h rrd.dsp $(fonts_DATA) \ + Makefile.Win32 Makefile.NetWare get_ver.awk win32comp.c diff --git a/src/get_ver.awk b/src/get_ver.awk new file mode 100644 index 0000000..09d4e40 --- /dev/null +++ b/src/get_ver.awk @@ -0,0 +1,18 @@ +# fetch rrdtool version number from input file and write them to STDOUT +BEGIN { + while ((getline < ARGV[1]) > 0) { + if (match ($0, /^PACKAGE_VERSION=/)) { + split($1, t, "="); + my_ver_str = substr(t[2],2,length(t[2])-2); + split(my_ver_str, v, "."); + my_ver = v[1] "," v[2] "," v[3]; + } + if (match ($0, /^NUMVERS=/)) { + split($1, t, "="); + my_num_ver = t[2]; + } + } + print "RRD_VERSION = " my_ver ""; + print "RRD_VERSION_STR = " my_ver_str ""; + print "RRD_NUMVERS = " my_num_ver ""; +} diff --git a/src/rrd_afm.c b/src/rrd_afm.c index 8befa29..e9a7860 100644 --- a/src/rrd_afm.c +++ b/src/rrd_afm.c @@ -4,11 +4,13 @@ * rrd_afm.h Parsing afm tables to find width of strings. ****************************************************************************/ -#if defined(_WIN32) && !defined(__CYGWIN__) && !defined(__CYGWIN32__) +#if defined(_WIN32) && !defined(__CYGWIN__) && !defined(__CYGWIN32__) && !defined(HAVE_CONFIG_H) #include "../confignt/config.h" #else +#ifdef HAVE_CONFIG_H #include "config.h" #endif +#endif #include "rrd_afm.h" #include "rrd_afm_data.h" diff --git a/src/rrd_dump.c b/src/rrd_dump.c index 348a3cd..d3a02f5 100644 --- a/src/rrd_dump.c +++ b/src/rrd_dump.c @@ -45,7 +45,9 @@ #include "rrd_tool.h" #include "rrd_rpncalc.h" +#ifndef NETWARE extern char *tzname[2]; +#endif int rrd_dump(int argc, char **argv) diff --git a/src/rrd_tool.c b/src/rrd_tool.c index fba0fa0..1994bb9 100644 --- a/src/rrd_tool.c +++ b/src/rrd_tool.c @@ -23,11 +23,7 @@ void PrintUsage(char *cmd) char help_main[] = "RRDtool " PACKAGE_VERSION " Copyright 1997-2005 by Tobias Oetiker \n" -#if defined(_WIN32) && !defined(__CYGWIN__) && !defined(__CYGWIN32__) " Compiled " __DATE__ " " __TIME__ "\n\n" -#else - " Compiled " MAKE_TIMESTAMP "\n\n" -#endif "Usage: rrdtool [options] command command_options\n\n"; char help_list[] = diff --git a/src/rrd_tool.h b/src/rrd_tool.h index de67b64..e1a7961 100644 --- a/src/rrd_tool.h +++ b/src/rrd_tool.h @@ -11,7 +11,7 @@ extern "C" { #ifndef _RRD_TOOL_H #define _RRD_TOOL_H -#if defined(_WIN32) && !defined(__CYGWIN__) && !defined(__CYGWIN32__) +#if defined(_WIN32) && !defined(__CYGWIN__) && !defined(__CYGWIN32__) && !defined(HAVE_CONFIG_H) #include "../confignt/config.h" #else #ifdef HAVE_CONFIG_H @@ -100,6 +100,12 @@ extern int getrusage(int, struct rusage *); /* Win32 only includes */ #include /* for _isnan */ +#ifdef __MINGW32__ +#define localtime_r(a,b) localtime(a) +#define ctime_r(a,b) ctime(a) +#define gmtime_r(a,b) gmtime(a) +#define strtok_r(a,b,c) strtok(a,b) +#else #define isnan _isnan #define finite _finite #define isinf(a) (_fpclass(a) == _FPCLASS_NINF || _fpclass(a) == _FPCLASS_PINF) @@ -107,6 +113,7 @@ struct tm* localtime_r(const time_t *timep, struct tm* result); char* ctime_r(const time_t *timep, char* result); struct tm* gmtime_r(const time_t *timep, struct tm* result); char *strtok_r(char *str, const char *sep, char **last); +#endif #else diff --git a/src/rrd_update.c b/src/rrd_update.c index 1b0cd9a..e8d629e 100644 --- a/src/rrd_update.c +++ b/src/rrd_update.c @@ -32,24 +32,28 @@ */ #include +#ifndef __MINGW32__ struct timeval { time_t tv_sec; /* seconds */ long tv_usec; /* microseconds */ }; +#endif struct __timezone { int tz_minuteswest; /* minutes W of Greenwich */ int tz_dsttime; /* type of dst correction */ }; -static gettimeofday(struct timeval *t, struct __timezone *tz) { - - struct timeb current_time; +static int gettimeofday(struct timeval *t, struct __timezone *tz) { + + struct _timeb current_time; _ftime(¤t_time); - + t->tv_sec = current_time.time; t->tv_usec = current_time.millitm * 1000; + + return 0; } #endif diff --git a/src/rrdtool.dsp b/src/rrdtool.dsp index 215ac7d..8a38176 100644 --- a/src/rrdtool.dsp +++ b/src/rrdtool.dsp @@ -42,7 +42,7 @@ RSC=rc.exe # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /MD /W3 /GX /I "\Program Files\GnuWin32\include" /I "\Program Files\GnuWin32\include\freetype2" /D "NDEBUG" /D "_WINDOWS" /D "WIN32" /D "_MBCS" /D "_CTYPE_DISABLE_MACROS" /D MAKE_TIMESTAMP=\"WIN32\" /FD /c +# ADD CPP /nologo /MD /W3 /GX /I "\Program Files\GnuWin32\include" /I "\Program Files\GnuWin32\include\freetype2" /D "NDEBUG" /D "_WINDOWS" /D "WIN32" /D "_MBCS" /D "_CTYPE_DISABLE_MACROS" /FD /c # SUBTRACT CPP /YX # ADD BASE RSC /l 0x100c /d "NDEBUG" # ADD RSC /l 0x100c /d "NDEBUG" @@ -67,7 +67,7 @@ LINK32=link.exe # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /MD /W3 /Gm /GX /ZI /Od /I "\Program Files\GnuWin32\include\freetype2" /I "\Program Files\GnuWin32\include" /D "_DEBUG" /D "_CONSOLE" /D "WIN32" /D "_MBCS" /D "_CTYPE_DISABLE_MACROS" /D MAKE_TIMESTAMP=\"WIN32\" /FR /FD /c +# ADD CPP /nologo /MD /W3 /Gm /GX /ZI /Od /I "\Program Files\GnuWin32\include\freetype2" /I "\Program Files\GnuWin32\include" /D "_DEBUG" /D "_CONSOLE" /D "WIN32" /D "_MBCS" /D "_CTYPE_DISABLE_MACROS" /FR /FD /c # SUBTRACT CPP /YX # ADD BASE RSC /l 0x100c /d "_DEBUG" # ADD RSC /l 0x100c /d "_DEBUG" diff --git a/src/rrdtool.vcproj b/src/rrdtool.vcproj index dad37e7..7ba111a 100644 --- a/src/rrdtool.vcproj +++ b/src/rrdtool.vcproj @@ -22,7 +22,7 @@ Name="VCCLCompilerTool" Optimization="4" AdditionalIncludeDirectories="\Program Files\GnuWin32\include,\Program Files\GnuWin32\include\freetype2" - PreprocessorDefinitions="NDEBUG;_WINDOWS;WIN32;_CTYPE_DISABLE_MACROS;MAKE_TIMESTAMP=\"WIN32\"" + PreprocessorDefinitions="NDEBUG;_WINDOWS;WIN32;_CTYPE_DISABLE_MACROS" RuntimeLibrary="2" PrecompiledHeaderFile=".\toolrelease/rrdtool.pch" AssemblerListingLocation=".\toolrelease/" @@ -81,7 +81,7 @@ Name="VCCLCompilerTool" Optimization="0" AdditionalIncludeDirectories="\Program Files\GnuWin32\include\freetype2,\Program Files\GnuWin32\include" - PreprocessorDefinitions="_DEBUG;_CONSOLE;WIN32;_CTYPE_DISABLE_MACROS;MAKE_TIMESTAMP=\"WIN32\"" + PreprocessorDefinitions="_DEBUG;_CONSOLE;WIN32;_CTYPE_DISABLE_MACROS" RuntimeLibrary="2" PrecompiledHeaderFile=".\tooldebug/rrdtool.pch" AssemblerListingLocation=".\tooldebug/" -- 2.11.0