From b9a133c8259a7e36de423003d35ad3c05cddfe8c Mon Sep 17 00:00:00 2001 From: Chris Tallon Date: Tue, 31 Aug 2021 17:41:28 +0100 Subject: [PATCH] Makefile improvements --- GNUmakefile | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/GNUmakefile b/GNUmakefile index 62b9f52..36ae7aa 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -20,6 +20,7 @@ $(info Build system selected: $(vomp_platform)) #VOMP_OPTIONS+= -DVOMP_HAS_EXIT CROSSROOT=/pi-root +SYSROOT=--sysroot=$(CROSSROOT) ifndef VERBOSE Q = @ @@ -47,6 +48,9 @@ PICTURES += -Wl,other/recfolder.png PICTURES += -Wl,other/defposter.png PICTURES += -Wl,--format=default +DEFINES=-D_GNU_SOURCE + + ifeq ($(vomp_platform),raspberry) $(info Raspberry Pi native compiler) CC=gcc @@ -62,13 +66,13 @@ LD=g++ LDFLAGS = -fuse-ld=gold $(PICTURES) #-fuse-ld=gold -VOMP_OPTIONS += -DIPV4 -DIPV6 +DEFINES += -DIPV4 -DIPV6 LIBPATHS = -L/opt/vc/lib -L/usr/lib/arm-linux-gnueabihf LIBS = -lpthread -lrt -lbrcmEGL -lbrcmOpenVG -lopenmaxil -lbcm_host -lavformat -lavcodec -lavutil -lswresample LIBS += -ldl -lfontconfig -lfreetype -lMagick++-6.Q16 OBJECTS = $(OBJ_COMMON) $(OBJ_RASPBERRY) INCLUDES = -I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads -I/usr/include/freetype2 -I/usr/include/ImageMagick -I/usr/include/ImageMagick-6 -I/usr/include/arm-linux-gnueabihf/ImageMagick-6 -PLATFORM = -DVOMP_PLATFORM_RASPBERRY +DEFINES += -DVOMP_PLATFORM_RASPBERRY CXXFLAGS_EXTRA = -Wno-psabi endif @@ -78,30 +82,31 @@ endif # apt install g++-arm-linux-gnueabihf # Set vomp_platform=crossraspberry above ifeq ($(vomp_platform),crossraspberry) -VOMP_OPTIONS += -DIPV4 -DIPV6 +DEFINES += -DIPV4 -DIPV6 CROSS_PREFIX=arm-linux-gnueabihf- CC=$(CROSS_PREFIX)gcc STRIP=$(CROSS_PREFIX)strip CXX=$(CROSS_PREFIX)g++ LD=$(CROSS_PREFIX)g++ -LDFLAGS = -Wall $(PICTURES) --sysroot=$(CROSSROOT) \ +LDFLAGS = -Wall $(PICTURES) $(SYSROOT) \ -Wl,-rpath-link,$(CROSSROOT)/opt/vc/lib -Wl,-rpath-link,$(CROSSROOT)/usr/lib/arm-linux-gnueabihf \ -L=/opt/vc/lib -L=/usr/lib/arm-linux-gnueabihf LIBPATHS = LIBS = -lpthread -lstdc++ -lrt -lbrcmEGL -lbrcmOpenVG -lopenmaxil -lbcm_host -lavformat -lavcodec \ -lavutil -lswresample -lm -ldl -lfontconfig -lfreetype -lMagick++-6.Q16 -lMagickWand-6.Q16 -lMagickCore-6.Q16 OBJECTS = $(OBJ_COMMON) $(OBJ_RASPBERRY) -INCLUDES = --sysroot=$(CROSSROOT) -I=/usr/include/arm-linux-gnueabihf -I=/opt/vc/include -I=/usr/include/freetype2 -I=/usr/include/arm-linux-gnueabihf/ImageMagick-6 -I=/usr/include/ImageMagick-6 -PLATFORM = -DVOMP_PLATFORM_RASPBERRY -CXXFLAGS_EXTRA = -mtune=cortex-a7 -mfloat-abi=hard -fopenmp +INCLUDES = -isystem=/usr/include/arm-linux-gnueabihf -isystem=/opt/vc/include -isystem=/usr/include/freetype2 -isystem=/usr/include/arm-linux-gnueabihf/ImageMagick-6 -isystem=/usr/include/ImageMagick-6 +DEFINES += -DVOMP_PLATFORM_RASPBERRY -DMAGICKCORE_HDRI_ENABLE=0 -DMAGICKCORE_QUANTUM_DEPTH=16 +CXXFLAGS_EXTRA = $(SYSROOT) -Wno-psabi -mtune=cortex-a7 -mfloat-abi=hard -fopenmp endif -CXXFLAGS_DEV = -g -O0 -Wall -Wextra -Wshadow -Werror=return-type -Wmissing-declarations -Winit-self -Woverloaded-virtual -Wold-style-cast -Wconversion -std=c++14 $(CXXFLAGS_EXTRA) -DDEV -D_GNU_SOURCE -DMAGICKCORE_HDRI_ENABLE=0 -DMAGICKCORE_QUANTUM_DEPTH=16 $(PLATFORM) $(VOMP_OPTIONS) $(INCLUDES) -CXXFLAGS_REL = -O3 -Wall -Werror -std=c++14 $(CXXFLAGS_EXTRA) -D_GNU_SOURCE -DMAGICKCORE_HDRI_ENABLE=0 -DMAGICKCORE_QUANTUM_DEPTH=16 $(PLATFORM) $(VOMP_OPTIONS) $(INCLUDES) +CXXFLAGS_DEV = $(DEFINES) -DDEV -g -O0 -Wall -Wextra -Wshadow -Werror=return-type -Wmissing-format-attribute -Wdisabled-optimization -Wmissing-declarations -Wmissing-noreturn -Winit-self -Woverloaded-virtual -Wold-style-cast -Wconversion -std=c++14 $(CXXFLAGS_EXTRA) $(INCLUDES) +CXXFLAGS_REL = $(DEFINES) -O3 -Wall -Werror -std=c++14 $(CXXFLAGS_EXTRA) $(INCLUDES) + .PHONY: clean fresh all install strip default: dev @@ -114,6 +119,7 @@ fresh: clean default vompclient: $(OBJECTS) @echo LD vompclient $(Q)$(LD) $(LDFLAGS) $(LIBPATHS) -o vompclient $(OBJECTS) $(LIBS) + @echo Done strip: @echo STRIP vompclient @@ -131,7 +137,7 @@ clean: ifndef SKIPDEPS deps: GNUmakefile @echo "DEPS" - $(Q)$(CC) -MM $(INCLUDES) $(OBJECTS:%.o=%.cc) > deps + $(Q)$(CC) -MM $(SYSROOT) $(INCLUDES) $(OBJECTS:%.o=%.cc) > deps endif ifneq ($(MAKECMDGOALS),clean) -- 2.39.5