Cleaning up for DL.
[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 ifeq ($(DEBUG),yes)
17  CXXFLAGS = -fPIC -Wall -g -DDEBUG
18 else
19  # Optimized compilation
20  # CXXFLAGS = -Wall -g -O3 -pg --coverage
21  CXXFLAGS = -fPIC -Wall -g -O3
22 endif
23
24 LDFLAGS = -lz -ldl
25
26 # Do we use X11?
27 CXXFLAGS += -DX11_SUPPORT
28 LDFLAGS += -L/usr/X11R6/lib/
29
30 # Do we use cairo?
31 CXXFLAGS += -I/usr/include/cairo -DCAIRO_SUPPORT
32 LDFLAGS += -lcairo
33
34 TASK_SRC = dummy.cc move_square.cc hit_shape.cc
35 TASK_OBJ = $(TASK_SRC:.cc=.so)
36
37 all: main TAGS $(TASK_OBJ)
38
39 TAGS: *.cc *.h
40         etags *.cc *.h
41
42 main:   main.o misc.o \
43         simple_window.o \
44         universe.o \
45         plotter.o \
46         polygon.o \
47         xfig_tracer.o \
48         canvas.o canvas_cairo.o \
49         map.o \
50         task.o \
51         retina.o \
52         manipulator.o \
53         approximer.o \
54         intelligence.o
55         $(CXX) $(CXXFLAGS) $(LDFLAGS) -lX11 -o $@ $^
56
57 %.so: %.cc misc.o universe.o polygon.o xfig_tracer.o map.o task.o manipulator.o
58         $(CXX) $(CXXFLAGS) -shared -Wl,-soname,$@ -o $@ $^
59
60 Makefile.depend: *.h *.cc Makefile
61         $(CC) $(CXXFLAGS) -M *.cc > Makefile.depend
62
63 clean:
64         \rm -f main *.o *.so Makefile.depend
65
66 -include Makefile.depend