41 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			Makefile
		
	
	
	
	
	
			
		
		
	
	
			41 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			Makefile
		
	
	
	
	
	
# Helper macros to convert spaces into question marks and back again
 | 
						|
e := 
 | 
						|
sp := $(e) $(e)
 | 
						|
qs = $(subst ?,$(sp),$1)
 | 
						|
sq = $(subst $(sp),?,$1)
 | 
						|
 | 
						|
# Get name of this Makefile (avoid getting word 0 and a starting space)
 | 
						|
makefile_name := $(wordlist 1,1000,$(MAKEFILE_LIST))
 | 
						|
 | 
						|
# Get path of this Makefile
 | 
						|
makefile_path := $(call qs,$(dir $(call sq,$(abspath $(call sq,$(makefile_name))))))
 | 
						|
 | 
						|
# Get path where the Application is
 | 
						|
application_path := $(call qs,$(abspath $(call sq,$(makefile_path)../..)))
 | 
						|
# Under Windows (MINGW32), the path is returned as e.g. z:/path/to/application
 | 
						|
# Since the path may show up as a target in the Makefile, we can't have a colon
 | 
						|
# in it. So we replace z:/ with /z/ to avoid this.
 | 
						|
subst_drivename = $(shell echo $(1) | sed -e 's!^\([a-zA-Z]\):/!/\1/!')
 | 
						|
application_path := $(call subst_drivename,$(application_path))
 | 
						|
 | 
						|
.PHONY: clean assets all
 | 
						|
 | 
						|
ifneq ($(words $(makefile_path))$(words $(MAKEFILE_LIST)),11)
 | 
						|
all clean assets:
 | 
						|
$(error Spaces not allowed in path)
 | 
						|
else
 | 
						|
 | 
						|
ADDITIONAL_SOURCES := vehicle_state.c
 | 
						|
ADDITIONAL_INCLUDE_PATHS := $(application_path)/../Core/Inc
 | 
						|
ADDITIONAL_LIBRARY_PATHS := 
 | 
						|
ADDITIONAL_LIBRARIES :=
 | 
						|
export ADDITIONAL_SOURCES ADDITIONAL_INCLUDE_PATHS ADDITIONAL_LIBRARY_PATHS ADDITIONAL_LIBRARIES
 | 
						|
 | 
						|
all: $(filter assets,$(MAKECMDGOALS))
 | 
						|
all assets: $(filter clean,$(MAKECMDGOALS))
 | 
						|
all clean assets:
 | 
						|
	@echo ADDITIONAL_SOURCES: $(ADDITIONAL_SOURCES)
 | 
						|
	@$(MAKE) -r -f generated/simulator/gcc/Makefile -s $(MFLAGS) $@ -C "$(application_path)"
 | 
						|
endif
 | 
						|
 |