Initial release of Maemo 5 port of gnuplot
[gnuplot] / config / makefile.mgw
diff --git a/config/makefile.mgw b/config/makefile.mgw
new file mode 100644 (file)
index 0000000..1890b22
--- /dev/null
@@ -0,0 +1,451 @@
+# Hello, emacs: this is a -*- Makefile -*-
+# $Id: makefile.mgw,v 1.41.2.5 2009/02/11 10:00:32 mikulik Exp $
+#
+# GNUPLOT Makefile for MinGW32 MinGW32 on WinNT and Win95/98/..
+#  This assumes that MinGW32 is used via the MSYS toolkit
+#  (needed some changes to work around command line parsing gotchas)
+#
+
+# To compile gnuplot for WinXX:
+#
+# - compile the package: go to directory 'gnuplot' and therefrom run
+#       make -C src -f ../config/makefile.mgw
+#
+# This makefile was tested with MSYS, MingW32 and Microsoft Help
+# Workshop 4.03.
+#
+
+#
+# ************** Begin of Configuration section ************************
+#
+
+# Comment out the definition lines to disable the according features:
+
+# GIF, PNG, JPEG device drivers
+# Requires gd library. There are two possibilities how to configure these
+# drivers for use in gnuplot, depending on the gd version. See README.1ST for
+# more details. 
+#
+# You should compile gnuplot with GD library v2.0 or newer.
+# This library writes PNG, GIF and JPEG images.
+# If libgd has been compiled with TrueType font support, then you can use
+# scaled TrueType fonts. If not, then uncomment FREETYPE.
+# Requires GD, PNG and Z libraries, optionally libfreetype.
+# In some cases, libfreetype can depend on additional libraries such as
+# fontconfig or iconv; then, uncomment GDAUTOCONFIGLIBS so that all of the
+# libraries needed for linking will be taken by running 'gdlib-config'.
+#
+NEWGD=1
+JPEG=1
+FREETYPE=1
+#GDAUTOCONFIGLIBS=1
+
+# PDF device driver
+# Requires PNG and Z libraries based on particular PDF library used, and
+# optionally also TIFF library according to
+# 1. defined PDF_NOTIFF:
+#    'Light' pdf library (produces wgnuplot.exe only 200 KB larger!)
+#    You can get this pdf library by compiling it without PNG, GD and TIFF
+#    support: change  pdflib/p_intern.h  and recompile the pdf library.
+#    Gnuplot does not use the tiff routines, and gd/png are elsewhere.
+# 2. undefined PDF_NOTIFF:
+#    Full pdf library (produces wgnuplot.exe 500 KB larger!)
+#PDF=1
+#PDF_NOTIFF=1
+
+# DEBUGging support
+# creates binaries suitable for debugging. Some bugs may come and go
+# as opposed to a production build since we lower the optimization level
+#DEBUG=1
+
+# MOUSE support for the windows terminal
+MOUSE=1
+
+# PIPES: define if you would prefer support of pipes undef Windows (e.g.
+# plot '<awk -f preprocess.awk my.dat'). Drawback: wgnuplot.exe keeps attached
+# to a console=DOS window it was launched from, or it opens a new one.
+# Also does not work properly with pgnuplot.
+#PIPES=1
+
+# WXWIDGETS interactive terminal
+# Requires wxWidgets, Cairo, Pango, and their respective dependencies.
+# Uncomment the following lines to compile it.
+# WXT_LOCATION should give the path where can be found wx/*.h headers
+#WXT=1
+#WX_LOCATION=/usr/local/include/wx-2.6
+
+# Below you can adapt paths according to your software setup:
+
+# Where to place gnuplot.gih helpfile:
+HELPFILE = wgnuplot.hlp
+
+# Where to install the PostScript prologue files, relatively to the executable
+# wgnuplot.exe
+GNUPLOT_PS_DIR = share/PostScript
+
+# Destination directory, used in 'make install':
+DESTDIR = /c/Progra~1/Gnuplot4.2
+
+# give here the path to MinGW compiler unless it is already in PATH
+#GCCPATH = g:/mingw32/bin/
+#GCCPATH = c:/apps/mingw/bin/
+
+# Do you want some special optimization?
+# -mpentium means optimise for Pentium processor
+# -mpentiumpro means optimize for Pentium II and Pro procesors
+CFLAGS =
+
+
+# To compile the .hlp file you need hcw either out of Microsoft SDK or MS Help
+# Workshop. The latter can be obtained from either of
+# ftp://ftp.microsoft.com/softlib/mslfiles/hcwsetup.exe
+# http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=34D35502-4DE9-4676-952C-34CC7F64F098
+# Put the path to hcw here unless it is already in PATH:
+HCWPATH = /c/Program\ Files/Help\ Workshop/
+HCW = $(HCWPATH)hcw
+# Switches are for HCW 4.03:
+HCWFLAG =
+
+# Choose which windres/rc do you want to use (GNU windres or MS RC):
+GNU_RC = 1
+ifndef GNU_RC
+  # If uncommented GNU_RC above and rc.exe not in PATH, then set:
+  MSSDK = c:/mssdk
+endif
+
+# GNU sort
+GNUSORT = /bin/sort
+
+#
+# *************** End of Configuration section *************************
+#
+
+
+#         There shouldn't be anything to be changed below this line
+# **********************************************************************
+#
+
+
+CC = $(GCCPATH)gcc
+LD = $(GCCPATH)gcc
+CXX = $(GCCPATH)g++
+LDX = $(GCCPATH)g++
+
+RM = rm -f
+CP = cp -p
+
+ifdef DEBUG
+  CFLAGS += -g
+  LDFLAGS += -g
+else
+  CFLAGS += -O2
+  LDFLAGS += -s
+endif
+
+ifdef PIPES
+  OPTS += -DPIPES
+  LDFLAGS2 = -mconsole
+endif
+
+TOP = ..
+TERMFLAGS = -DGNUPLOT_PS_DIR=\"$(GNUPLOT_PS_DIR)\" -I$(TOP)/term
+TERMLIBS = 
+
+CFLAGS += -I$(TOP) -I. -D_Windows -DHAVE_CONFIG_H\
+       $(OPTS)
+
+ifdef MOUSE
+  CFLAGS += -DUSE_MOUSE=1 -DWIN_IPC
+endif
+
+ifdef NEWGD
+  GD=1
+  PNG=1
+endif
+
+ifdef GD
+  CFLAGS += -DHAVE_LIBGD
+  TERMLIBS += -lgd
+endif
+
+ifdef PNG
+  CFLAGS += -DHAVE_LIBPNG
+  ifndef GDAUTOCONFIGLIBS
+    TERMLIBS += -lpng -lz
+  endif
+endif
+
+ifdef NEWGD
+  CFLAGS += -DHAVE_GD_GIF -DGIF_ANIMATION -DHAVE_GD_PNG
+ifdef JPEG
+  CFLAGS += -DHAVE_GD_JPEG
+  ifndef GDAUTOCONFIGLIBS
+    TERMLIBS += -ljpeg
+  endif
+endif
+ifdef FREETYPE
+  CFLAGS += -DHAVE_GD_TTF
+  ifndef GDAUTOCONFIGLIBS
+    TERMLIBS += -lfreetype
+  endif
+endif
+ifdef GDAUTOCONFIGLIBS
+  TERMLIBS += $(shell gdlib-config --libs)
+endif
+endif
+
+ifdef PDF
+  CFLAGS += -DHAVE_LIBPDF
+ifdef PDF_NOTIFF
+  TERMLIBS += -lpdf_notiff
+else
+  TERMLIBS += -lpdf -ltiff
+#  TERMLIBS += -lpdf-w -ltiff-w
+endif
+ifndef PNG
+  NEED_PNG_W = 1
+else
+ifndef NEWGD
+  NEED_PNG_W = 1
+endif
+endif
+ifdef NEED_PNG_W
+  CFLAGS += -DHAVE_LIBPNG
+  TERMLIBS += -lpng-w -lz-w
+endif
+endif
+
+ifdef WXT
+       CFLAGS += -DWXWIDGETS
+       CXXFLAGS += $(shell wx-config --cxxflags)
+       CAIRO_CFLAGS = $(shell pkg-config --cflags cairo)
+       CAIRO_LIBS = $(shell pkg-config --libs cairo)
+       PANGO_CFLAGS = $(shell pkg-config --cflags pangocairo)
+       PANGO_LIBS = $(shell pkg-config --libs pangocairo)
+       WX_LIBS = $(shell wx-config --libs)
+       WX_OBJS = wxt_gui.o gp_cairo.o
+endif
+
+ifdef GNU_RC
+  # RC = d:/cygnus/cygwin-b20/H-i586-cygwin32/bin/windres
+  RC  = $(GCCPATH)windres
+  RCFLAGS = --include-dir /mingw32/include \
+       --include-dir=win \
+       --define __WIN32__ --define __WIN95__ --define MSRC \
+       --define __GNUWIN32__ --use-temp-file
+  ifdef WXT
+       RCFLAGS += --define WXWIDGETS --include-dir=$(WX_LOCATION)
+  endif
+  RCOUT = wgplt_res.o
+  RES2COFF = echo wgplt_res.o
+else
+  RC = $(MSSDK)/bin/rc
+  RCFLAGS = -v -i$(MSSDK)/include -iwin -dWIN32 -dMSRC
+  ifdef WXT
+       RCFLAGS += -dWXWIDGETS -i$(WX_LOCATION)
+  endif
+  RCOUT = -fowgnuplot.res
+  RES2COFF = res2coff -i wgnuplot.res -o wgplt_res.o
+endif
+
+# macros for makefile.all
+O=o
+T=../term/
+D=../docs/
+L=docs/latex/                  # HBB FIXME 20060430: what's this for?
+M=../demo/
+
+
+default: wgnuplot.exe $(HELPFILE) wgnuplot.mnu $(M)bf_test.exe \
+       pgnuplot.exe
+
+all:   default gnuplot.ps gnuplot.pdf
+
+
+# include the 'core makefile template'
+include makefile.all
+
+OBJS = $(COREOBJS) version.$(O) gpexecute.$(O) $(WX_OBJS)
+
+WINOBJS = winmain.$(O) wgnuplib.$(O) wgraph.$(O) wprinter.$(O) wtext.$(O) wpause.$(O) wmenu.$(O)
+
+WINDOWS = makefile.win makefile.nt README.win win/wcommon.h \
+       win/wgnuplib.c win/wgnuplib.def win/wgnuplib.h win/wgnuplib.rc \
+       win/wgnuplot.def win/wgnuplot.hpj win/wgnuplot.mnu win/wgraph.c \
+       win/winmain.c win/wmenu.c win/wpause.c win/wprinter.c \
+       win/wresourc.h win/wtext.c win/wtext.h win/geticon.c \
+       $(D)doc2rtf.c $(T)win.trm win/grpicon.ico win/texticon.ico
+
+
+# default rules
+.SUFFIXES: .exe .o .c
+.c.o:
+       $(CC) -c $(CFLAGS) $*.c
+
+LDLIBS = -lkernel32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32 -lshell32 -ladvapi32
+
+#
+# Create config.h
+#
+config.h: ../config/config.mgw
+       cp $< $@
+
+$(OBJS) $(WINOBJS) dbinary.$(O): config.h
+
+wgnuplot.exe: $(OBJS) $(WINOBJS) win/wgnuplot.def wgplt_res.o texticon.ico grpicon.ico
+       $(LDX) $(LDFLAGS) $(LDFLAGS2) -mwindows -o $@ $(OBJS) $(WINOBJS) wgplt_res.o $(LDLIBS)\
+       $(TERMLIBS) $(WX_LIBS) $(CAIRO_LIBS) $(PANGO_LIBS)
+
+pgnuplot.exe: win/pgnuplot.c version.o
+       $(CC) -O2 -DHAVE_STDBOOL_H -s -o pgnuplot.exe win/pgnuplot.c version.o -I. -luser32
+
+# rules
+
+wgplt_res.o :  win/wgnuplot.rc win/wgnuplib.rc win/wresourc.h texticon.ico grpicon.ico
+       $(RC) $(RCFLAGS) --include-dir=win win/wgnuplot.rc $(RCOUT)
+       $(RES2COFF)
+
+show.o: show.c plot.h setshow.h
+       $(CC) -c $(CFLAGS) -DHELPFILE=\"$(HELPFILE)\" -DBINDIR=\"$(bindir)\" -c $<
+
+term.$(O): term.c term.h plot.h setshow.h bitmap.h $(CORETERM)
+       $(CC) -c $(CFLAGS) $(TERMFLAGS) term.c
+
+version.$(O): version.c
+
+WINDEPS = win/wgnuplib.h win/wcommon.h win/wresourc.h
+
+winmain.$(O): win/winmain.c win/wgnuplib.h win/wtext.h plot.h
+       $(CC) -c $(CFLAGS) -DHELPFILE=\"$(HELPFILE)\"  win/winmain.c
+
+wgnuplib.$(O): win/wgnuplib.c $(WINDEPS)
+       $(CC) -c $(CFLAGS) win/wgnuplib.c
+
+wmenu.$(O): win/wmenu.c $(WINDEPS)
+       $(CC) -c $(CFLAGS) win/wmenu.c
+
+wtext.$(O): win/wtext.c $(WINDEPS)
+       $(CC) -c $(CFLAGS) win/wtext.c
+
+wpause.$(O): win/wpause.c wxterminal/wxt_term.h $(WINDEPS)
+       $(CC) -c $(CFLAGS) win/wpause.c
+
+wprinter.$(O): win/wprinter.c $(WINDEPS)
+       $(CC) -c $(CFLAGS) win/wprinter.c
+
+wgraph.$(O): win/wgraph.c $(WINDEPS)
+       $(CC) -c $(CFLAGS) win/wgraph.c
+
+wgnuplot.mnu: win/wgnuplot.mnu
+       $(CP) $^ $@
+
+wxt_gui.$(O): wxterminal/wxt_gui.cpp wxterminal/wxt_gui.h $(WX_LOCATION)
+       $(CXX) -c $(CFLAGS) $(CXXFLAGS) $(CAIRO_CFLAGS) wxterminal/wxt_gui.cpp
+
+gp_cairo.$(O): wxterminal/gp_cairo.c wxterminal/gp_cairo.h
+       $(CC) -c $(CFLAGS) $(CXXFLAGS) $(CAIRO_CFLAGS) $(PANGO_CFLAGS) wxterminal/gp_cairo.c
+
+# extract icons from wgnuplot.rc
+texticon.ico: grpicon.ico
+
+grpicon.ico: geticon.exe win/wgnuplot.rc
+       ./geticon win/wgnuplot.rc
+
+geticon.exe: win/geticon.c
+       $(LD) $(LDFLAGS) -o $@ win/geticon.c
+
+# convert gnuplot.doc to gnuplot.rtf
+$(HELPFILE): doc2rtf.exe $(D)gnuplot.doc win/wgnuplot.hpj
+       ./doc2rtf $(D)gnuplot.doc win/gnuplot.rtf
+       $(HCW) -c -e win/wgnuplot.hpj
+
+doc2rtf.exe: $(D)doc2rtf.c $(D)termdoc.c $(D)xref.c
+       $(LD) $(LDFLAGS) -o $@ -DWINDOWS_NO_GUI $(CFLAGS) -I. -I$(D:/=) -I$(T:/=) $^
+
+#make binary demo files
+$(M)bf_test.exe : bf_test.c dbinary.$(O) alloc.$(O)
+       $(LD) $(LDFLAGS) $(CFLAGS) -U_Windows -o $@ $^
+       (cd $(M) ; ./bf_test.exe )
+#      cd ..
+
+# _Windows causes wtext.h to define fread() etc
+dbinary.$(O): binary.c
+       $(CC) -c $(CFLAGS) -U_Windows -o $@ $<
+
+
+# Create documentation in various formats
+#
+ALL_TERMINALS_DOC=1
+ifdef ALL_TERMINALS_DOC
+# Generate TeX documentation with the complete list of all terminals
+# (gnuplot.tex should be the same on all platforms):
+SORT_TERMINALS=1
+ifdef SORT_TERMINALS
+# sort alphabetically all terminals (note: req. GNU sort, not from MS)
+allterm.h: $(CORETERM)
+       @echo "Building allterm.h"
+       @for e in `egrep "^[    ]*START_HELP" $(CORETERM) |\
+            $(GNUSORT) -f -t':' -k2` ; do \
+         f=`echo $$e |cut -d\: -f1` ; s=`echo $$e | cut -d\: -f2` ;\
+         sed -n "/^[   ]*$$s/,/^[      ]*END_HELP/p" $$f ; \
+       done >$@
+else
+# sequence of terminals according to "ls term/*.trm":
+allterm.h: $(CORETERM)
+       @echo "Building allterm.h"
+       @cat $(T)*.trm > allterm.c
+       $(CPP) $(CFLAGS) -I$(T:/=) -DTERM_DRIVER_H -DTERM_HELP allterm.c | \
+         sed '/^ *$$/d;/^#/d' > allterm.h
+       @rm -f allterm.c
+endif
+doc2tex.exe: $(D)doc2tex.c $(D)termdoc.c allterm.h
+       $(LD) $(LDFLAGS) -o $@ -DWINDOWS_NO_GUI -DALL_TERM_DOC $(CFLAGS) \
+         -I. -I$(D:/=) -I$(T:/=) $(D)doc2tex.c $(D)termdoc.c
+else
+# Old version: generate documentation with only currently used terminals:
+doc2tex.exe: $(D)doc2tex.c $(D)termdoc.c
+       $(LD) $(LDFLAGS) -o $@ -DWINDOWS_NO_GUI $(CFLAGS) -I. -I$(D) -I$(T) $^
+endif
+
+gnuplot.tex: $(D)gnuplot.doc doc2tex.exe
+       doc2tex $(D)gnuplot.doc gnuplot.tex
+
+# Call LaTeX three times to get the toc right.
+gnuplot.dvi: gnuplot.tex $(D)titlepag.tex
+       cp gnuplot.tex $(D)gp_tex2.tex
+       cp $(D)../VERSION $(D)
+       cd $(D) && latex gp_tex2.tex && latex gp_tex2.tex && latex gp_tex2.tex
+       mv $(D)gp_tex2.dvi gnuplot.dvi
+       rm -f $(D)gp_tex2.*
+gnuplot.ps: gnuplot.dvi
+       dvips -o gnuplot.ps gnuplot.dvi
+gnuplot.pdf: gnuplot.tex $(D)titlepag.tex
+       cp gnuplot.tex $(D)gp_tex2.tex
+       cp $(D)../VERSION $(D)
+       cd $(D) && pdflatex gp_tex2.tex && pdflatex gp_tex2.tex && pdflatex gp_tex2.tex
+       mv $(D)gp_tex2.pdf gnuplot.pdf
+       rm -f $(D)gp_tex2.*
+
+
+# clean up temporary files
+clean:
+       $(RM) config.h *.$(O) wgnuplot.map wgnuplot.res win/gnuplot.rtf
+       $(RM) wxterminal/*.$(O)
+       $(RM) doc2rtf.exe win/wgnuplib.res wgnuplib.map wgnuplot.lib
+       $(RM) $(M)bf_test.exe *.ico geticon.exe allterm.h allterm.c
+       $(RM) gnuplot.tex gnuplot.dvi gnuplot.ps gnuplot.pdf
+
+realclean: veryclean
+veryclean: clean
+       $(RM) wgnuplot.exe wgnuplot.hlp wgnuplot.mnu wgnuplot.gid
+       $(RM) $(M)binary[123] $(M)fit.log $(M)soundfit.par
+
+# now move the whole stuff to its destination
+install: default
+       mkdir -p $(DESTDIR)
+       cp wgnuplot.exe $(DESTDIR)/wgnuplot.exe
+       cp win/wgnuplot.mnu $(DESTDIR)/wgnuplot.mnu
+       cp wgnuplot.hlp $(DESTDIR)/wgnuplot.hlp
+       cp pgnuplot.exe $(DESTDIR)/pgnuplot.exe
+       mkdir -p $(DESTDIR)/share/PostScript
+       cp ../term/PostScript/*.ps $(DESTDIR)/$(GNUPLOT_PS_DIR)