# 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 += -fno-strict-aliasing -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) >> $@