-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
119 lines (93 loc) · 3.75 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
export CC=g++
export CXXLIBS=
export CXXINCLUDES=
export CXXFLAGS=-g -I $(CURDIR)/include -std=gnu++14 -Wall
export LDFLAGS=-lsdl2 -lsdl2_image -lsdl2_ttf
export BINARY=libidea-engine
export LIB_DIRECTORY=$(CURDIR)/lib
# Top directory for example projects
export APP_DIRECTORY=examples
export BIN_DIRECTORY=$(CURDIR)/bin
export BUILD_DIRECTORY=$(CURDIR)/build
SOURCE_DIR=src
INCLUDE_DIR=include
CONFIGFILE=make.config
include $(CONFIGFILE)
all: lib examples
lib: directories
lib: $(LIB_DIRECTORY)/$(BINARY).$(EXT)
include make.examples
directories:
@mkdir -p $(LIB_DIRECTORY)
@mkdir -p $(BUILD_DIRECTORY)
clean: examples-clean
-rm -f $(LIB_DIRECTORY)/$(BINARY)*
-rm -f $(BUILD_DIRECTORY)/main.o
-rm -f $(BUILD_DIRECTORY)/Engine.o
-rm -f $(BUILD_DIRECTORY)/Scene.o
-rm -f $(BUILD_DIRECTORY)/Object.o
-rm -f $(BUILD_DIRECTORY)/Level.o
-rm -f $(BUILD_DIRECTORY)/Texture.o
-rm -f $(BUILD_DIRECTORY)/Resources.o
-rm -f $(BUILD_DIRECTORY)/Console.o
-rm -f $(BUILD_DIRECTORY)/ConsoleCommand.o
-rm -f $(BUILD_DIRECTORY)/Event.o
-rm -f $(BUILD_DIRECTORY)/EventBase.o
-rm -f $(BUILD_DIRECTORY)/Building.o
-rm -f $(BUILD_DIRECTORY)/Simulation.o
-rm -f $(BUILD_DIRECTORY)/Seed.o
mrproper: clean examples-mrproper
-rm -f $(CONFIGFILE)
-rm -f make.examples
-rm -rf $(LIB_DIRECTORY)
-rm -rf $(BIN_DIRECTORY)
-rm -rf $(BUILD_DIRECTORY)
-rm -rf $(EXAMPLES_DIRECTORY)
OBJECT_FILES = $(BUILD_DIRECTORY)/Engine.o \
$(BUILD_DIRECTORY)/Scene.o \
$(BUILD_DIRECTORY)/Object.o \
$(BUILD_DIRECTORY)/Level.o \
$(BUILD_DIRECTORY)/Texture.o \
$(BUILD_DIRECTORY)/Resources.o \
$(BUILD_DIRECTORY)/Console.o \
$(BUILD_DIRECTORY)/ConsoleCommand.o \
$(BUILD_DIRECTORY)/Event.o \
$(BUILD_DIRECTORY)/EventBase.o \
$(BUILD_DIRECTORY)/Building.o \
$(BUILD_DIRECTORY)/Simulation.o \
$(BUILD_DIRECTORY)/Seed.o
# $(BUILD_DIRECTORY)/main.o
$(BUILD_DIRECTORY)/Engine.o: $(SOURCE_DIR)/Engine.cpp $(INCLUDE_DIR)/Engine.hpp
$(CC) $(CXXFLAGS) -c -fPIC $< -o $@
$(BUILD_DIRECTORY)/Scene.o: $(SOURCE_DIR)/Scene.cpp $(INCLUDE_DIR)/Scene.hpp
$(CC) $(CXXFLAGS) -c -fPIC $< -o $@
$(BUILD_DIRECTORY)/Object.o: $(SOURCE_DIR)/Object.cpp $(INCLUDE_DIR)/Object.hpp
$(CC) $(CXXFLAGS) -c -fPIC $< -o $@
$(BUILD_DIRECTORY)/Level.o: $(SOURCE_DIR)/Level.cpp $(INCLUDE_DIR)/Level.hpp
$(CC) $(CXXFLAGS) -c -fPIC $< -o $@
$(BUILD_DIRECTORY)/Texture.o: $(SOURCE_DIR)/Texture.cpp $(INCLUDE_DIR)/Texture.hpp
$(CC) $(CXXFLAGS) -c -fPIC $< -o $@
$(BUILD_DIRECTORY)/Resources.o: $(SOURCE_DIR)/Resources.cpp $(INCLUDE_DIR)/Resources.hpp
$(CC) $(CXXFLAGS) -c -fPIC $< -o $@
$(BUILD_DIRECTORY)/Console.o: $(SOURCE_DIR)/Console.cpp $(INCLUDE_DIR)/Console.hpp
$(CC) $(CXXFLAGS) -c -fPIC $< -o $@
$(BUILD_DIRECTORY)/ConsoleCommand.o: $(SOURCE_DIR)/ConsoleCommand.cpp $(INCLUDE_DIR)/ConsoleCommand.hpp
$(CC) $(CXXFLAGS) -c -fPIC $< -o $@
$(BUILD_DIRECTORY)/Event.o: $(SOURCE_DIR)/Event.cpp $(INCLUDE_DIR)/Event.hpp
$(CC) $(CXXFLAGS) -c -fPIC $< -o $@
$(BUILD_DIRECTORY)/EventBase.o: $(SOURCE_DIR)/EventBase.cpp $(INCLUDE_DIR)/EventBase.hpp
$(CC) $(CXXFLAGS) -c -fPIC $< -o $@
$(BUILD_DIRECTORY)/Building.o: $(SOURCE_DIR)/Building.cpp $(INCLUDE_DIR)/Building.hpp
$(CC) $(CXXFLAGS) -c -fPIC $< -o $@
$(BUILD_DIRECTORY)/Simulation.o: $(SOURCE_DIR)/Simulation.cpp $(INCLUDE_DIR)/Simulation.hpp
$(CC) $(CXXFLAGS) -c -fPIC $< -o $@
$(BUILD_DIRECTORY)/Seed.o: $(SOURCE_DIR)/Seed.cpp $(INCLUDE_DIR)/Seed.hpp
$(CC) $(CXXFLAGS) -c -fPIC $< -o $@
#$(BUILD_DIRECTORY)/main.o: $(SOURCE_DIR)/main.cpp
# $(CC) $(CXXFLAGS) -c -fPIC $< -o $@
$(LIB_DIRECTORY)/$(BINARY).$(EXT): $(OBJECT_FILES)
$(CC) $(LDFLAGS) $(OBJECT_FILES) -shared -o $@
make.examples:
$(error Missing make.examples file. Run configure script first)
make.config:
$(error Missing make.config file. Run configure script first)