From 9ee0b0398a36bf9b9464ebc58fad8ddc273fcb0b Mon Sep 17 00:00:00 2001 From: Giovanni Di Sirio Date: Sat, 2 Apr 2016 18:49:05 +0000 Subject: Improved simulator makefile. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@9227 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/various/RT-Win32-Simulator/Makefile | 219 ++++++++++++++++-------------- 1 file changed, 115 insertions(+), 104 deletions(-) (limited to 'demos/various/RT-Win32-Simulator/Makefile') diff --git a/demos/various/RT-Win32-Simulator/Makefile b/demos/various/RT-Win32-Simulator/Makefile index 35e705616..8bbff6384 100644 --- a/demos/various/RT-Win32-Simulator/Makefile +++ b/demos/various/RT-Win32-Simulator/Makefile @@ -1,152 +1,163 @@ +############################################################################## +# Build global options +# NOTE: Can be overridden externally. # -# !!!! Do NOT edit this makefile with an editor which replace tabs by spaces !!!! -# -############################################################################################## -# -# On command line: -# -# make all = Create project -# -# make clean = Clean project files. -# -# To rebuild project do "make clean" and "make all". -# - -############################################################################################## -# Start of default section -# - -TRGT = mingw32- -CC = $(TRGT)gcc -AS = $(TRGT)gcc -x assembler-with-cpp - -# List all default C defines here, like -D_DEBUG=1 -DDEFS = -DSIMULATOR - -# List all default ASM defines here, like -D_DEBUG=1 -DADEFS = -# List all default directories to look for include files here -DINCDIR = +# 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 -# List the default directory to look for the libraries here -DLIBDIR = +# +# Build global options +############################################################################## -# List all default libraries here -DLIBS = -lws2_32 +############################################################################## +# Architecture or project specific options +# # -# End of default section -############################################################################################## +# Architecture or project specific options +############################################################################## -############################################################################################## -# Start of user section +############################################################################## +# Project, sources and paths # # Define project name here PROJECT = ch -# Define linker script file here -LDSCRIPT = - -# List all user C define here, like -D_DEBUG=1 -UDEFS = - -# Define ASM defines here -UADEFS = - -# Imported source files +# Imported source files and paths CHIBIOS = ../../.. -include $(CHIBIOS)/os/hal/boards/simulator/board.mk +# Startup files. +# HAL-OSAL files (optional). include $(CHIBIOS)/os/hal/hal.mk +include $(CHIBIOS)/os/hal/boards/simulator/board.mk include $(CHIBIOS)/os/hal/ports/simulator/win32/platform.mk include $(CHIBIOS)/os/hal/osal/rt/osal.mk -include $(CHIBIOS)/os/common/ports/SIMIA32/compilers/GCC/port.mk +# RTOS files (optional). include $(CHIBIOS)/os/rt/rt.mk +include $(CHIBIOS)/os/common/ports/SIMIA32/compilers/GCC/port.mk +# Other files (optional). include $(CHIBIOS)/test/rt/test.mk include $(CHIBIOS)/os/hal/lib/streams/streams.mk include $(CHIBIOS)/os/various/shell/shell.mk -# List C source files here -SRC = $(PORTSRC) \ +# C sources here. +CSRC = $(STARTUPSRC) \ $(KERNSRC) \ - $(TESTSRC) \ - $(HALSRC) \ + $(PORTSRC) \ $(OSALSRC) \ + $(HALSRC) \ $(PLATFORMSRC) \ $(BOARDSRC) \ + $(TESTSRC) \ $(STREAMSSRC) \ $(SHELLSRC) \ main.c -# List ASM source files here -ASRC = +# C++ sources here. +CPPSRC = -# List all user directories here -UINCDIR = $(PORTINC) $(KERNINC) $(TESTINC) \ - $(HALINC) $(OSALINC) $(PLATFORMINC) $(BOARDINC) \ - $(STREAMSINC) $(SHELLINC) $(CHIBIOS)/os/various - -# List the user directory to look for the libraries here -ULIBDIR = +# List ASM source files here +ASMSRC = $(STARTUPASM) $(PORTASM) $(OSALASM) -# List all user libraries here -ULIBS = +INCDIR = $(STARTUPINC) $(KERNINC) $(PORTINC) $(OSALINC) \ + $(HALINC) $(PLATFORMINC) $(BOARDINC) $(TESTINC) \ + $(STREAMSINC) $(SHELLINC) -# Define optimisation level here -OPT = -ggdb -O2 +# +# Project, sources and paths +############################################################################## +############################################################################## +# Compiler settings # -# End of user defines -############################################################################################## -INCDIR = $(patsubst %,-I%,$(DINCDIR) $(UINCDIR)) -LIBDIR = $(patsubst %,-L%,$(DLIBDIR) $(ULIBDIR)) -DEFS = $(DDEFS) $(UDEFS) -ADEFS = $(DADEFS) $(UADEFS) -OBJS = $(ASRC:.s=.o) $(SRC:.c=.o) -LIBS = $(DLIBS) $(ULIBS) +#TRGT = powerpc-eabi- +TRGT = mingw32- +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 -LDFLAGS = -Wl,-Map=$(PROJECT).map,--cref,--no-warn-mismatch $(LIBDIR) -ASFLAGS = -Wa,-amhls=$(<:.s=.lst) $(ADEFS) -CPFLAGS = -Wall -Wextra -Wundef -Wstrict-prototypes -fverbose-asm -Wa,-alms=$(<:.c=.lst) $(DEFS) +# Define C warning options here +CWARN = -Wall -Wextra -Wundef -Wstrict-prototypes -# Generate dependency information -CPFLAGS += -MD -MP -MF .dep/$(@F).d +# Define C++ warning options here +CPPWARN = -Wall -Wextra -Wundef # -# makefile rules -# +# Compiler settings +############################################################################## -all: $(OBJS) $(PROJECT).exe +############################################################################## +# Start of user section +# -%.o : %.c - $(CC) -c $(OPT) $(CPFLAGS) -I . $(INCDIR) $< -o $@ +# List all user C define here, like -D_DEBUG=1 +UDEFS = -DSIMULATOR -%.o : %.s - $(AS) -c $(OPT) $(ASFLAGS) $< -o $@ +# Define ASM defines here +UADEFS = -%exe: $(OBJS) - $(CC) $(OPT) $(OBJS) $(LDFLAGS) $(LIBS) -o $@ +# List all user directories here +UINCDIR = -gcov: - -mkdir gcov - $(COV) -u $(subst /,\,$(SRC)) - -mv *.gcov ./gcov +# List the user directory to look for the libraries here +ULIBDIR = -clean: - -rm -f $(OBJS) - -rm -f $(PROJECT).exe - -rm -f $(PROJECT).map - -rm -f $(SRC:.c=.c.bak) - -rm -f $(SRC:.c=.lst) - -rm -f $(ASRC:.s=.s.bak) - -rm -f $(ASRC:.s=.lst) - -rm -fR .dep +# List all user libraries here +ULIBS = -lws2_32 # -# Include the dependency files, should be the last of the makefile -# --include $(shell mkdir .dep 2>/dev/null) $(wildcard .dep/*) +# End of user defines +############################################################################## -# *** EOF *** +RULESPATH = $(CHIBIOS)/os/common/startup/SIMIA32/compilers/GCC +include $(RULESPATH)/rules.mk -- cgit v1.2.3