diff options
author | Maximilien Cuony <maximilien@theglu.org> | 2016-05-31 21:58:17 +0200 |
---|---|---|
committer | Maximilien Cuony <maximilien@theglu.org> | 2016-05-31 21:58:17 +0200 |
commit | 9069fc127e4f73041fbd1f66e4506fcf12418315 (patch) | |
tree | 902aa478c6e9d47cde89eaa996b5f7f662070518 /src/simulator/Makefile | |
parent | 4803231e214fbd19eab4ba2289583859ee07183f (diff) | |
download | glutte-o-matic-9069fc127e4f73041fbd1f66e4506fcf12418315.tar.gz glutte-o-matic-9069fc127e4f73041fbd1f66e4506fcf12418315.tar.bz2 glutte-o-matic-9069fc127e4f73041fbd1f66e4506fcf12418315.zip |
Simuator - Work in progress
Diffstat (limited to 'src/simulator/Makefile')
-rw-r--r-- | src/simulator/Makefile | 134 |
1 files changed, 134 insertions, 0 deletions
diff --git a/src/simulator/Makefile b/src/simulator/Makefile new file mode 100644 index 0000000..4e74498 --- /dev/null +++ b/src/simulator/Makefile @@ -0,0 +1,134 @@ + +######## Build options ######## + +verbose = 0 + +######## Build setup ######## + +# SRCROOT should always be the current directory +SRCROOT = $(CURDIR) + +# .o directory +ODIR = obj + +# Source VPATHS +VPATH += $(SRCROOT)/Source +VPATH += $(SRCROOT)/Source/portable/MemMang +VPATH += $(SRCROOT)/Source/portable/GCC/POSIX +VPATH += $(SRCROOT)/src/Core + +# FreeRTOS Objects +C_FILES += croutine.c +C_FILES += event_groups.c +C_FILES += list.c +C_FILES += queue.c +C_FILES += tasks.c +C_FILES += timers.c + +# portable Objects +C_FILES += heap_3.c +C_FILES += port.c + +# Main Object +SRC_SOURCES+=$(shell find -L src/ -name '*.c') +C_FILES += $(SRC_SOURCES) + +# Include Paths +INCLUDES += -I$(SRCROOT)/Source/include +INCLUDES += -I$(SRCROOT)/Source/portable/GCC/POSIX/ +INCLUDES += -I$(SRCROOT)/src/Core +INCLUDES += -I$(SRCROOT)/../common/includes/ +INCLUDES += -I$(SRCROOT) + +# Generate OBJS names +OBJS = $(patsubst %.c,%.o,$(C_FILES)) + +######## C Flags ######## + +# Warnings +CWARNS += -W +CWARNS += -Wall +# CWARNS += -Werror +CWARNS += -Wextra +CWARNS += -Wformat +CWARNS += -Wmissing-braces +CWARNS += -Wno-cast-align +CWARNS += -Wparentheses +CWARNS += -Wshadow +CWARNS += -Wno-sign-compare +CWARNS += -Wswitch +CWARNS += -Wuninitialized +CWARNS += -Wunknown-pragmas +CWARNS += -Wunused-function +CWARNS += -Wunused-label +CWARNS += -Wunused-parameter +CWARNS += -Wunused-value +CWARNS += -Wunused-variable +CWARNS += -Wmissing-prototypes + +CFLAGS += -m32 +CFLAGS += -DDEBUG=1 +CFLAGS += -g -DUSE_STDIO=1 -D__GCC_POSIX__=1 -lX11 -lm -lGL -lm -lGLU +ifneq ($(shell uname), Darwin) +CFLAGS += -pthread +endif + +# MAX_NUMBER_OF_TASKS = max pthreads used in the POSIX port. +# Default value is 64 (_POSIX_THREAD_THREADS_MAX), the minimum number required by POSIX. +CFLAGS += -DMAX_NUMBER_OF_TASKS=300 -DSIMULATOR + +CFLAGS += $(INCLUDES) $(CWARNS) -O2 + +######## Makefile targets ######## + +# Rules +.PHONY : all +all: vc.h setup FreeRTOS-Sim + +.PHONY : setup +setup: +# Make obj directory + @mkdir -p $(ODIR) + +# Fix to place .o files in ODIR +_OBJS = $(patsubst %,$(ODIR)/%,$(OBJS)) + +dir_guard=@mkdir -p $(@D) + +$(ODIR)/%.o: %.c + $(dir_guard) +# If verbose, print gcc execution, else hide +ifeq ($(verbose),1) + @echo ">> Compiling $<" + $(CC) $(CFLAGS) -c -o $@ $< +else + @echo ">> Compiling $(notdir $<)" + @$(CC) $(CFLAGS) -c -o $@ $< +endif + + +vc.h: ../../.git/logs/HEAD + echo "// This file is generated by Makefile." > vc.h + echo "// Do not edit this file!" >> vc.h + git log -1 --format="format:#define GIT_VERSION \"%h\"" >> vc.h + echo >> vc.h + echo >> vc.h + +FreeRTOS-Sim: $(_OBJS) + @echo ">> Linking $@..." +ifeq ($(verbose),1) + $(CC) $(CFLAGS) $^ $(LINKFLAGS) $(LIBS) -o $@ +else + @$(CC) $(CFLAGS) $^ $(LINKFLAGS) $(LIBS) -o $@ +endif + + @echo "-------------------------" + @echo "BUILD COMPLETE: $@" + @echo "-------------------------" + +.PHONY : clean +clean: + @-rm -rf $(ODIR) FreeRTOS-Sim + @echo "--------------" + @echo "CLEAN COMPLETE" + @echo "--------------" |