6fc991db81ce03d77e07df892dee369482fea375
[universe.git] / Makefile
1
2 #============================================================================#
3 # This program is free software; you can redistribute it and/or              #
4 # modify it under the terms of the GNU General Public License                #
5 # version 2 as published by the Free Software Foundation.                    #
6 #                                                                            #
7 # This program is distributed in the hope that it will be useful, but        #
8 # WITHOUT ANY WARRANTY; without even the implied warranty of                 #
9 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU          #
10 # General Public License for more details.                                   #
11 #                                                                            #
12 # Written and (C) by François Fleuret                                        #
13 # Contact <francois.fleuret@epfl.ch> for comments & bug reports              #
14 #============================================================================#
15
16 # CXX=g++-3.3
17
18 ifeq ($(DEBUG),yes)
19  CXXFLAGS = -fPIC -Wall -g -DDEBUG
20 else
21  # Optimized compilation
22 #  CXXFLAGS = -Wall -g -O3 -pg --coverage
23  CXXFLAGS = -fPIC -Wall -g -O3
24 endif
25
26 LDFLAGS = -L/usr/X11R6/lib/ -lz -ldl
27
28 # Do we use cairo?
29 CXXFLAGS += -I/usr/include/cairo -DCAIRO_SUPPORT
30 LDFLAGS += -lcairo
31
32 TASK_SRC = dummy.cc move_square.cc hit_shape.cc
33 TASK_OBJ = $(TASK_SRC:.cc=.task)
34
35 all: main TAGS $(TASK_OBJ)
36
37 TAGS: *.cc *.h
38         etags *.cc *.h
39
40 main:   main.o misc.o \
41         simple_window.o \
42         universe.o \
43         polygon.o \
44         xfig_tracer.o \
45         map.o \
46         task.o \
47         retina.o \
48         manipulator.o \
49         approximer.o \
50         intelligence.o
51         $(CXX) $(CXXFLAGS) $(LDFLAGS) -lX11 -o $@ $^
52
53 %.task: %.cc misc.o universe.o polygon.o xfig_tracer.o map.o task.o manipulator.o
54         $(CXX) $(CXXFLAGS) -shared -Wl,-soname,$@ -o $@ $^
55
56 Makefile.depend: *.h *.cc Makefile
57         $(CC) -M *.cc > Makefile.depend
58
59 clean:
60         \rm -f main *.o *.task Makefile.depend
61
62 -include Makefile.depend