/
Makefile
187 lines (165 loc) · 5.96 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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
##=====================================================================
## https://github.com/Lecrapouille/Highway
## Highway: Open-source simulator for autonomous driving research.
## Copyright 2021 -- 2023 Quentin Quadrat <lecrapouille@gmail.com>
##
## This file is part of Highway.
##
## Highway is free software: you can redistribute it and/or modify it
## under the terms of the GNU General Public License as published by
## the Free Software Foundation, either version 3 of the License, or
## (at your option) any later version.
##
## This program is distributed in the hope that it will be useful, but
## WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
## General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with Highway. If not, see <http://www.gnu.org/licenses/>.
##=====================================================================
###################################################
# Project definition
#
PROJECT = Highway
TARGET = $(PROJECT)
DESCRIPTION = Open-source simulator for autonomous driving research
STANDARD = --std=c++17
BUILD_TYPE = debug
###################################################
# Location of the project directory and Makefiles
#
P := .
M := $(P)/.makefile
include $(M)/Makefile.header
###################################################
# Inform Makefile where to find header files
#
INCLUDES += -I$(P)/src -I$(THIRDPART)
###################################################
# Inform Makefile where to find *.cpp and *.o files
#
VPATH += $(P)/src $(P)/src/Common $(P)/src/Application $(P)/src/Math \
$(P)/src/Sensors $(P)/src/Simulation $(P)/src/City $(P)/src/Vehicle \
$(P)/src/Renderer $(P)/src/Vehicle/VehiclePhysicalModels \
$(P)/src/ECUs/AutoParkECU $(P)/src/ECUs/AutoParkECU/Trajectories
###################################################
# Project defines
#
DEFINES = -DDATADIR=\"$(DATADIR)\"
###################################################
# Reduce warnings
#
DEFINES += -Wno-switch-enum -Wno-undef -Wno-unused-parameter -Wno-pedantic
DEFINES += -Wno-old-style-cast -Wno-sign-conversion -Wno-deprecated-copy-dtor
###################################################
# Thirdpart: MyLogger
#
THIRDPART_LIBS += $(abspath $(THIRDPART)/MyLogger/build/libmylogger.a)
INCLUDES += -I$(THIRDPART)/MyLogger/include
###################################################
# Thirdpart: SI units
#
INCLUDES += -I$(THIRDPART)/units/include
###################################################
# Thirdpart: Random number
#
INCLUDES += -I$(THIRDPART)/random/include
###################################################
# Make the list of compiled files for the library
#
LIB_OBJS += FilePath.o Collide.o SpatialHashGrid.o Prolog.o
LIB_OBJS += FontManager.o Drawable.o Renderer.o Perlin.o
LIB_OBJS += VehicleBluePrint.o VehicleShape.o TricycleKinematic.o
LIB_OBJS += Radar.o Antenna.o
LIB_OBJS += Car.o Trailer.o
LIB_OBJS += Pedestrian.o Parking.o Network.o Road.o BluePrints.o City.o CityGenerator.o
LIB_OBJS += Application.o GUIMainMenu.o GUISimulation.o GUILoadSimulMenu.o
LIB_OBJS += Trajectory.o ParallelTrajectory.o AutoParkECU.o
# PerpendicularTrajectory.o ParallelTrajectory.o DiagonalTrajectory.o
LIB_OBJS += Demo.o Scenario.o Simulator.o
###################################################
# Make the list of compiled files for the application
#
OBJS += $(LIB_OBJS) main.o
###################################################
# Set Libraries. For knowing which libraries
# is needed please read the external/README.md file.
#
PKG_LIBS += sfml-graphics swipl
LINKER_FLAGS += -lpthread -ldl
# C++17 filesystem: on older compiler you need
# the experimental lib
ifneq "$(GCC_GREATER_V9)" "1"
LINKER_FLAGS += -lstdc++fs
endif
###################################################
# MacOS X
#
ifeq ($(ARCHI),Darwin)
BUILD_MACOS_APP_BUNDLE = 1
APPLE_IDENTIFIER = lecrapouille
MACOS_BUNDLE_ICON = data/Highway.icns
LINKER_FLAGS += -framework CoreFoundation
endif
###################################################
# Entry point to call other makefiles compiling all
# scenarios.
#
SCENARIOS = $(sort $(dir $(wildcard ./Scenarios/*/.)))
###################################################
# Compile the project, the static and shared libraries
# and scenarios.
#
.PHONY: all
all: $(TARGET) $(STATIC_LIB_TARGET) $(SHARED_LIB_TARGET) $(PKG_FILE) scenarios
###################################################
# Compile scenarios
#
.PHONY: scenarios
scenarios: | $(STATIC_LIB_TARGET) $(SHARED_LIB_TARGET)
@$(call print-from,"Compiling scenarios",$(PROJECT),$(SCENARIOS))
@for i in $(SCENARIOS); \
do \
$(MAKE) -C $$i all; \
done;
###################################################
# Compile and launch unit tests and generate the code coverage html report.
#
.PHONY: unit-tests
unit-tests:
@$(call print-simple,"Compiling unit tests")
@$(MAKE) -C tests coverage
###################################################
# Compile and launch unit tests and generate the code coverage html report.
#
.PHONY: check
check: unit-tests
ifeq ($(ARCHI),Linux)
###################################################
# Install project. You need to be root.
#
.PHONY: install
install: $(TARGET) $(STATIC_LIB_TARGET) $(SHARED_LIB_TARGET) $(PKG_FILE)
@$(call INSTALL_BINARY)
@$(call INSTALL_DOCUMENTATION)
@$(call INSTALL_PROJECT_LIBRARIES)
@$(call INSTALL_PROJECT_HEADERS)
endif
###################################################
# Clean the whole project.
#
.PHONY: veryclean
veryclean: clean
@rm -fr cov-int $(PROJECT).tgz *.log foo 2> /dev/null
@(cd tests && $(MAKE) -s clean)
@$(call print-simple,"Cleaning","$(PWD)/doc/html")
@rm -fr $(THIRDPART)/*/ doc/html 2> /dev/null
@rm -f data/Scenarios/*.$(SO) 2> /dev/null
@for i in $(SCENARIOS); \
do \
$(MAKE) -C $$i clean; \
done;
###################################################
# Sharable informations between all Makefiles
include $(M)/Makefile.footer