Changed russian description a little bit
[gnuplot] / config / makefile.cyg
1 # Hey, Emacs, this is a -*- Makefile -*-
2 #
3 # $Id: makefile.cyg,v 1.27.2.2 2008/02/23 11:19:39 mikulik Exp $
4 #
5 #
6 # GNUPLOT Makefile for Cygwin on WinNT and Win95/98/2000
7 #
8 # To compile gnuplot for WinXX:
9 #
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
12 #   things.
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
19 #
20
21 #
22 # ************** Begin of Configuration section ************************
23
24 #
25
26 # Comment out the definition lines to disable the according features:
27
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
31 # more details. 
32 #
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.
38 #
39 NEWGD=1
40 JPEG=1
41 FREETYPE=1
42
43 # PDF device driver
44 # may require PNG and Z libraries based on particular PDF library used
45 #PDF=1
46
47 # DEBUGging support
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
50 #DEBUG=1
51
52 # MOUSE support for the windows terminal
53 MOUSE=1
54
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.
59 #PIPES=1
60
61 # Below you can adapt paths according to your software setup:
62
63 # Where to place gnuplot.gih helpfile:
64 HELPFILE = wgnuplot.hlp
65
66 # Where to install the PostScript prologue files, relatively to the executable
67 # wgnuplot.exe
68 GNUPLOT_PS_DIR = share/PostScript
69
70 # Destination directory, used in 'make install':
71 DESTDIR = /cygdrive/c/Apps/gnuplot
72
73 # give here the path to Gygwin GCC compiler unless it is already in PATH
74
75 #GCCPATH = /bin/
76 #GCCPATH =
77
78 # Do you want some special optimization?
79 CFLAGS =
80
81
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/
86 HCW = $(HCWPATH)hcw
87 # Switches are for HCW 4.03:
88 HCWFLAG =
89
90 # Choose which windres/rc do you want to use (GNU windres or MS RC):
91 GNU_RC = 1
92 ifndef GNU_RC
93   # If uncommented GNU_RC above and rc.exe not in PATH, then set:
94   MSSDK = c:/mssdk
95 endif
96
97 # GNU sort
98 #GNUSORT = gsort.exe
99 GNUSORT = /usr/bin/sort
100
101 #
102 # *************** End of Configuration section *************************
103
104
105 #
106 #         There shouldn't be anything to be changed below this line
107 # **********************************************************************
108
109 #
110
111
112 CC = $(GCCPATH)gcc
113 LD = $(GCCPATH)gcc
114
115 RM = rm -f
116 CP = cp -p
117
118 ifdef DEBUG
119   CFLAGS += -g
120   LDFLAGS += -g
121 else
122   CFLAGS += -O2
123   LDFLAGS += -s
124 endif
125
126 ifdef PIPES
127   OPTS += -DPIPES
128   LDFLAGS2 = -mconsole
129 endif
130
131 TOP = ..
132 TERMFLAGS = -DGNUPLOT_PS_DIR=\"$(GNUPLOT_PS_DIR)\" -I$(TOP)/term
133 TERMLIBS =
134
135 CFLAGS += -I. -D_Windows -DCYGWIN -mno-cygwin -DHAVE_CONFIG_H\
136         $(OPTS)
137
138 # -I/usr/local/include
139
140 ifdef MOUSE
141   CFLAGS += -DUSE_MOUSE=1 -DWIN_IPC
142 endif
143
144 ifdef NEWGD
145   GD=1
146   PNG=1
147 endif
148
149 ifdef GD
150   CFLAGS += -DHAVE_LIBGD
151   TERMLIBS += -lgd
152 endif
153
154 ifdef PNG
155   CFLAGS += -DHAVE_LIBPNG
156   TERMLIBS += -lpng -lz
157 endif
158
159 ifdef NEWGD
160   CFLAGS += -DHAVE_GD_GIF -DGIF_ANIMATION -DHAVE_GD_PNG
161 ifdef JPEG
162   CFLAGS += -DHAVE_GD_JPEG
163   TERMLIBS += -ljpeg
164 endif
165 ifdef FREETYPE
166   CFLAGS += -DHAVE_GD_TTF
167   TERMLIBS += -lfreetype
168 endif
169 endif
170
171 ifdef PDF
172   CFLAGS += -DHAVE_LIBPDF
173   TERMLIBS += -lpdf-w -ltiff-w
174 ifndef PNG
175   NEED_PNG_W = 1
176 else
177 ifndef NEWGD
178   NEED_PNG_W = 1
179 endif
180 endif
181 ifdef NEED_PNG_W
182   CFLAGS += -DHAVE_LIBPNG
183   TERMLIBS += -lpng-w -lz-w
184 endif
185 endif
186
187 ifdef GNU_RC
188   # RC = /bin/windres
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)
195 else
196   RC = $(MSSDK)/bin/rc
197   RCFLAGS = -v -i$(MSSDK)/include -iwin \
198         -dWIN32 -dMSRC
199   RCOUT = -fowgnuplot.res
200   RES2COFF = res2coff -i wgnuplot.res -o wgplt_res.$(O)
201 endif
202
203 # macros for makefile.all
204 O=o
205 T=../term/
206 D=../docs/
207 L=docs/latex/
208 M=../demo/
209
210
211 default: wgnuplot.exe $(HELPFILE) wgnuplot.mnu $(M)bf_test.exe pgnuplot.exe
212
213 all: default gnuplot.ps gnuplot.pdf
214
215
216 # include the 'core makefile template'
217 include makefile.all
218
219 OBJS = $(COREOBJS) version.$(O) gpexecute.$(O)
220
221 WINOBJS = winmain.$(O) wgnuplib.$(O) wgraph.$(O) wprinter.$(O) wtext.$(O) \
222         wpause.$(O) wmenu.$(O)
223
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
230
231
232 # default rules
233 .SUFFIXES: .exe .o .c
234 .c.o:
235         $(CC) -c $(CFLAGS) $*.c
236
237 LDLIBS = -L/usr/local/lib -lkernel32 -lgdi32
238
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)
242
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
246
247
248 # Rules:
249
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
252         $(RES2COFF)
253
254 show.$(O): show.c plot.h setshow.h
255         $(CC) -c $(CFLAGS) -DHELPFILE=\"$(HELPFILE)\" -DBINDIR=\"$(bindir)\" $<
256
257 term.$(O): term.c term.h plot.h setshow.h bitmap.h $(CORETERM)
258         $(CC) -c $(CFLAGS) $(TERMFLAGS) $<
259
260 version.$(O): version.c
261
262 WINDEPS = win/wgnuplib.h win/wcommon.h win/wresourc.h
263
264 winmain.$(O): win/winmain.c win/wgnuplib.h win/wtext.h plot.h
265         $(CC) -c $(CFLAGS) -DHELPFILE=\"$(HELPFILE)\"  win/winmain.c
266
267 wgnuplib.$(O): win/wgnuplib.c $(WINDEPS)
268         $(CC) -c $(CFLAGS) win/wgnuplib.c
269
270 wmenu.$(O): win/wmenu.c $(WINDEPS)
271         $(CC) -c $(CFLAGS) win/wmenu.c
272
273 wtext.$(O): win/wtext.c $(WINDEPS)
274         $(CC) -c $(CFLAGS) win/wtext.c
275
276 wpause.$(O): win/wpause.c $(WINDEPS)
277         $(CC) -c $(CFLAGS) win/wpause.c
278
279 wprinter.$(O): win/wprinter.c $(WINDEPS)
280         $(CC) -c $(CFLAGS) win/wprinter.c
281
282 wgraph.$(O): win/wgraph.c $(WINDEPS)
283         $(CC) -c $(CFLAGS) win/wgraph.c
284
285 wgnuplot.mnu: win/wgnuplot.mnu
286         $(CP) $^ $@
287
288 # extract icons from wgnuplot.rc
289 texticon.ico: grpicon.ico
290
291 grpicon.ico: geticon.exe win/wgnuplot.rc
292         ./geticon win/wgnuplot.rc
293
294 geticon.exe: win/geticon.c
295         $(LD) $(LDFLAGS) -o $@ win/geticon.c
296
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
301
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) $^
304
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 )
309
310 # _Windows causes wtext.h to define fread() etc
311 dbinary.$(O): binary.c
312         $(CC) -c $(CFLAGS) -U_Windows -o $@ $<
313
314
315 #
316 # Create config.h
317 #
318 $(OBJS) $(WINOBJS) dbinary.$(O): config.h
319 config.h: ../config/config.cyg
320         cp -p $< $@
321
322 # Create documentation in various formats
323 #
324 ALL_TERMINALS_DOC=1
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):
328 SORT_TERMINALS=1
329 ifdef SORT_TERMINALS
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 ; \
337         done >$@
338 else
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
345         @rm -f allterm.c
346 endif
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
349 else
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) $^
353 endif
354
355 gnuplot.tex: $(D)gnuplot.doc doc2tex.exe
356         doc2tex $(D)gnuplot.doc gnuplot.tex
357
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
364         rm -f $(D)gp_tex2.*
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
373         rm -f $(D)gp_tex2.*
374
375
376 # clean up temporary files
377 clean:
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
382
383 realclean: veryclean
384 veryclean: clean
385         $(RM) wgnuplot.exe wgnuplot.hlp wgnuplot.mnu wgnuplot.gid
386         $(RM) $(M)binary[123] $(M)fit.log $(M)soundfit.par
387         $(RM) pgnuplot.exe
388
389 # now move the whole stuff to its destination
390 install: default
391         mkdir -p $(DESTDIR)
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