1 # Hey, Emacs, this is a -*- Makefile -*-
3 # $Id: makefile.cyg,v 1.27.2.2 2008/02/23 11:19:39 mikulik Exp $
6 # GNUPLOT Makefile for Cygwin on WinNT and Win95/98/2000
8 # To compile gnuplot for WinXX:
10 # - check the beginning of this file settings you may want to change
11 # You'll have to tell it where to find the Help Compiler, among other
13 # - compile the package: go to directory 'gnuplot' and therefrom run
14 # make -C src -f ../config/makefile.cyg
15 # - resource compiler used is windres.exe in Cygwin
16 # - note pdf, png, and gif libraries if used have to be build for Cygwin
17 # with -mno-cygwin option
18 # - -static used for static linking to libz-w.a and libpng-w.a
22 # ************** Begin of Configuration section ************************
26 # Comment out the definition lines to disable the according features:
28 # GIF, PNG, JPEG device drivers
29 # Requires gd library. There are two possibilities how to configure these
30 # drivers for use in gnuplot, depending on the gd version. See README.1ST for
33 # You should compile gnuplot with GD library v2.0 or newer.
34 # This library writes PNG, GIF and JPEG images.
35 # If libgd has been compiled with TrueType font support, then you can use
36 # scaled TrueType fonts in png images. If not, then uncomment FREETYPE.
37 # Requires GD, PNG and Z libraries, optionally libfreetype.
44 # may require PNG and Z libraries based on particular PDF library used
48 # creates binaries suitable for debugging. Some bugs may come and go
49 # as opposed to a production build since we lower the optimization level
52 # MOUSE support for the windows terminal
55 # PIPES: define if you would prefer support of pipes undef Windows (e.g.
56 # plot '<awk -f preprocess.awk my.dat'). Drawback: wgnuplot.exe keeps attached
57 # to a console=DOS window it was launched from, or it opens a new one.
58 # Also does not work properly with pgnuplot.
61 # Below you can adapt paths according to your software setup:
63 # Where to place gnuplot.gih helpfile:
64 HELPFILE = wgnuplot.hlp
66 # Where to install the PostScript prologue files, relatively to the executable
68 GNUPLOT_PS_DIR = share/PostScript
70 # Destination directory, used in 'make install':
71 DESTDIR = /cygdrive/c/Apps/gnuplot
73 # give here the path to Gygwin GCC compiler unless it is already in PATH
78 # Do you want some special optimization?
82 # To compile the .hlp file you need hcw either out of Microsoft SDK or MS Help
83 # Workshop. The latter can be obtained at www.helpmaster.com/help/devaids.htm.
84 # Put the path to hcw here unless it is already in PATH:
85 HCWPATH = /cygdrive/c/Program\ Files/Help\ Workshop/
87 # Switches are for HCW 4.03:
90 # Choose which windres/rc do you want to use (GNU windres or MS RC):
93 # If uncommented GNU_RC above and rc.exe not in PATH, then set:
99 GNUSORT = /usr/bin/sort
102 # *************** End of Configuration section *************************
106 # There shouldn't be anything to be changed below this line
107 # **********************************************************************
132 TERMFLAGS = -DGNUPLOT_PS_DIR=\"$(GNUPLOT_PS_DIR)\" -I$(TOP)/term
135 CFLAGS += -I. -D_Windows -DCYGWIN -mno-cygwin -DHAVE_CONFIG_H\
138 # -I/usr/local/include
141 CFLAGS += -DUSE_MOUSE=1 -DWIN_IPC
150 CFLAGS += -DHAVE_LIBGD
155 CFLAGS += -DHAVE_LIBPNG
156 TERMLIBS += -lpng -lz
160 CFLAGS += -DHAVE_GD_GIF -DGIF_ANIMATION -DHAVE_GD_PNG
162 CFLAGS += -DHAVE_GD_JPEG
166 CFLAGS += -DHAVE_GD_TTF
167 TERMLIBS += -lfreetype
172 CFLAGS += -DHAVE_LIBPDF
173 TERMLIBS += -lpdf-w -ltiff-w
182 CFLAGS += -DHAVE_LIBPNG
183 TERMLIBS += -lpng-w -lz-w
189 RC = $(GCCPATH)windres
190 RCFLAGS = --include-dir win \
191 --define __WIN32__ --define __WIN95__ --define MSRC \
192 --define __GNUWIN32__ --define WIN32
193 RCOUT = wgplt_res.$(O)
194 RES2COFF = echo wgplt_res.$(O)
197 RCFLAGS = -v -i$(MSSDK)/include -iwin \
199 RCOUT = -fowgnuplot.res
200 RES2COFF = res2coff -i wgnuplot.res -o wgplt_res.$(O)
203 # macros for makefile.all
211 default: wgnuplot.exe $(HELPFILE) wgnuplot.mnu $(M)bf_test.exe pgnuplot.exe
213 all: default gnuplot.ps gnuplot.pdf
216 # include the 'core makefile template'
219 OBJS = $(COREOBJS) version.$(O) gpexecute.$(O)
221 WINOBJS = winmain.$(O) wgnuplib.$(O) wgraph.$(O) wprinter.$(O) wtext.$(O) \
222 wpause.$(O) wmenu.$(O)
224 WINDOWS = makefile.win makefile.nt README.win win/wcommon.h \
225 win/wgnuplib.c win/wgnuplib.def win/wgnuplib.h win/wgnuplib.rc \
226 win/wgnuplot.def win/wgnuplot.hpj win/wgnuplot.mnu win/wgraph.c \
227 win/winmain.c win/wmenu.c win/wpause.c win/wprinter.c \
228 win/wresourc.h win/wtext.c win/wtext.h win/geticon.c \
229 $(D)doc2rtf.c $(T)win.trm win/grpicon.ico win/texticon.ico
233 .SUFFIXES: .exe .o .c
235 $(CC) -c $(CFLAGS) $*.c
237 LDLIBS = -L/usr/local/lib -lkernel32 -lgdi32
239 wgnuplot.exe: $(OBJS) $(WINOBJS) win/wgnuplot.def wgplt_res.$(O) texticon.ico grpicon.ico
240 $(LD) $(LDFLAGS) $(LDFLAGS2) -mwindows -mno-cygwin -o $@ \
241 $(OBJS) $(WINOBJS) wgplt_res.$(O) $(LDLIBS) $(TERMLIBS)
243 pgnuplot.exe: win/pgnuplot.c version.$(O)
244 gcc -O2 -s -mno-cygwin -DHAVE_STDBOOL_H -o $@ \
245 win/pgnuplot.c version.$(O) -I. -luser32
250 wgplt_res.$(O): win/wgnuplot.rc win/wgnuplib.rc win/wresourc.h texticon.ico grpicon.ico
251 $(RC) $(RCFLAGS) win/wgnuplot.rc $(RCOUT) --include-dir=win
254 show.$(O): show.c plot.h setshow.h
255 $(CC) -c $(CFLAGS) -DHELPFILE=\"$(HELPFILE)\" -DBINDIR=\"$(bindir)\" $<
257 term.$(O): term.c term.h plot.h setshow.h bitmap.h $(CORETERM)
258 $(CC) -c $(CFLAGS) $(TERMFLAGS) $<
260 version.$(O): version.c
262 WINDEPS = win/wgnuplib.h win/wcommon.h win/wresourc.h
264 winmain.$(O): win/winmain.c win/wgnuplib.h win/wtext.h plot.h
265 $(CC) -c $(CFLAGS) -DHELPFILE=\"$(HELPFILE)\" win/winmain.c
267 wgnuplib.$(O): win/wgnuplib.c $(WINDEPS)
268 $(CC) -c $(CFLAGS) win/wgnuplib.c
270 wmenu.$(O): win/wmenu.c $(WINDEPS)
271 $(CC) -c $(CFLAGS) win/wmenu.c
273 wtext.$(O): win/wtext.c $(WINDEPS)
274 $(CC) -c $(CFLAGS) win/wtext.c
276 wpause.$(O): win/wpause.c $(WINDEPS)
277 $(CC) -c $(CFLAGS) win/wpause.c
279 wprinter.$(O): win/wprinter.c $(WINDEPS)
280 $(CC) -c $(CFLAGS) win/wprinter.c
282 wgraph.$(O): win/wgraph.c $(WINDEPS)
283 $(CC) -c $(CFLAGS) win/wgraph.c
285 wgnuplot.mnu: win/wgnuplot.mnu
288 # extract icons from wgnuplot.rc
289 texticon.ico: grpicon.ico
291 grpicon.ico: geticon.exe win/wgnuplot.rc
292 ./geticon win/wgnuplot.rc
294 geticon.exe: win/geticon.c
295 $(LD) $(LDFLAGS) -o $@ win/geticon.c
297 # convert gnuplot.doc to gnuplot.rtf
298 $(HELPFILE): doc2rtf.exe $(D)gnuplot.doc win/wgnuplot.hpj
299 ./doc2rtf $(D)gnuplot.doc win/gnuplot.rtf
300 $(HCW) /c /e win/wgnuplot.hpj
302 doc2rtf.exe: $(D)doc2rtf.c $(D)termdoc.c $(D)xref.c
303 $(LD) $(LDFLAGS) -o $@ -DWINDOWS_NO_GUI $(CFLAGS) -I. -I$(D) -I$(T) $^
305 #make binary demo files
306 $(M)bf_test.exe : bf_test.c dbinary.$(O) alloc.$(O)
307 $(LD) $(LDFLAGS) $(CFLAGS) -U_Windows -o $@ $^
308 (cd ../demo ; ./bf_test.exe )
310 # _Windows causes wtext.h to define fread() etc
311 dbinary.$(O): binary.c
312 $(CC) -c $(CFLAGS) -U_Windows -o $@ $<
318 $(OBJS) $(WINOBJS) dbinary.$(O): config.h
319 config.h: ../config/config.cyg
322 # Create documentation in various formats
325 ifdef ALL_TERMINALS_DOC
326 # Generate TeX documentation with the complete list of all terminals
327 # (gnuplot.tex should be the same on all platforms):
330 # sort alphabetically all terminals (note: req. GNU sort, not from MS)
331 allterm.h: $(CORETERM)
332 @echo "Building allterm.h"
333 @for e in `egrep "^[ ]*START_HELP" $(CORETERM) |\
334 $(GNUSORT) -f -t':' -k2` ; do \
335 f=`echo $$e |cut -d\: -f1` ; s=`echo $$e | cut -d\: -f2` ;\
336 sed -n "/^[ ]*$$s/,/^[ ]*END_HELP/p" $$f ; \
339 # sequence of terminals according to "ls term/*.trm":
340 allterm.h: $(CORETERM)
341 @echo "Building allterm.h"
342 @cat ../term/*.trm > allterm.c
343 $(CPP) $(CFLAGS) -I$../term -DTERM_DRIVER_H -DTERM_HELP allterm.c | \
344 sed '/^ *$$/d;/^#/d' > allterm.h
347 doc2tex.exe: $(D)doc2tex.c $(D)termdoc.c allterm.h
348 $(LD) $(LDFLAGS) -o $@ -DWINDOWS_NO_GUI -DALL_TERM_DOC $(CFLAGS) -I. -I$(D) -I../term -I$(T) $(D)doc2tex.c $(D)termdoc.c
350 # Old version: generate documentation with only currently used terminals:
351 doc2tex.exe: $(D)doc2tex.c $(D)termdoc.c
352 $(LD) $(LDFLAGS) -o $@ -DWINDOWS_NO_GUI $(CFLAGS) -I. -I$(D) -I$(T) $^
355 gnuplot.tex: $(D)gnuplot.doc doc2tex.exe
356 doc2tex $(D)gnuplot.doc gnuplot.tex
358 # Call LaTeX three times to get the toc right.
359 gnuplot.dvi: gnuplot.tex $(D)titlepag.tex
360 cp gnuplot.tex $(D)gp_tex2.tex
361 cp $(D)../VERSION $(D)
362 cd $(D) && latex gp_tex2.tex && latex gp_tex2.tex && latex gp_tex2.tex
363 mv $(D)gp_tex2.dvi gnuplot.dvi
365 gnuplot.ps: gnuplot.dvi
366 dvips -o gnuplot.ps gnuplot.dvi
367 gnuplot.pdf: gnuplot.tex $(D)titlepag.tex
368 cp gnuplot.tex $(D)gp_tex2.tex
369 cp $(D)../VERSION $(D)
370 cd $(D) && pdflatex gp_tex2.tex && pdflatex gp_tex2.tex \
371 && pdflatex gp_tex2.tex
372 mv $(D)gp_tex2.pdf gnuplot.pdf
376 # clean up temporary files
378 $(RM) config.h *.$(O) wgnuplot.map wgnuplot.res win/gnuplot.rtf
379 $(RM) doc2rtf.exe win/wgnuplib.res wgnuplib.map wgnuplot.lib
380 $(RM) $(M)bf_test.exe *.ico geticon.exe allterm.h allterm.c
381 $(RM) gnuplot.tex gnuplot.dvi gnuplot.ps gnuplot.pdf
385 $(RM) wgnuplot.exe wgnuplot.hlp wgnuplot.mnu wgnuplot.gid
386 $(RM) $(M)binary[123] $(M)fit.log $(M)soundfit.par
389 # now move the whole stuff to its destination
392 cp wgnuplot.exe $(DESTDIR)/wgnuplot.exe
393 cp win/wgnuplot.mnu $(DESTDIR)/wgnuplot.mnu
394 cp wgnuplot.hlp $(DESTDIR)/wgnuplot.hlp
395 cp pgnuplot.exe $(DESTDIR)/pgnuplot.exe