working on a better Makefile - incremental and contained to one folder

This commit is contained in:
rusefi 2017-03-29 17:17:39 -04:00
parent 084c3dc01f
commit e98dbc1218
2 changed files with 47 additions and 315 deletions

View File

@ -5,45 +5,43 @@
# Compiler options here.
ifeq ($(USE_OPT),)
# this config if debugging is needed, but the binary is about 50M
# USE_OPT = -c -Wall -O0 -ggdb -g3 -Werror-implicit-function-declaration -Werror -Wno-error=pointer-sign -Wno-error=unused-function -Wno-error=unused-variable -Wno-error=sign-compare -Wno-error=unused-parameter -Wno-error=missing-field-initializers -Wno-error=write-strings
# this config producec a smaller binary file
USE_OPT = -Os
endif
ifeq ($(OS),Windows_NT)
else
USE_OPT += -m32
USE_OPT = -O2 -ggdb
endif
# C specific options here (added to USE_OPT).
ifeq ($(USE_COPT),)
USE_COPT = -std=gnu99 -fgnu89-inline
endif
ifeq ($(OS),Windows_NT)
else
USE_COPT += -Wno-error=attributes -Wno-error=implicit-function-declaration -include stdio.h
USE_COPT =
endif
# C++ specific options here (added to USE_OPT).
ifeq ($(USE_CPPOPT),)
USE_CPPOPT = -std=c++11 -fno-rtti -fpermissive -fno-exceptions -fno-use-cxa-atexit
USE_CPPOPT = -fno-rtti
endif
ifeq ($(OS),Windows_NT)
else
USE_CPPOPT += -include cstring -include cstdio -include cstdlib
endif
# Enable this if you want the linker to remove unused code and data
# Enable this if you want the linker to remove unused code and data.
ifeq ($(USE_LINK_GC),)
USE_LINK_GC = yes
endif
# Linker extra options here.
ifeq ($(USE_LDOPT),)
USE_LDOPT =
endif
# Enable this if you want link time optimizations (LTO)
ifeq ($(USE_LTO),)
USE_LTO = no
endif
# Enable this if you want to see the full log while compiling.
ifeq ($(USE_VERBOSE_COMPILE),)
USE_VERBOSE_COMPILE = yes
USE_VERBOSE_COMPILE = no
endif
# If enabled, this option makes the build process faster by not compiling
# modules not used in the current configuration.
ifeq ($(USE_SMART_BUILD),)
USE_SMART_BUILD = yes
endif
#
@ -54,10 +52,6 @@ endif
# Architecture or project specific options
#
# List all default C defines here, like -D_DEBUG=1
DDEFS =
#
# Architecture or project specific options
##############################################################################
@ -65,17 +59,27 @@ DDEFS =
##############################################################################
# Project, sources and paths
#
# Define project name here
PROJECT = rusefi_simulator
PROJECT_DIR = ../firmware
CHIBIOS = ../firmware/ChibiOS
# Imported source files and paths
include $(CHIBIOS)/os/hal/boards/simulator/board.mk
CHIBIOS = ../firmware/ChibiOS
# Startup files.
# HAL-OSAL files (optional).
include $(CHIBIOS)/os/hal/hal.mk
include $(CHIBIOS)/os/hal/boards/simulator/board.mk
include $(CHIBIOS)/os/hal/osal/rt/osal.mk
include $(CHIBIOS)/os/rt/ports/SIMIA32/compilers/GCC/port.mk
# RTOS files (optional).
include $(CHIBIOS)/os/rt/rt.mk
include $(CHIBIOS)/os/rt/ports/SIMIA32/compilers/GCC/port.mk
# Other files (optional).
include $(CHIBIOS)/os/hal/lib/streams/streams.mk
include $(CHIBIOS)/os/various/shell/shell.mk
ifeq ($(OS),Windows_NT)
include ${CHIBIOS}/os/hal/ports/simulator/win32/platform.mk
@ -95,9 +99,6 @@ include $(PROJECT_DIR)/console/console.mk
include $(PROJECT_DIR)/console/binary/tunerstudio.mk
include $(PROJECT_DIR)/development/development.mk
# Define linker script file here
#LDSCRIPT= config/system/STM32F407xG.ld
#LDSCRIPT= $(PORTLD)/STM32F407xG_CCM.ld
# C sources that can be compiled in ARM or THUMB mode depending on the global
# setting.
@ -174,6 +175,10 @@ INCDIR = . \
$(CHIBIOS)/os/hal/lib/streams \
simulator
# List ASM source files here
ASMSRC =
ASMXSRC = $(STARTUPASM) $(PORTASM) $(OSALASM)
#
# Project, sources and paths
##############################################################################
@ -182,9 +187,6 @@ INCDIR = . \
# Compiler settings
#
#MCU = cortex-m4
ifeq ($(OS),Windows_NT)
#Cygwin64 is used with mingw64 32-bit version
@ -199,49 +201,26 @@ CPPC = $(TRGT)g++
# Enable loading with g++ only if you need C++ runtime support.
# NOTE: You can use C++ even without C++ support if you are careful. C++
# runtime support makes code size explode.
#LD = $(TRGT)gcc
LD = $(TRGT)g++
LD = $(TRGT)gcc
#LD = $(TRGT)g++
CP = $(TRGT)objcopy
AS = $(TRGT)gcc -x assembler-with-cpp
AR = $(TRGT)ar
OD = $(TRGT)objdump
HEX = $(CP) -O ihex
SZ = $(TRGT)size
BIN = $(CP) -O binary
COV = gcov
# Define C warning options here
CWARN = -Wall -Wextra -Wstrict-prototypes
CWARN = -Wall -Wextra -Wundef -Wstrict-prototypes
# Define C++ warning options here
CPPWARN = -Wall -Wextra
CPPWARN = -Wall -Wextra -Wundef
#
# Compiler settings
##############################################################################
##############################################################################
# Start of default section
#
# List all default ASM defines here, like -D_DEBUG=1
DADEFS =
# List all default directories to look for include files here
DINCDIR =
# List the default directory to look for the libraries here
DLIBDIR =
# List all default libraries here
ifeq ($(OS),Windows_NT)
DLIBS = -static-libgcc -static-libstdc++ -lws2_32
else
DLIBS = -static-libgcc -lgcc -static-libstdc++ -m32
endif
#
# End of default section
##############################################################################
##############################################################################
# Start of user section
#
@ -259,10 +238,11 @@ UINCDIR =
ULIBDIR =
# List all user libraries here
ULIBS = -lm
ULIBS = -lws2_32
#
# End of user defines
##############################################################################
include rules.mk
RULESPATH = $(CHIBIOS)/os/common/startup/SIMIA32/compilers/GCC
include $(RULESPATH)/rules.mk

