2 # $Id: makefile.os2,v 1.50.2.1 2008/02/23 11:21:24 mikulik Exp $
4 # GNUPLOT Makefile for use on OS/2 2.x (and above)
5 # using emx 0.9 (and above) and GNUMake
7 # To compile gnuplot, run the following command in directory gnuplot\src:
8 # make -f ..\config\makefile.os2
11 # The following tools and libraries are recommended/required to use this
12 # makefile out of the box:
13 # - GNU make, e.g. http://hobbes.nmsu.edu/pub/os2/dev/util/make-3.81beta3-r2-bin.zip
14 # - IPFC included in the OS/2 developer kit
15 # - emtex is only required for some parts of the documentation
17 # - GD library, http://hobbes.nmsu.edu/pub/os2/util/gd-2-0-33.zip
18 # - GNU readline, http://os2ports.com/ftp/pub/os2/unix/devtools/readline/readline4.1-os2.zip
19 # - PDFlib Lite 6.0 or later compiled for emx (available as source from http://www.pdflib.com/ )
20 # - XFree86 libraries, ftp://ftp.netlabs.org/pub/xfree86/4.5.0
22 # We depend on using cmd.exe (or a compatible one) and the
23 # standard OS/2 tool set. (additionally we use 'cat')
27 # ***************** Begin of Configuration section ***************************
31 # Comment out the definition lines to disable the according features:
35 # requires installed XFree86
38 # GIF, PNG, JPEG device drivers
39 # Requires gd library (not part of gnuplot)
41 # You can use the following set of options for GD library v2.0 something
42 # or newer. This library writes PNG, JPEG and GIF images.
43 # If libgd has been compiled with TrueType font support, then you can use
44 # scaled TrueType fonts in PNG images. If not, then uncomment FREETYPE.
45 # The pre-compiled GD library by Ilya Zakharevich available at
46 # http://hobbes.nmsu.edu/pub/os2/util/gd-2-0-33.zip
47 # is strongly recommended. This packages already includes the required
48 # GD, JPEG and Z and freetype libraries.
56 # requires PDFlib (not part of gnuplot)
60 # requires SVGA- and VESA Kit (not part of gnuplot)
63 # GNU_ReadLine support
64 # requires GNU readline library (static or DLL; not part of gnuplot)
67 # saving of history (no longer requires GNU readline)
71 # creates binaries suitable for debugging. Some bugs may come and go
72 # as opposed to a production build since we lower the optimization level
75 # MOUSE support for PM and X11 terminals
79 # ****************** End of Configuration section ****************************
86 .PHONY: all runtime alldocs demo binaries infomin clean veryclean
87 .SUFFIXES: .c .trm .o .obj .exe .rc .res .dll
89 # A reasonable default
94 @echo " Usage: $(MAKE) -f makefile.os2 target"
95 @echo " where target is one of:"
96 @echo " all runtime alldocs demo binaries infomin help clean veryclean"
99 # Definitions of flags and symbols used by makefile.all and makefile.os2
102 # these definitions are used by makefile.all
109 # Definitions valid for all targets on OS/2
118 # where to place gnuplot.gih helpfile
119 HELPFILE = $(DOCDIR)\gnuplot.gih
121 # Where to install the PostScript prologue files, relatively to the executable
123 GNUPLOT_PS_DIR = share/PostScript
126 # 3 sets of variables are defined and used to create
127 # 1: gnuplot.exe, and utilities
128 # 2: gnupmdrv.exe (the PM-driver executable)
135 # Flags for compiler and linker under OS/2
138 # Flags for compiling with EMX/GCC
139 # Special note: -ffloat-store is necessary to avoid some strange behaviour
141 # reset; set key; set xlabel "Year"; set xdata time; set timefmt "%y%m%d"
142 # set format x "%y"; set xrange ["900621" : "950126"];
143 # plot '-' using 1:2 title 'Fitted IO' with lines 1
147 # Confirmed for gcc 2.7.x/2.8.x; graphics.c used to be the culprit, but as
148 # of today (20010918) it isn't any more ...
150 EMXSPECIFIC = -DHAVE_CONFIG_H -ffloat-store
154 # Choose flags suitable for a debugging or for a production build
157 CFLAGS = -g $(OS2FLAGS) $(EMXSPECIFIC) -Wall -Wno-comment -O0 -Zmt
158 LDFLAGS = -g -Zmt -Zcrtdll -Zbsd-signals
159 CFLAGS2 = -g $(OS2FLAGS) $(EMXSPECIFIC) -Wall -O0 -Zmt -Zomf
160 LDFLAGS2 = -g -Zmt -Zcrtdll -Zbsd-signals -Zomf
162 CFLAGS = $(OS2FLAGS) $(EMXSPECIFIC) -O4 -mpentium -Wall -Wno-unused -Wno-comment -Zmt
163 LDFLAGS = -s -Zmt -Zcrtdll -Zbsd-signals
164 CFLAGS2 = $(OS2FLAGS) $(EMXSPECIFIC) -O4 -mpentium -Wall -Wno-unused -Zmt -Zomf
165 LDFLAGS2 = -s -Zmt -Zcrtdll -Zbsd-signals -Zomf
169 # Settings for the terminals to be included
171 TERMFLAGS = -DGNUPLOT_PS_DIR=\"$(GNUPLOT_PS_DIR)\" -I. -I.. -I$(T)
174 CFLAGS += -DHAVE_LIBGD -DHAVE_GD_H
177 CFLAGS += -DHAVE_GD_TTF
180 CFLAGS += -DHAVE_GD_PNG
183 CFLAGS += -DHAVE_GD_GIF -DGIF_ANIMATION
186 CFLAGS += -DHAVE_GD_JPEG
191 TERMFLAGS += -DHAVE_LIBPDF -DHAVE_PDFLIB_H
195 # SVGA-/VESAkit support
197 TERMFLAGS += -DEMXVESA
198 TERMLIBS += -ljmgraph -lvesa
203 TERMFLAGS += -DX11 -DX11_DRIVER_DIR=\".\"
208 TERMFLAGS += -DUSE_MOUSE
209 # the interprocess communication flag OS2_IPC is #defined in config.(os2,h)
212 # GNU readline support
214 CFLAGS += -DHAVE_LIBREADLINE
215 LIBS += -lreadline -ltermcap
218 # saving history (independent of GNU readline)
220 CFLAGS += -DGNUPLOT_HISTORY
226 # Do not name this variable "IPFC"!! This won't work out...
229 # Tools for buildings the docs
239 $(CC) $(CFLAGS) $(TERMFLAGS) -o $*.$(O) -c $*.c
241 $(CC2) $(CFLAGS2) $(TERMFLAGS) -o $*.obj -c $*.c
244 # Include dependencies valid for all platforms from makefile.all
250 # Pre-defined sets of targets:
253 alldocs: $(DOCDIR)\gnuplot.gih $(DOCDIR)\gnuplot.inf $(DOCDIR)\gnuplot.html \
254 $(DOCDIR)\gnuplot.info $(DOCDIR)\gnuplot.ps \
255 $(DOCDIR)\gnuplot.pdf
256 runtime: config.h binaries infomin $(DOCDIR)\gnuplot.inf
257 infomin: gnupmdrv.hlp $(DOCDIR)\gnuplot.gih
258 demo: $(M)binary1 $(M)binary2 $(M)binary3
260 binaries: gnuplot.exe gnupmdrv.exe gnuplot_x11.exe
262 binaries: gnuplot.exe gnupmdrv.exe
265 OBJS = $(COREOBJS) version.$(O)
269 term.$(O): $(CORETERM) term.h config.h $(OS2DIR)\pm_msgs.h
272 $(CC) $(LDFLAGS) -o $@ $(OBJS) $(TERMLIBS) $(LIBS)
275 # Build the PM outboard driver
277 $(OS2DIR)\gnupmdrv.$(O2): $(OS2DIR)\gnupmdrv.c $(OS2DIR)\gnupmdrv.h config.h
278 $(OS2DIR)\gclient.$(O2): $(OS2DIR)\gclient.c $(OS2DIR)\gnupmdrv.h config.h $(OS2DIR)\pm_msgs.h mouse.h
279 $(OS2DIR)\dialogs.$(O2): $(OS2DIR)\dialogs.c $(OS2DIR)\gnupmdrv.h config.h $(OS2DIR)\dialogs.h
280 $(OS2DIR)\print.$(O2): $(OS2DIR)\print.c $(OS2DIR)\gnupmdrv.h config.h
281 $(OS2DIR)\gpexecute.$(O2): gpexecute.c gpexecute.h
282 $(OS2DIR)\gnupmdrv.res : $(OS2DIR)\gnupmdrv.rc $(OS2DIR)\gnuplot.ico $(OS2DIR)\dialogs.h
283 cd $(OS2DIR) && rc -r gnupmdrv.rc & cd ..
285 OS2OBJ = $(OS2DIR)\gnupmdrv.$(O2) $(OS2DIR)\gclient.$(O2) $(OS2DIR)\print.$(O2) \
286 $(OS2DIR)\dialogs.$(O2) gpexecute.$(O2)
288 gnupmdrv.exe: $(OS2OBJ) $(OS2DIR)\gnupmdrv.res $(OS2DIR)\gnupmdrv.def
289 $(CC2) $(LDFLAGS2) -o $@ $(OS2OBJ) $(OS2DIR)\gnupmdrv.res $(OS2DIR)\gnupmdrv.def
291 gnupmdrv.hlp: $(OS2DIR)\gnupmdrv.ipf
292 # Cannot use the command
294 # because IPFC 2.1 does not support this syntax. Use instead:
295 copy $< . && $(IPF_C) gnupmdrv.ipf && del gnupmdrv.ipf
298 # Build the X11 outboard driver
302 X11LIBS = -L$(X11ROOT)/XFree86/lib -lX11 -lsocket -Zbsd-signals -Zcrtdll
304 X11INCLUDES = -I$(X11ROOT)/XFree86/include
305 X11FLAGS= -Zmt -D__UNIXOS2__ -DI_NEED_OS2_H
307 X11FLAGS += -DUSE_MOUSE
310 gnuplot_x11.exe: gplt_x11.o gpexecute.o getcolor_x11.o
311 $(CC) $(LDFLAGS) $(X11FLAGS) $(EMXSPECIFIC) -o $@ -DGPLT_X11_MODE $^ $(X11LIBS)
313 gplt_x11.o: gplt_x11.c mouse.h gpexecute.h config.h
314 $(CC) $(CFLAGS) $(X11FLAGS) $(EMXSPECIFIC) $(X11INCLUDES) -c -o $@ $<
316 getcolor_x11.o: getcolor.c
317 $(CC) $(CFLAGS) $(X11FLAGS) $(EMXSPECIFIC) -DGPLT_X11_MODE -c -o $@ $<
321 # This file is preferable over having explicit gcc command longer than 10 lines:
322 # gcc ... -DHAVE_ -DHAVE_ ... -DHAVE_ -DHAVE_ ... myfile.c
324 config.h: ..\config\config.os2
329 # Create documentation in various formats
331 # The idea behind the renaming business is that we may want to
332 # use various LaTeX systems which may choke if they find existing
333 # intermediate files from other systems.
334 # Call LaTeX three times to get the toc right.
335 $(DOCDIR)\gnuplot.dvi: $(DOCDIR)\gnuplot.tex
336 copy $(DOCDIR)\gnuplot.tex $(DOCDIR)\gnuplot_2.tex
337 cd $(DOCDIR) && $(LATEX) gnuplot_2.tex && $(LATEX) gnuplot_2.tex && $(LATEX) gnuplot_2.tex
338 if exist $(DOCDIR)\gnuplot.dvi del $(DOCDIR)\gnuplot.dvi
339 move $(DOCDIR)\gnuplot_2.dvi $(DOCDIR)\gnuplot.dvi
340 del $(DOCDIR)\gnuplot_2.*
341 $(DOCDIR)\gnuplot.ps: $(DOCDIR)\gnuplot.dvi
342 $(DVIPS) -o $@ $(DOCDIR)\gnuplot.dvi
343 $(DOCDIR)\gnuplot.pdf: $(DOCDIR)\gnuplot.tex
344 copy $(DOCDIR)\gnuplot.tex $(DOCDIR)\gnuplot_3.tex
345 copy $(DOCDIR)\..\VERSION $(DOCDIR)
346 cd $(DOCDIR) && $(PDFLATEX) gnuplot_3.tex && $(PDFLATEX) gnuplot_3.tex && $(PDFLATEX) gnuplot_3.tex
347 if exist $(DOCDIR)\gnuplot.pdf del $(DOCDIR)\gnuplot.pdf
348 move $(DOCDIR)\gnuplot_3.pdf $(DOCDIR)\gnuplot.pdf
349 del $(DOCDIR)\gnuplot_3.*
350 $(DOCDIR)\gnuplot.tex: $(DOCDIR)\gnuplot.doc $(DOCDIR)\doc2tex.exe
351 $(DOCDIR)\doc2tex.exe $(DOCDIR)\gnuplot.doc $@
352 $(DOCDIR)\gnuplot.inf: $(DOCDIR)\gnuplot.ipf
353 # Cannot use the command
354 # $(IPF_C) /INF $< $@
355 # because IPFC 2.1 does not support this syntax. Use instead:
356 cd $(DOCDIR) && $(IPF_C) /INF gnuplot.ipf
357 $(DOCDIR)\gnuplot.gih: $(DOCDIR)\gnuplot.doc $(DOCDIR)\doc2gih.exe
358 $(DOCDIR)\doc2gih.exe $(DOCDIR)\gnuplot.doc $@
359 $(DOCDIR)\gnuplot.html: $(DOCDIR)\gnuplot.texi $(DOCDIR)\gnuplot.doc
360 $(MAKEINFO) --html -I$(DOCDIR) $(DOCDIR)\gnuplot.texi --no-split --output=$@
361 $(DOCDIR)\gnuplot.info: $(DOCDIR)\gnuplot.texi $@
362 $(MAKEINFO) -I$(DOCDIR) $(DOCDIR)\gnuplot.texi --no-split --output=$@
363 # $(DOCDIR)\gnuplot.texi: $(DOCDIR)\gnuplot.doc $(DOCDIR)\doc2texi.pl
364 # perl $(DOCDIR)\doc2texi.pl $(DOCDIR)\gnuplot.doc >$@
365 $(DOCDIR)\gnuplot.rtf: $(DOCDIR)\gnuplot.doc $(DOCDIR)\doc2rtf.exe
366 $(DOCDIR)\doc2rtf.exe $(DOCDIR)\gnuplot.doc $@
367 $(DOCDIR)\gnuplot.ms: $(DOCDIR)\gnuplot.doc $(DOCDIR)\doc2ms.exe
368 $(DOCDIR)\doc2ms.exe $(DOCDIR)\gnuplot.doc $@
369 $(DOCDIR)\gnuplot.ipf: $(DOCDIR)\gnuplot.doc $(DOCDIR)\doc2ipf.exe
370 $(DOCDIR)\doc2ipf.exe $(DOCDIR)\gnuplot.doc $@
371 # Assume we need A4 format
372 $(DOCDIR)\gpcard.ps: $(DOCDIR)\gpcard.dvi
373 cd $(DOCDIR) && $(DVIPS) -o gpcard_letter.ps $<
374 cd $(DOCDIR) && psresize -pletter -Pa4 gpcard_letter.ps $@
375 $(DOCDIR)\gpcard.dvi: $(DOCDIR)\gpcard.tex
376 cd $(DOCDIR) && $(PLAINTEX) gpcard.tex && $(PLAINTEX) gpcard.tex
379 # Tools for converting the documentation from docs\gnuplot.doc
383 # Some dependencies - no rule!
384 $(DOCDIR)\doc2gih.exe $(DOCDIR)\doc2ipf.exe $(DOCDIR)\doc2info.exe \
385 $(DOCDIR)\doc2tex.exe $(DOCDIR)\doc2rtf.exe: \
386 $(DOCDIR)\termdoc.c $(DOCDIR)\xref.c $(DOCDIR)\allterm.h ..\src\config.h
391 # sort alphabetically all terminals
392 $(DOCDIR)\allterm.h: $(CORETERM)
393 @echo "Building allterm.h"
394 @..\src\os2\4allterm.cmd sort
396 # SORT_TERMINALS==0, then sequence of terminals according to "ls term/*.trm":
397 $(DOCDIR)\allterm.h: $(CORETERM)
398 @echo "Building allterm.h"
399 @..\src\os2\4allterm.cmd nosort
402 $(DOCDIR)\doc2gih.exe: $(DOCDIR)\doc2gih.c $(DOCDIR)\termdoc.c $(OS2TERM)
403 $(CC) $(CFLAGS) $(TERMFLAGS) -DALL_TERM_DOC -o $@ $(DOCDIR)\doc2gih.c $(DOCDIR)\termdoc.c
404 $(DOCDIR)\doc2ipf.exe: $(DOCDIR)\doc2ipf.c $(DOCDIR)\termdoc.c $(DOCDIR)\xref.c $(OS2TERM)
405 $(CC) $(CFLAGS) $(TERMFLAGS) -DALL_TERM_DOC -o $@ $(DOCDIR)\doc2ipf.c $(DOCDIR)\termdoc.c $(DOCDIR)\xref.c
406 $(DOCDIR)\doc2tex.exe: $(DOCDIR)\doc2tex.c $(DOCDIR)\termdoc.c $(OS2TERM) $(DOCDIR)\allterm.h
407 $(CC) $(CFLAGS) $(TERMFLAGS) -DALL_TERM_DOC -o $@ $(DOCDIR)\doc2tex.c $(DOCDIR)\termdoc.c
408 $(DOCDIR)\doc2rtf.exe: $(DOCDIR)\doc2rtf.c $(DOCDIR)\termdoc.c $(DOCDIR)\xref.c $(OS2TERM)
409 $(CC) $(CFLAGS) $(TERMFLAGS) -DALL_TERM_DOC -o $@ $(DOCDIR)\doc2rtf.c $(DOCDIR)\termdoc.c $(DOCDIR)\xref.c
410 $(DOCDIR)\doc2ms.exe: $(DOCDIR)\doc2ms.c $(DOCDIR)\termdoc.c $(OS2TERM)
411 $(CC) $(CFLAGS) $(TERMFLAGS) -DALL_TERM_DOC -o $@ $(DOCDIR)\doc2ms.c $(DOCDIR)\termdoc.c
413 # Create binary demo files
415 $(M)binary1 $(M)binary2 $(M)binary3: $(M)bf_test.exe
416 cd $(DEMODIR) && bf_test.exe
418 $(M)bf_test.exe : bf_test.c binary.$(O) alloc.$(O)
419 $(CC) $(CFLAGS) -o $@ bf_test.c binary.$(O) alloc.$(O)
425 # Clean up all files temporary used
427 if exist config.h del config.h
428 if exist *.$(O) del *.$(O)
429 if exist *.$(O2) del *.$(O2)
430 cd $(OS2DIR) && if exist *.$(O2) del *.$(O2)
431 if exist $(OS2DIR)\gnupmdrv.res del $(OS2DIR)\gnupmdrv.res
432 if exist $(DEMODIR)\bf_test.exe del $(DEMODIR)\bf_test.exe
433 if exist $(DOCDIR)\doc2*.exe del $(DOCDIR)\doc2*.exe
434 if exist $(DOCDIR)\gnuplot.ipf del $(DOCDIR)\gnuplot.ipf
435 if exist $(DOCDIR)\gnuplot_2* del $(DOCDIR)\gnuplot_2*
436 if exist $(DOCDIR)\gnuplot_3* del $(DOCDIR)\gnuplot_3*
437 if exist core del core
438 if exist $(DOCDIR)\allterm.? del $(DOCDIR)\allterm.?
440 # Clean up ALL files that were not part of the source distribution
442 if exist *.exe del *.exe
443 if exist $(DOCDIR)\gnuplot.dvi del $(DOCDIR)\gnuplot.dvi
444 if exist $(DOCDIR)\gnuplot.gih del $(DOCDIR)\gnuplot.gih
445 if exist $(DOCDIR)\gnupmdrv.hlp del $(DOCDIR)\gnupmdrv.hlp
446 if exist $(DOCDIR)\gnuplot.html del $(DOCDIR)\gnuplot.html
447 if exist $(DOCDIR)\gnuplot.inf del $(DOCDIR)\gnuplot.inf
448 if exist $(DOCDIR)\gnuplot.info del $(DOCDIR)\gnuplot.info
449 if exist $(DOCDIR)\gnuplot.ms del $(DOCDIR)\gnuplot.ms
450 if exist $(DOCDIR)\gnuplot.ps del $(DOCDIR)\gnuplot.ps
451 if exist $(DOCDIR)\gnuplot.pdf del $(DOCDIR)\gnuplot.pdf
452 if exist $(DOCDIR)\gnuplot.rtf del $(DOCDIR)\gnuplot.rtf
453 if exist $(DOCDIR)\gnuplot.tex del $(DOCDIR)\gnuplot.tex
454 if exist $(DOCDIR)\gpcard*.ps del $(DOCDIR)\gpcard*.ps
455 if exist $(DOCDIR)\*.dvi del $(DOCDIR)\*.dvi
456 if exist $(DOCDIR)\*.log del $(DOCDIR)\*.log
457 if exist $(DOCDIR)\*.aux del $(DOCDIR)\*.aux
458 if exist $(DOCDIR)\*.toc del $(DOCDIR)\*.toc
459 if exist $(DEMODIR)\binary? del $(DEMODIR)\binary?