1 # Hello, emacs: this is a -*- Makefile -*-
2 # $Id: makefile.mgw,v 1.41.2.5 2009/02/11 10:00:32 mikulik Exp $
4 # GNUPLOT Makefile for MinGW32 MinGW32 on WinNT and Win95/98/..
5 # This assumes that MinGW32 is used via the MSYS toolkit
6 # (needed some changes to work around command line parsing gotchas)
9 # To compile gnuplot for WinXX:
11 # - compile the package: go to directory 'gnuplot' and therefrom run
12 # make -C src -f ../config/makefile.mgw
14 # This makefile was tested with MSYS, MingW32 and Microsoft Help
19 # ************** Begin of Configuration section ************************
22 # Comment out the definition lines to disable the according features:
24 # GIF, PNG, JPEG device drivers
25 # Requires gd library. There are two possibilities how to configure these
26 # drivers for use in gnuplot, depending on the gd version. See README.1ST for
29 # You should compile gnuplot with GD library v2.0 or newer.
30 # This library writes PNG, GIF and JPEG images.
31 # If libgd has been compiled with TrueType font support, then you can use
32 # scaled TrueType fonts. If not, then uncomment FREETYPE.
33 # Requires GD, PNG and Z libraries, optionally libfreetype.
34 # In some cases, libfreetype can depend on additional libraries such as
35 # fontconfig or iconv; then, uncomment GDAUTOCONFIGLIBS so that all of the
36 # libraries needed for linking will be taken by running 'gdlib-config'.
44 # Requires PNG and Z libraries based on particular PDF library used, and
45 # optionally also TIFF library according to
46 # 1. defined PDF_NOTIFF:
47 # 'Light' pdf library (produces wgnuplot.exe only 200 KB larger!)
48 # You can get this pdf library by compiling it without PNG, GD and TIFF
49 # support: change pdflib/p_intern.h and recompile the pdf library.
50 # Gnuplot does not use the tiff routines, and gd/png are elsewhere.
51 # 2. undefined PDF_NOTIFF:
52 # Full pdf library (produces wgnuplot.exe 500 KB larger!)
57 # creates binaries suitable for debugging. Some bugs may come and go
58 # as opposed to a production build since we lower the optimization level
61 # MOUSE support for the windows terminal
64 # PIPES: define if you would prefer support of pipes undef Windows (e.g.
65 # plot '<awk -f preprocess.awk my.dat'). Drawback: wgnuplot.exe keeps attached
66 # to a console=DOS window it was launched from, or it opens a new one.
67 # Also does not work properly with pgnuplot.
70 # WXWIDGETS interactive terminal
71 # Requires wxWidgets, Cairo, Pango, and their respective dependencies.
72 # Uncomment the following lines to compile it.
73 # WXT_LOCATION should give the path where can be found wx/*.h headers
75 #WX_LOCATION=/usr/local/include/wx-2.6
77 # Below you can adapt paths according to your software setup:
79 # Where to place gnuplot.gih helpfile:
80 HELPFILE = wgnuplot.hlp
82 # Where to install the PostScript prologue files, relatively to the executable
84 GNUPLOT_PS_DIR = share/PostScript
86 # Destination directory, used in 'make install':
87 DESTDIR = /c/Progra~1/Gnuplot4.2
89 # give here the path to MinGW compiler unless it is already in PATH
90 #GCCPATH = g:/mingw32/bin/
91 #GCCPATH = c:/apps/mingw/bin/
93 # Do you want some special optimization?
94 # -mpentium means optimise for Pentium processor
95 # -mpentiumpro means optimize for Pentium II and Pro procesors
99 # To compile the .hlp file you need hcw either out of Microsoft SDK or MS Help
100 # Workshop. The latter can be obtained from either of
101 # ftp://ftp.microsoft.com/softlib/mslfiles/hcwsetup.exe
102 # http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=34D35502-4DE9-4676-952C-34CC7F64F098
103 # Put the path to hcw here unless it is already in PATH:
104 HCWPATH = /c/Program\ Files/Help\ Workshop/
106 # Switches are for HCW 4.03:
109 # Choose which windres/rc do you want to use (GNU windres or MS RC):
112 # If uncommented GNU_RC above and rc.exe not in PATH, then set:
120 # *************** End of Configuration section *************************
124 # There shouldn't be anything to be changed below this line
125 # **********************************************************************
151 TERMFLAGS = -DGNUPLOT_PS_DIR=\"$(GNUPLOT_PS_DIR)\" -I$(TOP)/term
154 CFLAGS += -I$(TOP) -I. -D_Windows -DHAVE_CONFIG_H\
158 CFLAGS += -DUSE_MOUSE=1 -DWIN_IPC
167 CFLAGS += -DHAVE_LIBGD
172 CFLAGS += -DHAVE_LIBPNG
173 ifndef GDAUTOCONFIGLIBS
174 TERMLIBS += -lpng -lz
179 CFLAGS += -DHAVE_GD_GIF -DGIF_ANIMATION -DHAVE_GD_PNG
181 CFLAGS += -DHAVE_GD_JPEG
182 ifndef GDAUTOCONFIGLIBS
187 CFLAGS += -DHAVE_GD_TTF
188 ifndef GDAUTOCONFIGLIBS
189 TERMLIBS += -lfreetype
192 ifdef GDAUTOCONFIGLIBS
193 TERMLIBS += $(shell gdlib-config --libs)
198 CFLAGS += -DHAVE_LIBPDF
200 TERMLIBS += -lpdf_notiff
202 TERMLIBS += -lpdf -ltiff
203 # TERMLIBS += -lpdf-w -ltiff-w
213 CFLAGS += -DHAVE_LIBPNG
214 TERMLIBS += -lpng-w -lz-w
219 CFLAGS += -DWXWIDGETS
220 CXXFLAGS += $(shell wx-config --cxxflags)
221 CAIRO_CFLAGS = $(shell pkg-config --cflags cairo)
222 CAIRO_LIBS = $(shell pkg-config --libs cairo)
223 PANGO_CFLAGS = $(shell pkg-config --cflags pangocairo)
224 PANGO_LIBS = $(shell pkg-config --libs pangocairo)
225 WX_LIBS = $(shell wx-config --libs)
226 WX_OBJS = wxt_gui.o gp_cairo.o
230 # RC = d:/cygnus/cygwin-b20/H-i586-cygwin32/bin/windres
231 RC = $(GCCPATH)windres
232 RCFLAGS = --include-dir /mingw32/include \
234 --define __WIN32__ --define __WIN95__ --define MSRC \
235 --define __GNUWIN32__ --use-temp-file
237 RCFLAGS += --define WXWIDGETS --include-dir=$(WX_LOCATION)
240 RES2COFF = echo wgplt_res.o
243 RCFLAGS = -v -i$(MSSDK)/include -iwin -dWIN32 -dMSRC
245 RCFLAGS += -dWXWIDGETS -i$(WX_LOCATION)
247 RCOUT = -fowgnuplot.res
248 RES2COFF = res2coff -i wgnuplot.res -o wgplt_res.o
251 # macros for makefile.all
255 L=docs/latex/ # HBB FIXME 20060430: what's this for?
259 default: wgnuplot.exe $(HELPFILE) wgnuplot.mnu $(M)bf_test.exe \
262 all: default gnuplot.ps gnuplot.pdf
265 # include the 'core makefile template'
268 OBJS = $(COREOBJS) version.$(O) gpexecute.$(O) $(WX_OBJS)
270 WINOBJS = winmain.$(O) wgnuplib.$(O) wgraph.$(O) wprinter.$(O) wtext.$(O) wpause.$(O) wmenu.$(O)
272 WINDOWS = makefile.win makefile.nt README.win win/wcommon.h \
273 win/wgnuplib.c win/wgnuplib.def win/wgnuplib.h win/wgnuplib.rc \
274 win/wgnuplot.def win/wgnuplot.hpj win/wgnuplot.mnu win/wgraph.c \
275 win/winmain.c win/wmenu.c win/wpause.c win/wprinter.c \
276 win/wresourc.h win/wtext.c win/wtext.h win/geticon.c \
277 $(D)doc2rtf.c $(T)win.trm win/grpicon.ico win/texticon.ico
281 .SUFFIXES: .exe .o .c
283 $(CC) -c $(CFLAGS) $*.c
285 LDLIBS = -lkernel32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32 -lshell32 -ladvapi32
290 config.h: ../config/config.mgw
293 $(OBJS) $(WINOBJS) dbinary.$(O): config.h
295 wgnuplot.exe: $(OBJS) $(WINOBJS) win/wgnuplot.def wgplt_res.o texticon.ico grpicon.ico
296 $(LDX) $(LDFLAGS) $(LDFLAGS2) -mwindows -o $@ $(OBJS) $(WINOBJS) wgplt_res.o $(LDLIBS)\
297 $(TERMLIBS) $(WX_LIBS) $(CAIRO_LIBS) $(PANGO_LIBS)
299 pgnuplot.exe: win/pgnuplot.c version.o
300 $(CC) -O2 -DHAVE_STDBOOL_H -s -o pgnuplot.exe win/pgnuplot.c version.o -I. -luser32
304 wgplt_res.o : win/wgnuplot.rc win/wgnuplib.rc win/wresourc.h texticon.ico grpicon.ico
305 $(RC) $(RCFLAGS) --include-dir=win win/wgnuplot.rc $(RCOUT)
308 show.o: show.c plot.h setshow.h
309 $(CC) -c $(CFLAGS) -DHELPFILE=\"$(HELPFILE)\" -DBINDIR=\"$(bindir)\" -c $<
311 term.$(O): term.c term.h plot.h setshow.h bitmap.h $(CORETERM)
312 $(CC) -c $(CFLAGS) $(TERMFLAGS) term.c
314 version.$(O): version.c
316 WINDEPS = win/wgnuplib.h win/wcommon.h win/wresourc.h
318 winmain.$(O): win/winmain.c win/wgnuplib.h win/wtext.h plot.h
319 $(CC) -c $(CFLAGS) -DHELPFILE=\"$(HELPFILE)\" win/winmain.c
321 wgnuplib.$(O): win/wgnuplib.c $(WINDEPS)
322 $(CC) -c $(CFLAGS) win/wgnuplib.c
324 wmenu.$(O): win/wmenu.c $(WINDEPS)
325 $(CC) -c $(CFLAGS) win/wmenu.c
327 wtext.$(O): win/wtext.c $(WINDEPS)
328 $(CC) -c $(CFLAGS) win/wtext.c
330 wpause.$(O): win/wpause.c wxterminal/wxt_term.h $(WINDEPS)
331 $(CC) -c $(CFLAGS) win/wpause.c
333 wprinter.$(O): win/wprinter.c $(WINDEPS)
334 $(CC) -c $(CFLAGS) win/wprinter.c
336 wgraph.$(O): win/wgraph.c $(WINDEPS)
337 $(CC) -c $(CFLAGS) win/wgraph.c
339 wgnuplot.mnu: win/wgnuplot.mnu
342 wxt_gui.$(O): wxterminal/wxt_gui.cpp wxterminal/wxt_gui.h $(WX_LOCATION)
343 $(CXX) -c $(CFLAGS) $(CXXFLAGS) $(CAIRO_CFLAGS) wxterminal/wxt_gui.cpp
345 gp_cairo.$(O): wxterminal/gp_cairo.c wxterminal/gp_cairo.h
346 $(CC) -c $(CFLAGS) $(CXXFLAGS) $(CAIRO_CFLAGS) $(PANGO_CFLAGS) wxterminal/gp_cairo.c
348 # extract icons from wgnuplot.rc
349 texticon.ico: grpicon.ico
351 grpicon.ico: geticon.exe win/wgnuplot.rc
352 ./geticon win/wgnuplot.rc
354 geticon.exe: win/geticon.c
355 $(LD) $(LDFLAGS) -o $@ win/geticon.c
357 # convert gnuplot.doc to gnuplot.rtf
358 $(HELPFILE): doc2rtf.exe $(D)gnuplot.doc win/wgnuplot.hpj
359 ./doc2rtf $(D)gnuplot.doc win/gnuplot.rtf
360 $(HCW) -c -e win/wgnuplot.hpj
362 doc2rtf.exe: $(D)doc2rtf.c $(D)termdoc.c $(D)xref.c
363 $(LD) $(LDFLAGS) -o $@ -DWINDOWS_NO_GUI $(CFLAGS) -I. -I$(D:/=) -I$(T:/=) $^
365 #make binary demo files
366 $(M)bf_test.exe : bf_test.c dbinary.$(O) alloc.$(O)
367 $(LD) $(LDFLAGS) $(CFLAGS) -U_Windows -o $@ $^
368 (cd $(M) ; ./bf_test.exe )
371 # _Windows causes wtext.h to define fread() etc
372 dbinary.$(O): binary.c
373 $(CC) -c $(CFLAGS) -U_Windows -o $@ $<
376 # Create documentation in various formats
379 ifdef ALL_TERMINALS_DOC
380 # Generate TeX documentation with the complete list of all terminals
381 # (gnuplot.tex should be the same on all platforms):
384 # sort alphabetically all terminals (note: req. GNU sort, not from MS)
385 allterm.h: $(CORETERM)
386 @echo "Building allterm.h"
387 @for e in `egrep "^[ ]*START_HELP" $(CORETERM) |\
388 $(GNUSORT) -f -t':' -k2` ; do \
389 f=`echo $$e |cut -d\: -f1` ; s=`echo $$e | cut -d\: -f2` ;\
390 sed -n "/^[ ]*$$s/,/^[ ]*END_HELP/p" $$f ; \
393 # sequence of terminals according to "ls term/*.trm":
394 allterm.h: $(CORETERM)
395 @echo "Building allterm.h"
396 @cat $(T)*.trm > allterm.c
397 $(CPP) $(CFLAGS) -I$(T:/=) -DTERM_DRIVER_H -DTERM_HELP allterm.c | \
398 sed '/^ *$$/d;/^#/d' > allterm.h
401 doc2tex.exe: $(D)doc2tex.c $(D)termdoc.c allterm.h
402 $(LD) $(LDFLAGS) -o $@ -DWINDOWS_NO_GUI -DALL_TERM_DOC $(CFLAGS) \
403 -I. -I$(D:/=) -I$(T:/=) $(D)doc2tex.c $(D)termdoc.c
405 # Old version: generate documentation with only currently used terminals:
406 doc2tex.exe: $(D)doc2tex.c $(D)termdoc.c
407 $(LD) $(LDFLAGS) -o $@ -DWINDOWS_NO_GUI $(CFLAGS) -I. -I$(D) -I$(T) $^
410 gnuplot.tex: $(D)gnuplot.doc doc2tex.exe
411 doc2tex $(D)gnuplot.doc gnuplot.tex
413 # Call LaTeX three times to get the toc right.
414 gnuplot.dvi: gnuplot.tex $(D)titlepag.tex
415 cp gnuplot.tex $(D)gp_tex2.tex
416 cp $(D)../VERSION $(D)
417 cd $(D) && latex gp_tex2.tex && latex gp_tex2.tex && latex gp_tex2.tex
418 mv $(D)gp_tex2.dvi gnuplot.dvi
420 gnuplot.ps: gnuplot.dvi
421 dvips -o gnuplot.ps gnuplot.dvi
422 gnuplot.pdf: gnuplot.tex $(D)titlepag.tex
423 cp gnuplot.tex $(D)gp_tex2.tex
424 cp $(D)../VERSION $(D)
425 cd $(D) && pdflatex gp_tex2.tex && pdflatex gp_tex2.tex && pdflatex gp_tex2.tex
426 mv $(D)gp_tex2.pdf gnuplot.pdf
430 # clean up temporary files
432 $(RM) config.h *.$(O) wgnuplot.map wgnuplot.res win/gnuplot.rtf
433 $(RM) wxterminal/*.$(O)
434 $(RM) doc2rtf.exe win/wgnuplib.res wgnuplib.map wgnuplot.lib
435 $(RM) $(M)bf_test.exe *.ico geticon.exe allterm.h allterm.c
436 $(RM) gnuplot.tex gnuplot.dvi gnuplot.ps gnuplot.pdf
440 $(RM) wgnuplot.exe wgnuplot.hlp wgnuplot.mnu wgnuplot.gid
441 $(RM) $(M)binary[123] $(M)fit.log $(M)soundfit.par
443 # now move the whole stuff to its destination
446 cp wgnuplot.exe $(DESTDIR)/wgnuplot.exe
447 cp win/wgnuplot.mnu $(DESTDIR)/wgnuplot.mnu
448 cp wgnuplot.hlp $(DESTDIR)/wgnuplot.hlp
449 cp pgnuplot.exe $(DESTDIR)/pgnuplot.exe
450 mkdir -p $(DESTDIR)/share/PostScript
451 cp ../term/PostScript/*.ps $(DESTDIR)/$(GNUPLOT_PS_DIR)