Support for g++-4.1.
[gf1.git] / Makefile
blob0585960acf8dba4bf763c083222b14e46a9bdab6
1 #
2 # $Id$
5 # put the next line in comment if you don't have the gd-library
6 GDLIB = -DHAVEGD
8 # put the next line in comment if not compiling for MS Windows
9 #MSWIN = -DMSWIN
11 # this uses the new filechooser widget
12 NEWFILECHOOSER = -DNEWFILECHOOSER
13 FCDIR = FileChooser-1.4.1
15 # set your compile-options here
16 COMPILEFLAGS = -O3
17 #COMPILEFLAGS = -O0 -g -Wall #-pg
19 ###########################################
20 # no user servicable parts after this line
21 ###########################################
23 # are there any extra include paths
24 ifdef GDLIB
25 ifdef MSWIN
26 EXTRAINCLUDES = -I./gd -I./libpng -I./zlib
27 else
28 EXTRAINCLUDES = -I/usr/local/include
29 endif
30 endif
32 ifdef NEWFILECHOOSER
33 EXTRAINCLUDES += -I./$(FCDIR) -DFLTK_1_0_COMPAT
34 endif
36 # what libraries to link with
37 ifdef GDLIB
38 ifndef MSWIN
39 gd_libs = -L/usr/local/lib -lgd -lpng -lz
40 else
41 gd_libs = -L./gd -lgd -L./libpng -lpng -L./zlib -lz
42 endif
43 endif
45 ifdef MSWIN
46 libs = -lgdi32 -luser32 -lfltk -lwsock32 -mwindows $(gd_libs)
47 else
48 libs = -L/usr/X11R6/lib -lX11 -lXext -lm -lfltk $(gd_libs)
49 # libs += -L/usr/local/lib /usr/local/lib/ccmalloc.o $(gd_libs) \
50 # -lccmalloc -ldl
51 endif
53 DEFINES = -DWINGIPF $(MSWIN) $(GDLIB) $(NEWFILECHOOSER) $(EXTRAINCLUDES)
55 CFLAGS = $(COMPILEFLAGS) $(DEFINES)
56 DATE = `date +'%Y%m%d'`
57 CC = gcc
58 CXX = g++
59 FLUID = fluid
60 PERL = perl
61 WINDRES = windres
63 # sources
64 sources_c = configfile.c linklist.c position.c \
65 rem_gipf.c rem_row.c gettimeofday.c
66 sources_cxx = gipf_ui.cxx callbacks.cxx core.cxx fl_board.cxx fl_pile.cxx \
67 setup_win.cxx thegame.cxx win_human.cxx drawgif.cxx \
68 ai_player.cxx ai_gipf.cxx xmlite.cxx board2.cxx gamelog2.cxx
70 ifdef NEWFILECHOOSER
71 sources_filechooser = $(FCDIR)/FileBrowser.cxx $(FCDIR)/FileChooser.cxx \
72 $(FCDIR)/FileChooser2.cxx $(FCDIR)/FileIcon.cxx \
73 $(FCDIR)/FileInput.cxx
74 endif
76 # objectfiles
77 objects = $(sources_c:.c=.o) $(sources_cxx:.cxx=.o) \
78 $(sources_filechooser:.cxx=.o)
79 ifdef MSWIN
80 objects += icons.o
81 endif
83 # executable-name
84 ifdef MSWIN
85 program = gf1.exe
86 else
87 program = gf1
88 endif
90 .SUFFIXES: .cxx .o
91 .cxx.o:
92 $(CXX) $(CFLAGS) -c -o $@ $*.cxx
94 .PHONY: all clean realclean fullzip winzip linuxzip doc
96 all: $(program)
98 clean:
99 - rm $(program) $(objects)
101 realclean: clean
102 - rm *.d gipf_ui.H gipf_ui.cxx helptext.h gf1_doc.txt gf1_doc*.html
104 fullzip:
105 zip gf1_src_$(DATE) RCS/* * $(FCDIR)/* \
106 -x core \*.o \*.zip \*~ $(program)
108 winzip:
109 zip gf1_wexe gf1.exe gf1_doc.txt README.txt COPYING.txt HISTORY.txt \
110 gf1_doc*.html TODO.txt small_logo.png
112 linuxzip:
113 zip gf1_lexe gf1 gf1_doc.txt README.txt COPYING.txt HISTORY.txt \
114 gf1_doc*.html TODO.txt small_logo.png
116 doc: gf1_doc.html
118 $(program): $(objects)
119 $(CXX) $(CFLAGS) -o $@ $^ $(libs)
121 gipf_ui.H gipf_ui.cxx: gipf_ui.fl
122 $(FLUID) -c gipf_ui.fl
123 mv gipf_ui.C gipf_ui.cxx
125 helptext.h: gf1_doc.txt
126 $(PERL) makehelptext.pl $< $@
128 gf1_doc.txt: gf1_doc.sgml
129 sgml2txt -f $<
131 gf1_doc.html: gf1_doc.sgml
132 sgml2html $<
134 icons.o: icons.rc win_icon.ico
135 $(WINDRES) $< $@
138 ifndef MSWIN
140 # some things for automatic dependency generation
141 %.d: %.c
142 $(SHELL) -ec '$(CC) -MM $(CPPFLAGS) $(DEFINES) $< \
143 | sed '\''s/$*\\.o[ :]*/& $@/g'\'' > $@'
145 %.d: %.cxx
146 $(SHELL) -ec '$(CXX) -MM $(CPPFLAGS) $(DEFINES) $< \
147 | sed '\''s/$*\\.o[ :]*/& $@/g'\'' > $@'
149 include $(sources_c:.c=.d)
150 include $(sources_cxx:.cxx=.d)
152 # not all dependencies can be added automatically
153 # so I add some here myself
154 win_human.cxx thegame.cxx setup_win.cxx core.cxx: gipf_ui.H
155 callbacks.cxx: helptext.h
157 endif