View File

@ -1,248 +0,0 @@
##############################################################################
# Build global options
# NOTE: Can be overridden externally.
#
# Compiler options here.
ifeq ($(USE_OPT),)
USE_OPT = -O2 -ggdb
endif
# C specific options here (added to USE_OPT).
ifeq ($(USE_COPT),)
USE_COPT =
endif
# C++ specific options here (added to USE_OPT).
ifeq ($(USE_CPPOPT),)
USE_CPPOPT = -fno-rtti
endif
# Enable this if you want the linker to remove unused code and data.
ifeq ($(USE_LINK_GC),)
USE_LINK_GC = yes
endif
# Linker extra options here.
ifeq ($(USE_LDOPT),)
USE_LDOPT =
endif
# Enable this if you want link time optimizations (LTO)
ifeq ($(USE_LTO),)
USE_LTO = no
endif
# Enable this if you want to see the full log while compiling.
ifeq ($(USE_VERBOSE_COMPILE),)
USE_VERBOSE_COMPILE = no
endif
# If enabled, this option makes the build process faster by not compiling
# modules not used in the current configuration.
ifeq ($(USE_SMART_BUILD),)
USE_SMART_BUILD = yes
endif
#
# Build global options
##############################################################################
##############################################################################
# Architecture or project specific options
#
#
# Architecture or project specific options
##############################################################################
##############################################################################
# Project, sources and paths
#
# Define project name here
PROJECT = rusefi_simulator
PROJECT_DIR = ../firmware
CHIBIOS = ../firmware/ChibiOS
# Imported source files and paths
CHIBIOS = ../firmware/ChibiOS
# Startup files.
# HAL-OSAL files (optional).
include $(CHIBIOS)/os/hal/hal.mk
include $(CHIBIOS)/os/hal/boards/simulator/board.mk
include $(CHIBIOS)/os/hal/osal/rt/osal.mk
# RTOS files (optional).
include $(CHIBIOS)/os/rt/rt.mk
include $(CHIBIOS)/os/rt/ports/SIMIA32/compilers/GCC/port.mk
# Other files (optional).
include $(CHIBIOS)/os/hal/lib/streams/streams.mk
include $(CHIBIOS)/os/various/shell/shell.mk
ifeq ($(OS),Windows_NT)
include ${CHIBIOS}/os/hal/ports/simulator/win32/platform.mk
else
include ${CHIBIOS}/os/hal/ports/simulator/Posix/platform.mk
endif
include $(PROJECT_DIR)/util/util.mk
include $(PROJECT_DIR)/config/engines/engines.mk
include $(PROJECT_DIR)/controllers/algo/algo.mk
include $(PROJECT_DIR)/controllers/core/core.mk
include $(PROJECT_DIR)/controllers/math/math.mk
include $(PROJECT_DIR)/controllers/sensors/sensors.mk
include $(PROJECT_DIR)/controllers/trigger/trigger.mk
include $(PROJECT_DIR)/controllers/system/system.mk
include $(PROJECT_DIR)/console/console.mk
include $(PROJECT_DIR)/console/binary/tunerstudio.mk
include $(PROJECT_DIR)/development/development.mk
# C sources that can be compiled in ARM or THUMB mode depending on the global
# setting.
CSRC = ${PORTSRC} \
${KERNSRC} \
${HALSRC} \
${PLATFORMSRC} \
$(SYSTEMSRC) \
$(CONSOLESRC) \
$(CONTROLLERS_ALGO_SRC) \
$(CONTROLLERS_CORE_SRC) \
$(CONTROLLERS_SENSORS_SRC) \
$(ENGINES_SRC) \
$(BOARDSRC) \
$(CHIBIOS)/os/hal/lib/streams/memstreams.c \
$(CHIBIOS)/os/hal/lib/streams/chprintf.c \
$(CHIBIOS)/os/various/shell.c \
$(UTILSRC) \
main.c
# C++ sources that can be compiled in ARM or THUMB mode depending on the global
# setting.
CPPSRC = $(UTILSRC_CPP) \
$(CONTROLLERS_ALGO_SRC_CPP) \
$(PROJECT_DIR)/controllers/settings.cpp \
$(PROJECT_DIR)/controllers/engine_controller.cpp \
$(PROJECT_DIR)/controllers/error_handling.cpp \
$(PROJECT_DIR)/development/sensor_chart.cpp \
$(TRIGGER_SRC_CPP) \
$(TRIGGER_DECODERS_SRC_CPP) \
$(SYSTEMSRC_CPP) \
$(TUNERSTUDIO_SRC_CPP) \
$(CONSOLE_SRC_CPP) \
$(CONTROLLERS_SENSORS_SRC_CPP) \
$(CONTROLLERS_CORE_SRC_CPP) \
$(CONTROLLERS_MATH_SRC_CPP) \
$(DEV_SIMULATOR_SRC_CPP) \
$(ENGINES_SRC_CPP) \
simulator/rusEfiFunctionalTest.cpp \
simulator/framework.cpp \
simulator/boards.cpp \
$(PROJECT_DIR)/controllers/map_averaging.cpp \
$(PROJECT_DIR)/development/trigger_emulator.cpp \
$(TEST_SRC_CPP)
# List ASM source files here
ASMSRC = $(PORTASM)
INCDIR = . \
$(PORTINC) \
$(KERNINC) \
$(OSALINC) \
$(HALINC) \
$(PLATFORMINC) \
$(BOARDINC) \
$(PROJECT_DIR)/util \
$(PROJECT_DIR)/console \
$(PROJECT_DIR)/console/binary \
$(PROJECT_DIR)/console/fl_binary \
$(PROJECT_DIR)/config/engines \
$(PROJECT_DIR)/ext_algo \
$(PROJECT_DIR)/controllers \
$(PROJECT_DIR)/hw_layer/algo \
$(PROJECT_DIR)/development \
$(PROJECT_DIR)/controllers/algo \
$(PROJECT_DIR)/controllers/core \
$(PROJECT_DIR)/controllers/math \
$(PROJECT_DIR)/controllers/sensors \
$(PROJECT_DIR)/controllers/system \
$(PROJECT_DIR)/controllers/trigger \
$(PROJECT_DIR)/controllers/trigger/decoders \
${CHIBIOS}/os/various \
$(CHIBIOS)/os/hal/lib/streams \
simulator
# List ASM source files here
ASMSRC =
ASMXSRC = $(STARTUPASM) $(PORTASM) $(OSALASM)
#
# Project, sources and paths
##############################################################################
##############################################################################
# Compiler settings
#
ifeq ($(OS),Windows_NT)
#Cygwin64 is used with mingw64 32-bit version
#TRGT = i686-w64-mingw32-
TRGT = i686-w64-mingw32-
else
TRGT =
endif
CC = $(TRGT)gcc
CPPC = $(TRGT)g++
# Enable loading with g++ only if you need C++ runtime support.
# NOTE: You can use C++ even without C++ support if you are careful. C++
# runtime support makes code size explode.
LD = $(TRGT)gcc
#LD = $(TRGT)g++
CP = $(TRGT)objcopy
AS = $(TRGT)gcc -x assembler-with-cpp
AR = $(TRGT)ar
OD = $(TRGT)objdump
SZ = $(TRGT)size
BIN = $(CP) -O binary
COV = gcov
# Define C warning options here
CWARN = -Wall -Wextra -Wundef -Wstrict-prototypes
# Define C++ warning options here
CPPWARN = -Wall -Wextra -Wundef
#
# Compiler settings
##############################################################################
##############################################################################
# Start of user section
#
# List all user C define here, like -D_DEBUG=1
UDEFS = -DSIMULATOR
# Define ASM defines here
UADEFS =
# List all user directories here
UINCDIR =
# List the user directory to look for the libraries here
ULIBDIR =
# List all user libraries here
ULIBS = -lws2_32
#
# End of user defines
##############################################################################
RULESPATH = $(CHIBIOS)/os/common/startup/SIMIA32/compilers/GCC
include $(RULESPATH)/rules.mk