From b6682f4de7d2bb7e88721e8fd473519f0249796d Mon Sep 17 00:00:00 2001 From: Howard Su Date: Sun, 3 Mar 2019 17:59:09 +0800 Subject: [PATCH 01/15] Refector Makefile Move distclean to root Makefile Fix emu_devo8 move back from firmware --- src/Makefile | 364 +----------------- src/Makefile.inc | 340 ++++++++++++++++ src/config/voice.c | 2 +- src/target/drivers/mcu/emu/Makefile.inc | 19 +- src/target/tx/devo/common/Makefile.inc | 7 +- .../tx/devo/devo8/{Makefile.inc => Makefile} | 2 + .../devo/emu_devo8/{Makefile.inc => Makefile} | 5 +- src/target/tx/radiolink/common/Makefile.inc | 5 - 8 files changed, 371 insertions(+), 373 deletions(-) create mode 100644 src/Makefile.inc rename src/target/tx/devo/devo8/{Makefile.inc => Makefile} (89%) rename src/target/tx/devo/emu_devo8/{Makefile.inc => Makefile} (65%) diff --git a/src/Makefile b/src/Makefile index c2ff01d407..078a87c3c4 100644 --- a/src/Makefile +++ b/src/Makefile @@ -4,10 +4,14 @@ unexport LANGUAGE MAKEFLAGS += --no-builtin-rules .SUFFIXES: +# Setup common folder structure variables +mkfile_path := $(abspath $(lastword $(MAKEFILE_LIST))) +SDIR = $(dir $(mkfile_path)) +export + ########################################### ## Provide some convenient make targets ## ########################################### -ifndef TARGET TARGET ?= devo8 default: $(TARGET) @@ -32,380 +36,42 @@ everything: txs emus fss # Generate the targets for a transmitter. define make-target $1: - +$(MAKE) TARGET=$1 + +$(MAKE) -C target/tx/$2/$1 win_$1: ifeq ($(OS),Windows_NT) # This builds Windows emulators on a Windows system - +$(MAKE) TARGET=$1 WINDOWS=1 + +$(MAKE) -C target/tx/$2/$1 WINDOWS=1 else # This builds Windows emulators on a Linux system - +$(MAKE) TARGET=$1 WINDOWS=1 CROSS=i586-mingw32msvc- + +$(MAKE) -C target/tx/$2/$1 WINDOWS=1 CROSS=i586-mingw32msvc- endif fs_$1: ifneq "$(INCLUDE_FS)" "1" - +$(MAKE) TARGET=$1 fs + +$(MAKE) -C target/tx/$2/$1 fs endif both_$1: $1 emu_$1 zip_$1: - +$(MAKE) TARGET=$1 zip + +$(MAKE) -C target/tx/$2/$1 zip zip_win_$1: ifeq ($(OS),Windows_NT) # This builds Windows emulators on a Windows system - +$(MAKE) TARGET=$1 WINDOWS=1 zip + +$(MAKE) -C target/tx/$2/$1 WINDOWS=1 zip else # This builds Windows emulators on a Linux system - +$(MAKE) TARGET=$1 WINDOWS=1 CROSS=i586-mingw32msvc- zip + +$(MAKE) -C target/tx/$2/$1 WINDOWS=1 CROSS=i586-mingw32msvc- zip endif release_$1: zip_$1 zip_win_emu_$1 fs_$1 all_$1: - +$(MAKE) TARGET=$1 all + +$(MAKE) -C target/tx/$2/$1 all endef # Now generate all the convenience targets -$(foreach t,$(ALLTARGETS),$(eval $(call make-target,$t))) -endif - -# Determine the directory above the target directory -FAMILY = $(notdir $(patsubst %/,%,$(dir $(wildcard target/tx/*/$(TARGET))))) - -# We want to turn on INCLUDE_FS by default -INCLUDE_FS ?= 1 - -# Use VERBOSE=1 to enable verbose make -PROGMODE ?= STATUS_SCREEN -SDIR := . -include target/tx/$(FAMILY)/$(TARGET)/Makefile.inc - -NUM_MODELS ?= 30 -TYPE ?= prd - -############################################### -#This section defines binaries needed to build# -############################################### -ifdef CROSS - CC = $(CROSS)gcc - CXX = $(CROSS)g++ - LD = $(CROSS)ld - AR = $(CROSS)ar - AS = $(CROSS)as - CP = $(CROSS)objcopy - DUMP = $(CROSS)objdump - NM = $(CROSS)nm -endif -CC ?= gcc -CXX ?= g++ -LD ?= ld -AR ?= ar -AS ?= as -CP ?= objcopy -DUMP ?= objdump -############################################### -#END SECTION # -############################################### - -############################################ -#This section defines the source files used# -############################################ -SRC_C += $(wildcard *.c) $(wildcard misc/*.c) $(wildcard screen/*.c) $(wildcard screen/$(SCREENSIZE)/*.c) \ - $(wildcard gui/*.c) $(wildcard pages/$(SCREENSIZE)/*.c) $(wildcard config/*.c) - -ifdef MODULAR - SRC_C += protocol/protocol.c - PROTO_SRC_C := $(filter-out protocol/protocol.c, $(wildcard protocol/*.c) $(wildcard protocol/spi/*.c)) -else - SRC_C := $(SRC_C) $(wildcard protocol/*.c) $(wildcard protocol/spi/*.c) -endif - -SRC_C := $(SRC_C) $(wildcard pages/$(SCREENSIZE)/standard/*.c) -SRC_C := $(SRC_C) $(wildcard pages/$(SCREENSIZE)/advanced/*.c) - -SRC_S := $(SRC_S) $(wildcard *.s) -SRC_CXX := $(SRC_CXX) $(wildcard *.cpp) -SRCS := $(SRC_C) $(SRC_CXX) $(SRC_S) -############################################ -#END SECTION # -############################################ - - -############################################ -#This section intermediate build files # -############################################ -ODIR = objs/$(TARGET)$(ODIREXT) -OBJS = $(addprefix $(ODIR)/, $(notdir $(SRC_C:.c=.o) $(SRC_S:.s=.o) $(SRC_CXX:.cpp=.o))) - -ifdef MODULAR -PROTO_OBJS := $(addprefix $(ODIR)/, $(notdir $(PROTO_SRC_C:.c=.o))) -PROTO_LIBS := $(addprefix $(ODIR)/, $(notdir $(PROTO_SRC_C:.c=.bin))) -PROTO_EXTRA_OBJS := $(addprefix $(ODIR)/, $(notdir $(PROTO_EXTRA_C:.c=.o_))) -SYMBOL_FILE := $(ODIR)/symbolfile -endif - -HGVERSION ?= $(shell ../utils/get_version.pl ${TARGET}) -HGVERSION := $(HGVERSION) - -# Rebuild on hg version change. -# Based on http://mercurial.selenic.com/wiki/VersioningWithMake -# We need to always run this code, as opposed to running it from a prerequisite -# The HGTEST variable is not used -HGTEST := $(shell mkdir -p $(ODIR); \ - [ -f $(ODIR)/hgstamp ] || touch $(ODIR)/hgstamp; \ - echo $(HGVERSION) | cmp -s $(ODIR)/hgstamp - \ - || echo $(HGVERSION) > $(ODIR)/hgstamp) -############################################ -#END SECTION # -############################################ - -################################################## -#This section contains switches used for building# -################################################## -ifeq "$(TYPE)" "dev" - CFLAGS := $(CFLAGS) -DBUILDTYPE_DEV -endif -ifdef MODULAR -MODULE_CFLAGS := -DMODULAR=$(MODULAR) -CFLAGS += -DENABLE_MODULAR=$(MODULAR) -endif - -CFLAGS := $(CFLAGS) -g -Wall -Wextra -Werror=undef -I. -D$(PROGMODE) -std=gnu99 -Itarget/tx/$(FAMILY)/$(TARGET) -Igui/$(SCREENSIZE) \ - -Ipages/$(SCREENSIZE) \ - -DHGVERSION="\"${HGVERSION}\"" -CXXFLAGS := $(CXXFLAGS) $(patsubst -std=gnu99,,$(CFLAGS)) -EXEEXT ?= elf -################################################## -#END SECTION # -################################################## - -############################################ -#this section defines final build files # -############################################ -FILESYSTEM = $(subst emu_,,$(TARGET)) -MODELDIR = filesystem/$(FILESYSTEM)/models - -LAST_MODEL := $(MODELDIR)/model$(NUM_MODELS).ini - -ALL += $(TARGET).fs_wrapper -ifdef MODULAR -include protocol/Makefile.inc -endif -############################################ -#END SECTION # -############################################ - -############################################ -#this section includes build targets # -############################################ -all : $(ALL) - -#################################### -# recompile if the Makefile changes# -#################################### -$(OBJS) $(PROTO_OBJS) ($PROTO_EXTRA_OBJS): Makefile target/tx/$(FAMILY)/$(TARGET)/Makefile.inc $(EXTRA_MAKEFILES) - -################################################################################## -# The following enables quiet output unless you use VERBOSE=1 # -# Note that this must be after the 1st rule so that it doesn't execute by default# -################################################################################## -$(VERBOSE).SILENT: - -.PHONY: clean distclean language lint - -clean: - rm -f $(TARGET).$(EXEEXT) $(TARGET).exe $(TARGET).bin $(TARGET).dfu $(TARGET).list \ - $(TARGET).map $(ODIR)/*.o $(ODIR)/*.o_ $(ODIR)/*.P $(ODIR)/*.bin \ - filesystem/$(FILESYSYTEM) 2> /dev/null || true +$(foreach t,$(ALLTARGETS),$(eval $(call make-target,$t,$(notdir $(patsubst %/,%,$(dir $(wildcard target/tx/*/$(TARGET)))))))) +.PHONY: distclean distclean: rm -f *.$(EXEEXT) *.exe *.bin *.dfu *.list *.map rm -rf objs rm -rf filesystem $(MAKE) -C libopencm3 clean > /dev/null rm -rf deviation*.zip - -language: - ../utils/extract_strings.pl -po > fs/language/deviation.po - - -zip: $(TARGET).zip - -%.zip: $(ALL) $(TARGET).dfu $(PROTO_MODULES) - #This is not an emulator build (emulator is hanled in target/common/emu/Makefile.inc) - cp -f $(TARGET).dfu deviation-$(HGVERSION).dfu - rm -f deviation-$(HGVERSION).zip - rm -f debug-$(HGVERSION).zip - zip debug-$(HGVERSION).zip $(TARGET).elf - # $(MAKE) zipping more compatible with other distributions - export p=`pwd`; cd $(ODIR) && test -e devo.fs && zip -u $$p/deviation-$(HGVERSION).zip devo.fs && rm devo.fs || true - zip deviation-$(HGVERSION).zip deviation-$(HGVERSION).dfu UPDATING.md -ifdef MODULAR - export p=`pwd`; cd $(ODIR) && zip -ur $$p/deviation-$(HGVERSION).zip protocol/*.mod - export p=`pwd`; cd $(ODIR) && zip -u $$p/debug-$(HGVERSION).zip *.elf - rm -rf $(ODIR)/protocol -endif -ifeq "$(INCLUDE_FS)" "1" - export p=`pwd`; cd filesystem/$(FILESYSTEM) && zip -ur $$p/deviation-$(HGVERSION).zip * -endif - zip -u deviation-$(HGVERSION).zip debug-$(HGVERSION).zip - rm -f debug-$(HGVERSION).zip - rm -f deviation-$(HGVERSION).dfu - -fs: $(TARGET).fs - -%.fs: - rm -f deviation-fs-$(HGVERSION).zip; zip -r deviation-fs-$(HGVERSION).zip filesystem/$(FILESYSTEM) - -release: $(TXS:%=zip_%) $(EMUS:%=zip_win_%) $(TXS:%=fs_%) - -coverity: - rm -rf cov-int 2>/dev/null; $(MAKE) distclean - cov-build --dir cov-int make TARGET=devo8 - cov-build --dir cov-int make TARGET=devo10 - tar -cvzf coverity-$(HGVERSION).tgz cov-int - -lint: - ../utils/run_linter.py --diff --debug - -########################################## -#Ensure necessary directories are created# -########################################## -$(OBJS): | $(ODIR) - -$(ODIR): - @mkdir -p $@ - -$(MODELDIR): - @mkdir -p $@ - -###################### -#The main executable # -###################### -$(TARGET).$(EXEEXT): $(LINKFILE) $(OBJS) $(LIBOPENCM3) - @echo " + Building '$@'" -ifdef LINKFILE #Create an empty 'obj/$(TARGET)/optimize.ld' just in case the linker script needs it - echo "" > objs/$(TARGET)/optimize.ld -endif -ifeq ("$(SRC_CXX)", " ") - $(CC) -o $@ $(OBJS) $(LIBOPENCM3) $(LFLAGS) $(LFLAGS2) $(CFLAGS) $(EXTRA_CFLAGS) -else - $(CXX) -o $@ $(OBJS) $(LIBOPENCM3) $(LFLAGS) $(LFLAGS2) $(CFLAGS) $(EXTRA_CFLAGS) -endif - -################# -#The filesystem # -################# -%.fs_wrapper: $(LAST_MODEL) - true - -.PHONY: $(PRE_FS) $(LAST_MODEL) -$(LAST_MODEL): model_template.ini tx_template.ini $(FONTS) $(PRE_FS) - @echo " + Copying template files for $(FILESYSTEM)" - mkdir -p filesystem/$(FILESYSTEM) || true - for i in $(FILESYSTEMS); do cp -prf fs/$$i/* filesystem/$(FILESYSTEM)/; done - rm filesystem/$(FILESYSTEM)/*/.ignore 2>/dev/null || true - cp tx_template.ini filesystem/$(FILESYSTEM)/tx.ini - echo 'empty' > filesystem/$(FILESYSTEM)/errors.txt - mkdir filesystem/$(FILESYSTEM)/models 2> /dev/null || true - echo 'name=Model1' > filesystem/$(FILESYSTEM)/models/model1.ini \ - && cat model_template.ini >> filesystem/$(FILESYSTEM)/models/model1.ini - cp model_template.ini filesystem/$(FILESYSTEM)/models/default.ini -ifdef LANGUAGE - mkdir filesystem/$(FILESYSTEM)/language 2> /dev/null; \ - ../utils/extract_strings.pl -po -fs filesystem/$(FILESYSTEM)/language -targets $(LANGUAGE) -update -objdir $(ODIR) -endif - export tx=$(FILESYSTEM); \ - number=2 ; while [ $$number -le $(NUM_MODELS) ] ; do \ - cp model_template.ini filesystem/$$tx/models/model$$number.ini; \ - number=`expr $$number + 1`; \ - done - @echo " + Checking string list length for $(FILESYSTEM)" -ifeq "$(TYPE)" "dev" - ../utils/check_string_size.pl -target $(FILESYSTEM) -objdir $(ODIR) -else - ../utils/check_string_size.pl -target $(FILESYSTEM) -objdir $(ODIR) -quiet -endif - ../utils/run_linter.py --diff --skip-github --no-fail - -###################### -#Necessary Font files# -###################### -filesystem/$(FILESYSTEM)/media/12normal.fon: fonts/12normal.bdf - mkdir -p filesystem/$(FILESYSTEM)/media/ - ../utils/font/bdf_to_font.pl -maxsize 12 -mode bin $< -out $@ -minspace 10 - -filesystem/$(FILESYSTEM)/media/15normal.fon: fonts/15normal.bdf - mkdir -p filesystem/$(FILESYSTEM)/media/ - ../utils/font/bdf_to_font.pl -maxsize 15 -mode bin $< -out $@ -minspace 8 - -# special font for f12e with 18x12 char size -filesystem/$(FILESYSTEM)/media/f12e.fon: fonts/f12e.bdf - mkdir -p filesystem/$(FILESYSTEM)/media/ - ../utils/font/bdf_to_font.pl -maxsize 18 -mode bin $< -out $@ -minspace 8 - -filesystem/$(FILESYSTEM)/media/12ascii.fon: fonts/12normal.bdf - mkdir -p filesystem/$(FILESYSTEM)/media/ - ../utils/font/bdf_to_font.pl -maxsize 12 -mode bin $< -out $@ -minspace 10 -ascii - -filesystem/$(FILESYSTEM)/media/15ascii.fon: fonts/15normal.bdf - mkdir -p filesystem/$(FILESYSTEM)/media/ - ../utils/font/bdf_to_font.pl -maxsize 15 -mode bin $< -out $@ -minspace 8 -ascii - -filesystem/$(FILESYSTEM)/media/23bold.fon: fonts/23bold.bdf - mkdir -p filesystem/$(FILESYSTEM)/media/ - ../utils/font/bdf_to_font.pl -maxsize 23 -mode bin $< -out $@ -minspace 8 - -filesystem/$(FILESYSTEM)/media/04b03.fon: fonts/04b03.bdf - mkdir -p filesystem/$(FILESYSTEM)/media/ - ../utils/font/bdf_to_font.pl -maxsize 5 -mode bin $< -out $@ -minspace 5 - -############################## -#Build rules for all .o files# -############################## -## The autodependency magic below was adapeted from: -## http://mad-scientist.net/make/autodep.html --include $(OBJS:.o=.P) --include $(PROTO_OBJS:.o=.P) --include $(PROTO_EXTRA_OBJS:.o_=.P) - -dollar = $$ -define define_compile_rules -$(ODIR)/%.o: $(1)%.c $(LIBOPENCM3) - @echo " + Compiling '$$<'" - $(CC) $$(CFLAGS) $$(EXTRA_CFLAGS) $$(CFLAGS_$$(basename $$(notdir $$<))) -MD -c -o $$@ $$< - @cp $(ODIR)/$$*.d $(ODIR)/$$*.P; \ - sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$(dollar)//' \ - -e '/^$$(dollar)/ d' -e 's/$$(dollar)/ :/' < $(ODIR)/$$*.d >> $(ODIR)/$$*.P; \ - rm -f $(ODIR)/$$*.d - -$(ODIR)/%.o: $(1)%.cpp $(LIBOPENCM3) - @echo " + Compiling '$$<'" - $(CXX) $$(CXXFLAGS) $(EXTRA_CFLAGS) $$(CXXFLAGS_$$(basename $$(notdir $$<))) -MD -c -o $$@ $$< - @cp $(ODIR)/$$*.d $(ODIR)/$$*.P; \ - sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$(dollar)//' \ - -e '/^$$(dollar)/ d' -e 's/$$(dollar)/ :/' < $(ODIR)/$$*.d >> $(ODIR)/$$*.P; \ - rm -f $(ODIR)/$$*.d - -#For module building -$(ODIR)/%.o_: $(1)%.c $(LIBOPENCM3) - @echo " + Compiling '$$<' as module" - $(CC) $$(CFLAGS) $$(MODULE_CFLAGS) $$(CFLAGS_$$(basename $$(notdir $$<))) -MD -c -o $$@ $$< - @cp $(ODIR)/$$*.d $(ODIR)/$$*.P; \ - sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$(dollar)//' \ - -e '/^$$(dollar)/ d' -e 's/$$(dollar)/ :/' < $(ODIR)/$$*.d >> $(ODIR)/$$*.P; \ - rm -f $(ODIR)/$$*.d - -endef -$(foreach directory,$(sort $(dir $(SRCS) $(PROTO_EXTRA_C))),$(eval $(call define_compile_rules,$(directory)))) - -############################## -#Ensure version is up to date# -############################## -# Rebuild on hg version change. -$(ODIR)/version.o: $(ODIR)/hgstamp - -$(ODIR)/hgstamp: - echo $(HGVERSION) > $(ODIR)/hgstamp - -BUILD_TARGET := 1 -include target/tx/$(FAMILY)/$(TARGET)/Makefile.inc -ifdef MODULAR -include protocol/Makefile.inc -endif diff --git a/src/Makefile.inc b/src/Makefile.inc new file mode 100644 index 0000000000..58b31e8b12 --- /dev/null +++ b/src/Makefile.inc @@ -0,0 +1,340 @@ + +# We want to turn on INCLUDE_FS by default +INCLUDE_FS ?= 1 + +# Use VERBOSE=1 to enable verbose make +PROGMODE ?= STATUS_SCREEN + +NUM_MODELS ?= 30 +TYPE ?= prd + +############################################### +#This section defines binaries needed to build# +############################################### +ifdef CROSS + CC = $(CROSS)gcc + CXX = $(CROSS)g++ + LD = $(CROSS)ld + AR = $(CROSS)ar + AS = $(CROSS)as + CP = $(CROSS)objcopy + DUMP = $(CROSS)objdump + NM = $(CROSS)nm +endif +CC ?= gcc +CXX ?= g++ +LD ?= ld +AR ?= ar +AS ?= as +CP ?= objcopy +DUMP ?= objdump +############################################### +#END SECTION # +############################################### + +############################################ +#This section defines the source files used# +############################################ +#ifndef SCREENSIZE +#error please define SCREENSIZE +#endif + +SRC_C += $(wildcard $(SDIR)/*.c) \ + $(wildcard $(SDIR)/misc/*.c) \ + $(wildcard $(SDIR)/screen/*.c) \ + $(wildcard $(SDIR)/screen/$(SCREENSIZE)/*.c) \ + $(wildcard $(SDIR)/gui/*.c) \ + $(wildcard $(SDIR)/pages/$(SCREENSIZE)/*.c) \ + $(wildcard $(SDIR)/config/*.c) + +ifdef MODULAR + SRC_C += $(SDIR)/protocol/protocol.c + PROTO_SRC_C := $(filter-out $(SDIR)/protocol/protocol.c, $(wildcard $(SDIR)/protocol/*.c) $(wildcard $(SDIR)/protocol/spi/*.c)) +else + SRC_C := $(SRC_C) $(wildcard $(SDIR)/protocol/*.c) $(wildcard $(SDIR)/protocol/spi/*.c) +endif + +SRC_C := $(SRC_C) $(wildcard $(SDIR)/pages/$(SCREENSIZE)/standard/*.c) +SRC_C := $(SRC_C) $(wildcard $(SDIR)/pages/$(SCREENSIZE)/advanced/*.c) + +SRC_S := $(SRC_S) $(wildcard *.s) +SRC_CXX := $(SRC_CXX) $(wildcard *.cpp) +SRCS := $(SRC_C) $(SRC_CXX) $(SRC_S) +############################################ +#END SECTION # +############################################ + + +############################################ +#This section intermediate build files # +############################################ +ODIR = $(SDIR)/objs/$(TARGET)$(ODIREXT) +OBJS = $(addprefix $(ODIR)/, $(notdir $(SRC_C:.c=.o) $(SRC_S:.s=.o) $(SRC_CXX:.cpp=.o))) + +ifdef MODULAR +PROTO_OBJS := $(addprefix $(ODIR)/, $(notdir $(PROTO_SRC_C:.c=.o))) +PROTO_LIBS := $(addprefix $(ODIR)/, $(notdir $(PROTO_SRC_C:.c=.bin))) +PROTO_EXTRA_OBJS := $(addprefix $(ODIR)/, $(notdir $(PROTO_EXTRA_C:.c=.o_))) +SYMBOL_FILE := $(ODIR)/symbolfile +endif + +HGVERSION ?= $(shell $(SDIR)/../utils/get_version.pl ${TARGET}) +HGVERSION := $(HGVERSION) + +# Rebuild on hg version change. +# Based on http://mercurial.selenic.com/wiki/VersioningWithMake +# We need to always run this code, as opposed to running it from a prerequisite +# The HGTEST variable is not used +HGTEST := $(shell mkdir -p $(ODIR); \ + [ -f $(ODIR)/hgstamp ] || touch $(ODIR)/hgstamp; \ + echo $(HGVERSION) | cmp -s $(ODIR)/hgstamp - \ + || echo $(HGVERSION) > $(ODIR)/hgstamp) +############################################ +#END SECTION # +############################################ + +################################################## +#This section contains switches used for building# +################################################## +ifeq "$(TYPE)" "dev" + CFLAGS := $(CFLAGS) -DBUILDTYPE_DEV +endif +ifdef MODULAR +MODULE_CFLAGS := -DMODULAR=$(MODULAR) +CFLAGS += -DENABLE_MODULAR=$(MODULAR) +endif + +CFLAGS := $(CFLAGS) -g -Wall -Wextra -Werror=undef -I$(SDIR) -D$(PROGMODE) -std=gnu99 \ + -I$(SDIR)/target/tx/$(FAMILY)/$(TARGET) -I$(SDIR)/gui/$(SCREENSIZE) \ + -I$(SDIR)/pages/$(SCREENSIZE) \ + -DHGVERSION="\"${HGVERSION}\"" +CXXFLAGS := $(CXXFLAGS) $(patsubst -std=gnu99,,$(CFLAGS)) +EXEEXT ?= elf +################################################## +#END SECTION # +################################################## + +############################################ +#this section defines final build files # +############################################ +FILESYSTEM = $(subst emu_,,$(TARGET)) +MODELDIR = filesystem/$(FILESYSTEM)/models + +LAST_MODEL := $(MODELDIR)/model$(NUM_MODELS).ini + +ALL += $(TARGET).fs_wrapper + +############################################ +#END SECTION # +############################################ + +############################################ +#this section includes build targets # +############################################ +all : $(ALL) + +#################################### +# recompile if the Makefile changes# +#################################### +#$(OBJS) $(PROTO_OBJS) ($PROTO_EXTRA_OBJS): Makefile target/tx/$(FAMILY)/$(TARGET)/Makefile.inc $(EXTRA_MAKEFILES) + +################################################################################## +# The following enables quiet output unless you use VERBOSE=1 # +# Note that this must be after the 1st rule so that it doesn't execute by default# +################################################################################## +$(VERBOSE).SILENT: + +.PHONY: clean language lint + +clean: + rm -f $(TARGET).$(EXEEXT) $(TARGET).exe $(TARGET).bin $(TARGET).dfu $(TARGET).list \ + $(TARGET).map $(ODIR)/*.o $(ODIR)/*.o_ $(ODIR)/*.P $(ODIR)/*.bin \ + filesystem/$(FILESYSYTEM) 2> /dev/null || true + +language: + ../utils/extract_strings.pl -po > $(SDIR)/fs/language/deviation.po + + +zip: $(TARGET).zip + +%.zip: $(ALL) $(TARGET).dfu $(PROTO_MODULES) + #This is not an emulator build (emulator is hanled in target/common/emu/Makefile.inc) + cp -f $(TARGET).dfu deviation-$(HGVERSION).dfu + rm -f deviation-$(HGVERSION).zip + rm -f debug-$(HGVERSION).zip + zip debug-$(HGVERSION).zip $(TARGET).elf + # $(MAKE) zipping more compatible with other distributions + export p=`pwd`; cd $(ODIR) && test -e devo.fs && zip -u $$p/deviation-$(HGVERSION).zip devo.fs && rm devo.fs || true + zip deviation-$(HGVERSION).zip deviation-$(HGVERSION).dfu UPDATING.md +ifdef MODULAR + export p=`pwd`; cd $(ODIR) && zip -ur $$p/deviation-$(HGVERSION).zip protocol/*.mod + export p=`pwd`; cd $(ODIR) && zip -u $$p/debug-$(HGVERSION).zip *.elf + rm -rf $(ODIR)/protocol +endif +ifeq "$(INCLUDE_FS)" "1" + export p=`pwd`; cd filesystem/$(FILESYSTEM) && zip -ur $$p/deviation-$(HGVERSION).zip * +endif + zip -u deviation-$(HGVERSION).zip debug-$(HGVERSION).zip + rm -f debug-$(HGVERSION).zip + rm -f deviation-$(HGVERSION).dfu + +fs: $(TARGET).fs + +%.fs: + rm -f deviation-fs-$(HGVERSION).zip; zip -r deviation-fs-$(HGVERSION).zip filesystem/$(FILESYSTEM) + +release: $(TXS:%=zip_%) $(EMUS:%=zip_win_%) $(TXS:%=fs_%) + +coverity: + rm -rf cov-int 2>/dev/null; $(MAKE) distclean + cov-build --dir cov-int make TARGET=devo8 + cov-build --dir cov-int make TARGET=devo10 + tar -cvzf coverity-$(HGVERSION).tgz cov-int + +lint: + $(SDIR)/../utils/run_linter.py --diff --debug + +########################################## +#Ensure necessary directories are created# +########################################## +$(OBJS): | $(ODIR) + +$(ODIR): + @mkdir -p $@ + +$(MODELDIR): + @mkdir -p $@ + +###################### +#The main executable # +###################### +$(TARGET).$(EXEEXT): $(LINKFILE) $(OBJS) $(LIBOPENCM3) + @echo " + Building '$@'" +ifdef LINKFILE #Create an empty 'obj/$(TARGET)/optimize.ld' just in case the linker script needs it + echo "" > objs/$(TARGET)/optimize.ld +endif +ifeq ("$(SRC_CXX)", " ") + $(CC) -o $@ $(OBJS) $(LIBOPENCM3) $(LFLAGS) $(LFLAGS2) $(CFLAGS) $(EXTRA_CFLAGS) +else + $(CXX) -o $@ $(OBJS) $(LIBOPENCM3) $(LFLAGS) $(LFLAGS2) $(CFLAGS) $(EXTRA_CFLAGS) +endif + +################# +#The filesystem # +################# +%.fs_wrapper: $(LAST_MODEL) + true + +.PHONY: $(PRE_FS) $(LAST_MODEL) +$(LAST_MODEL): $(SDIR)/model_template.ini $(SDIR)/tx_template.ini $(FONTS) $(PRE_FS) + @echo " + Copying template files for $(FILESYSTEM)" + mkdir -p filesystem/$(FILESYSTEM) || true + for i in $(FILESYSTEMS); do cp -prf $(SDIR)/fs/$$i/* filesystem/$(FILESYSTEM)/; done + rm filesystem/$(FILESYSTEM)/*/.ignore 2>/dev/null || true + cp $(SDIR)/tx_template.ini filesystem/$(FILESYSTEM)/tx.ini + echo 'empty' > filesystem/$(FILESYSTEM)/errors.txt + mkdir filesystem/$(FILESYSTEM)/models 2> /dev/null || true + echo 'name=Model1' > filesystem/$(FILESYSTEM)/models/model1.ini \ + && cat $(SDIR)/model_template.ini >> filesystem/$(FILESYSTEM)/models/model1.ini + cp $(SDIR)/model_template.ini filesystem/$(FILESYSTEM)/models/default.ini +ifdef LANGUAGE + mkdir filesystem/$(FILESYSTEM)/language 2> /dev/null; \ + $(SDIR)/../utils/extract_strings.pl -po -fs filesystem/$(FILESYSTEM)/language -targets $(LANGUAGE) -update -objdir $(ODIR) +endif + export tx=$(FILESYSTEM); \ + number=2 ; while [ $$number -le $(NUM_MODELS) ] ; do \ + cp $(SDIR)/model_template.ini filesystem/$$tx/models/model$$number.ini; \ + number=`expr $$number + 1`; \ + done + @echo " + Checking string list length for $(FILESYSTEM)" +ifeq "$(TYPE)" "dev" + $(SDIR)/../utils/check_string_size.pl -target $(FILESYSTEM) -objdir $(ODIR) +else + $(SDIR)/../utils/check_string_size.pl -target $(FILESYSTEM) -objdir $(ODIR) -quiet +endif + $(SDIR)/../utils/run_linter.py --diff --skip-github --no-fail + +###################### +#Necessary Font files# +###################### +filesystem/$(FILESYSTEM)/media/12normal.fon: $(SDIR)/fonts/12normal.bdf + mkdir -p filesystem/$(FILESYSTEM)/media/ + $(SDIR)/../utils/font/bdf_to_font.pl -maxsize 12 -mode bin $< -out $@ -minspace 10 + +filesystem/$(FILESYSTEM)/media/15normal.fon: $(SDIR)/fonts/15normal.bdf + mkdir -p filesystem/$(FILESYSTEM)/media/ + $(SDIR)/../utils/font/bdf_to_font.pl -maxsize 15 -mode bin $< -out $@ -minspace 8 + +# special font for f12e with 18x12 char size +filesystem/$(FILESYSTEM)/media/f12e.fon: $(SDIR)/fonts/f12e.bdf + mkdir -p filesystem/$(FILESYSTEM)/media/ + $(SDIR)/../utils/font/bdf_to_font.pl -maxsize 18 -mode bin $< -out $@ -minspace 8 + +filesystem/$(FILESYSTEM)/media/12ascii.fon: $(SDIR)/fonts/12normal.bdf + mkdir -p filesystem/$(FILESYSTEM)/media/ + $(SDIR)/../utils/font/bdf_to_font.pl -maxsize 12 -mode bin $< -out $@ -minspace 10 -ascii + +filesystem/$(FILESYSTEM)/media/15ascii.fon: $(SDIR)/fonts/15normal.bdf + mkdir -p filesystem/$(FILESYSTEM)/media/ + $(SDIR)/../utils/font/bdf_to_font.pl -maxsize 15 -mode bin $< -out $@ -minspace 8 -ascii + +filesystem/$(FILESYSTEM)/media/23bold.fon: $(SDIR)/fonts/23bold.bdf + mkdir -p filesystem/$(FILESYSTEM)/media/ + $(SDIR)/../utils/font/bdf_to_font.pl -maxsize 23 -mode bin $< -out $@ -minspace 8 + +filesystem/$(FILESYSTEM)/media/04b03.fon: $(SDIR)/fonts/04b03.bdf + mkdir -p filesystem/$(FILESYSTEM)/media/ + $(SDIR)/../utils/font/bdf_to_font.pl -maxsize 5 -mode bin $< -out $@ -minspace 5 + +############################## +#Build rules for all .o files# +############################## +## The autodependency magic below was adapeted from: +## http://mad-scientist.net/make/autodep.html +-include $(OBJS:.o=.P) +-include $(PROTO_OBJS:.o=.P) +-include $(PROTO_EXTRA_OBJS:.o_=.P) + +dollar = $$ +define define_compile_rules +$(ODIR)/%.o: $(1)%.c $(LIBOPENCM3) + @echo " + Compiling '$$<'" + $(CC) $$(CFLAGS) $$(EXTRA_CFLAGS) $$(CFLAGS_$$(basename $$(notdir $$<))) -MD -c -o $$@ $$< + @cp $(ODIR)/$$*.d $(ODIR)/$$*.P; \ + sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$(dollar)//' \ + -e '/^$$(dollar)/ d' -e 's/$$(dollar)/ :/' < $(ODIR)/$$*.d >> $(ODIR)/$$*.P; \ + rm -f $(ODIR)/$$*.d + +$(ODIR)/%.o: $(1)%.cpp $(LIBOPENCM3) + @echo " + Compiling '$$<'" + $(CXX) $$(CXXFLAGS) $(EXTRA_CFLAGS) $$(CXXFLAGS_$$(basename $$(notdir $$<))) -MD -c -o $$@ $$< + @cp $(ODIR)/$$*.d $(ODIR)/$$*.P; \ + sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$(dollar)//' \ + -e '/^$$(dollar)/ d' -e 's/$$(dollar)/ :/' < $(ODIR)/$$*.d >> $(ODIR)/$$*.P; \ + rm -f $(ODIR)/$$*.d + +#For module building +$(ODIR)/%.o_: $(1)%.c $(LIBOPENCM3) + @echo " + Compiling '$$<' as module" + $(CC) $$(CFLAGS) $$(MODULE_CFLAGS) $$(CFLAGS_$$(basename $$(notdir $$<))) -MD -c -o $$@ $$< + @cp $(ODIR)/$$*.d $(ODIR)/$$*.P; \ + sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$(dollar)//' \ + -e '/^$$(dollar)/ d' -e 's/$$(dollar)/ :/' < $(ODIR)/$$*.d >> $(ODIR)/$$*.P; \ + rm -f $(ODIR)/$$*.d + +endef +$(foreach directory,$(sort $(dir $(SRCS) $(PROTO_EXTRA_C))),$(eval $(call define_compile_rules,$(directory)))) + +############################## +#Ensure version is up to date# +############################## +# Rebuild on hg version change. +$(ODIR)/version.o: $(ODIR)/hgstamp + +$(ODIR)/hgstamp: + echo $(HGVERSION) > $(ODIR)/hgstamp + +BUILD_TARGET := 1 +ifdef MODULAR +include protocol/Makefile.inc +endif diff --git a/src/config/voice.c b/src/config/voice.c index 4371bc45bf..8f80dfd52b 100644 --- a/src/config/voice.c +++ b/src/config/voice.c @@ -17,7 +17,7 @@ #include #include "common.h" #include "model.h" -#include "../music.h" +#include "music.h" #include "extended_audio.h" #include "tx.h" #include "voice.h" diff --git a/src/target/drivers/mcu/emu/Makefile.inc b/src/target/drivers/mcu/emu/Makefile.inc index 5973470cd9..c4444bcb10 100644 --- a/src/target/drivers/mcu/emu/Makefile.inc +++ b/src/target/drivers/mcu/emu/Makefile.inc @@ -1,9 +1,7 @@ -ifndef BUILD_TARGET - -SRC_CXX = $(wildcard target/tx/$(FAMILY)/$(TARGET)/*.cpp) \ - $(wildcard target/drivers/mcu/emu/*.cpp) -SRC_C = $(wildcard target/tx/$(FAMILY)/$(TARGET)/*.c) \ - $(wildcard target/drivers/mcu/emu/*.c) \ +SRC_CXX = $(wildcard $(SDIR)/target/tx/$(FAMILY)/$(TARGET)/*.cpp) \ + $(wildcard $(SDIR)/target/drivers/mcu/emu/*.cpp) +SRC_C = $(wildcard $(SDIR)/target/tx/$(FAMILY)/$(TARGET)/*.c) \ + $(wildcard $(SDIR)/target/drivers/mcu/emu/*.c) \ $(wildcard $(SDIR)/target/drivers/filesystems/*.c) ifeq ("$(SCREENSIZE)", "128x64x1") @@ -20,9 +18,9 @@ else CFLAGS = -DEMULATOR=USE_NATIVE_FS endif -CFLAGS += -Itarget/drivers/mcu/emu -I$(SDIR)/target/drivers/filesystems +CFLAGS += -I$(SDIR)/target/drivers/mcu/emu -I$(SDIR)/target/drivers/filesystems -ALL = $(TARGET).$(EXEEXT) +ALL += $(TARGET).$(EXEEXT) TYPE ?= dev @@ -44,6 +42,7 @@ ifdef WINDOWS EXEEXT = exe ODIREXT = -w32 else + EXEEXT = CFLAGS := $(CFLAGS) $(shell fltk-config --cflags) LFLAGS := $(LFLAGS) $(shell fltk-config --ldflags) ifndef SOUND @@ -52,7 +51,7 @@ else LFLAGS := $(LFLAGS) -lportaudio endif endif -else #BUILD_TARGET + CFLAGS += -DFILESYSTEM_DIR="\"filesystem/$(FILESYSTEM)\"" $(TARGET).zip: $(TARGET).$(EXEEXT) $(TARGET).fs_wrapper @@ -66,5 +65,3 @@ ifeq "$(INCLUDE_FS)" "1" zip -ur deviation-$(HGVERSION).zip filesystem/$(FILESYSTEM) endif rm -f deviation-$(HGVERSION).$(EXEEXT) - -endif #BUILD_TARGET diff --git a/src/target/tx/devo/common/Makefile.inc b/src/target/tx/devo/common/Makefile.inc index 105059c60b..274d091766 100644 --- a/src/target/tx/devo/common/Makefile.inc +++ b/src/target/tx/devo/common/Makefile.inc @@ -2,8 +2,7 @@ HAS_4IN1_FLASH ?= 0 HAS_FLASH_DETECT ?= 0 USE_JTAG ?= 0 -ifndef BUILD_TARGET - +FAMILY=devo CROSS = arm-none-eabi- EXTRA_MAKEFILES := $(EXTRA_MAKEFILES) $(SDIR)/target/tx/devo/common/Makefile.inc @@ -85,8 +84,6 @@ endif ALL = $(LIBOPENCM3) $(TARGET).dfu -else #BUILD_TARGET - ifdef ENABLE_LTO $(foreach src,$(filter %_isr.c,$(SRCS)),\ $(eval CFLAGS_$(basename $(notdir $(src))) = -fno-lto)) @@ -128,5 +125,3 @@ $(ODIR)/%.bin: $(ODIR)/%.o_ $(SDIR)/protocol/exports.ld $(PROTO_LINKFILE) $(PROT --cref -T$(PROTO_LINKFILE) --just-symbols=$(SYMBOL_FILE) $(DUMP) -t $(@:.bin=.elf) | grep -q _from_thumb; if [ $$? -eq 0 ]; then echo "ERROR: Bad address found"; false; else true; fi $(CP) -O binary $(@:.bin=.elf) $@ - -endif #BUILD_TARGET diff --git a/src/target/tx/devo/devo8/Makefile.inc b/src/target/tx/devo/devo8/Makefile similarity index 89% rename from src/target/tx/devo/devo8/Makefile.inc rename to src/target/tx/devo/devo8/Makefile index 3d178eb212..35abf3a914 100644 --- a/src/target/tx/devo/devo8/Makefile.inc +++ b/src/target/tx/devo/devo8/Makefile @@ -1,3 +1,4 @@ +TARGET=devo8 FILESYSTEMS := common base_fonts 320x240x16 SCREENSIZE := 320x240x16 DISPLAY_DRIVER := 8080/320x240x16.c @@ -9,3 +10,4 @@ LANGUAGE := devo8 OPTIMIZE_DFU := 1 include $(SDIR)/target/tx/devo/common/Makefile.inc +include $(SDIR)/Makefile.inc \ No newline at end of file diff --git a/src/target/tx/devo/emu_devo8/Makefile.inc b/src/target/tx/devo/emu_devo8/Makefile similarity index 65% rename from src/target/tx/devo/emu_devo8/Makefile.inc rename to src/target/tx/devo/emu_devo8/Makefile index d671a923c3..00d6146421 100644 --- a/src/target/tx/devo/emu_devo8/Makefile.inc +++ b/src/target/tx/devo/emu_devo8/Makefile @@ -3,5 +3,8 @@ FILESYSTEMS := common base_fonts 320x240x16 FONTS = filesystem/$(FILESYSTEM)/media/15normal.fon \ filesystem/$(FILESYSTEM)/media/23bold.fon LANGUAGE := devo8 +TARGET = emu_devo8 +FAMILY = devo -include target/drivers/mcu/emu/Makefile.inc +include $(SDIR)/target/drivers/mcu/emu/Makefile.inc +include $(SDIR)/Makefile.inc \ No newline at end of file diff --git a/src/target/tx/radiolink/common/Makefile.inc b/src/target/tx/radiolink/common/Makefile.inc index b131fce2c8..976b69f9ce 100644 --- a/src/target/tx/radiolink/common/Makefile.inc +++ b/src/target/tx/radiolink/common/Makefile.inc @@ -1,4 +1,3 @@ -ifndef BUILD_TARGET CROSS = arm-none-eabi- LINKFILE = $(SDIR)/target/tx/$(FAMILY)/$(TARGET)/$(TARGET).ld @@ -42,8 +41,6 @@ ifdef ENABLE_LTO CFLAGS += -flto -ffat-lto-objects -fwhole-program -DENABLE_LTO endif -else #BUILD_TARGET - ifdef ENABLE_LTO $(foreach src,$(filter %_isr.c,$(SRCS)),\ $(eval CFLAGS_$(basename $(notdir $(src))) = -fno-lto)) @@ -55,5 +52,3 @@ $(LIBOPENCM3): $(ODIR)/devo.fs: $(LAST_MODEL) $(PRE_FS) $(TARGET).fs_wrapper target/drivers/filesystems/devofs/buildfs.py -c -i -f $@ -d filesystem/$(FILESYSTEM) - -endif #BUILD_TARGET From 8d49805f8f0dd114e7f5e4f740dbd3bba65ffd4b Mon Sep 17 00:00:00 2001 From: Howard Su Date: Sun, 3 Mar 2019 22:18:47 +0800 Subject: [PATCH 02/15] fix target lookup --- src/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Makefile b/src/Makefile index 078a87c3c4..5214ce2417 100644 --- a/src/Makefile +++ b/src/Makefile @@ -66,7 +66,7 @@ all_$1: endef # Now generate all the convenience targets -$(foreach t,$(ALLTARGETS),$(eval $(call make-target,$t,$(notdir $(patsubst %/,%,$(dir $(wildcard target/tx/*/$(TARGET)))))))) +$(foreach t,$(ALLTARGETS),$(eval $(call make-target,$t,$(notdir $(patsubst %/,%,$(dir $(wildcard target/tx/*/$(t)))))))) .PHONY: distclean distclean: From 29427d7dea67226ba43815782b6e21dc83e45f82 Mon Sep 17 00:00:00 2001 From: Howard Su Date: Sun, 3 Mar 2019 23:53:02 +0800 Subject: [PATCH 03/15] Add VPATH --- src/Makefile.inc | 63 ++++++++++++-------------- src/target/tx/devo/common/Makefile.inc | 1 + 2 files changed, 30 insertions(+), 34 deletions(-) diff --git a/src/Makefile.inc b/src/Makefile.inc index 58b31e8b12..158604deae 100644 --- a/src/Makefile.inc +++ b/src/Makefile.inc @@ -1,3 +1,13 @@ +# +# This inc file have to be included as last include in the makefile include chain. +# Some import variables: +# DRIVERS - list out the drivres which need be added. +# SCREENSIZE - define the screen size (type) +# CROSS - define if need a different compiler than default +# CFLAGS - define the compiler options for firmware +# LDFLAGS - define the linker options +# SRCS_C - C source files in the full path +# SRCS_CPP - cpp source files in the full path # We want to turn on INCLUDE_FS by default INCLUDE_FS ?= 1 @@ -69,7 +79,7 @@ SRCS := $(SRC_C) $(SRC_CXX) $(SRC_S) #This section intermediate build files # ############################################ ODIR = $(SDIR)/objs/$(TARGET)$(ODIREXT) -OBJS = $(addprefix $(ODIR)/, $(notdir $(SRC_C:.c=.o) $(SRC_S:.s=.o) $(SRC_CXX:.cpp=.o))) +OBJS := $(patsubst %.c,$(ODIR)/%.o,$(notdir $(SRCS))) ifdef MODULAR PROTO_OBJS := $(addprefix $(ODIR)/, $(notdir $(PROTO_SRC_C:.c=.o))) @@ -78,6 +88,14 @@ PROTO_EXTRA_OBJS := $(addprefix $(ODIR)/, $(notdir $(PROTO_EXTRA_C:.c=.o_))) SYMBOL_FILE := $(ODIR)/symbolfile endif +define uniq = + $(eval seen :=) + $(foreach _,$1,$(if $(filter $_,${seen}),,$(eval seen += $_))) + ${seen} +endef + +VPATH = $(call uniq, $(dir $(SRCS))) + HGVERSION ?= $(shell $(SDIR)/../utils/get_version.pl ${TARGET}) HGVERSION := $(HGVERSION) @@ -289,41 +307,18 @@ filesystem/$(FILESYSTEM)/media/04b03.fon: $(SDIR)/fonts/04b03.bdf ############################## #Build rules for all .o files# ############################## -## The autodependency magic below was adapeted from: -## http://mad-scientist.net/make/autodep.html --include $(OBJS:.o=.P) --include $(PROTO_OBJS:.o=.P) --include $(PROTO_EXTRA_OBJS:.o_=.P) - -dollar = $$ -define define_compile_rules -$(ODIR)/%.o: $(1)%.c $(LIBOPENCM3) - @echo " + Compiling '$$<'" - $(CC) $$(CFLAGS) $$(EXTRA_CFLAGS) $$(CFLAGS_$$(basename $$(notdir $$<))) -MD -c -o $$@ $$< - @cp $(ODIR)/$$*.d $(ODIR)/$$*.P; \ - sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$(dollar)//' \ - -e '/^$$(dollar)/ d' -e 's/$$(dollar)/ :/' < $(ODIR)/$$*.d >> $(ODIR)/$$*.P; \ - rm -f $(ODIR)/$$*.d - -$(ODIR)/%.o: $(1)%.cpp $(LIBOPENCM3) - @echo " + Compiling '$$<'" - $(CXX) $$(CXXFLAGS) $(EXTRA_CFLAGS) $$(CXXFLAGS_$$(basename $$(notdir $$<))) -MD -c -o $$@ $$< - @cp $(ODIR)/$$*.d $(ODIR)/$$*.P; \ - sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$(dollar)//' \ - -e '/^$$(dollar)/ d' -e 's/$$(dollar)/ :/' < $(ODIR)/$$*.d >> $(ODIR)/$$*.P; \ - rm -f $(ODIR)/$$*.d +$(ODIR)/%.o: %.c + @echo " + Compiling '$<'" + $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(CFLAGS_$(basename $(notdir $<))) -c -o $@ $< -#For module building -$(ODIR)/%.o_: $(1)%.c $(LIBOPENCM3) - @echo " + Compiling '$$<' as module" - $(CC) $$(CFLAGS) $$(MODULE_CFLAGS) $$(CFLAGS_$$(basename $$(notdir $$<))) -MD -c -o $$@ $$< - @cp $(ODIR)/$$*.d $(ODIR)/$$*.P; \ - sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$(dollar)//' \ - -e '/^$$(dollar)/ d' -e 's/$$(dollar)/ :/' < $(ODIR)/$$*.d >> $(ODIR)/$$*.P; \ - rm -f $(ODIR)/$$*.d +$(ODIR)/%.o: %.cpp + @echo " + Compiling '$<'" + $(CXX) $(CXXFLAGS) $(EXTRA_CFLAGS) $(CXXFLAGS_$(basename $(notdir $<))) -c -o $@ $< -endef -$(foreach directory,$(sort $(dir $(SRCS) $(PROTO_EXTRA_C))),$(eval $(call define_compile_rules,$(directory)))) +#For module building +$(ODIR)/%.o_: %.c + @echo " + Compiling '$<' as module" + $(CC) $(CFLAGS) $(MODULE_CFLAGS) $(CFLAGS_$(basename $(notdir $<))) -c -o $@ $< ############################## #Ensure version is up to date# diff --git a/src/target/tx/devo/common/Makefile.inc b/src/target/tx/devo/common/Makefile.inc index 274d091766..0cba6a8c12 100644 --- a/src/target/tx/devo/common/Makefile.inc +++ b/src/target/tx/devo/common/Makefile.inc @@ -125,3 +125,4 @@ $(ODIR)/%.bin: $(ODIR)/%.o_ $(SDIR)/protocol/exports.ld $(PROTO_LINKFILE) $(PROT --cref -T$(PROTO_LINKFILE) --just-symbols=$(SYMBOL_FILE) $(DUMP) -t $(@:.bin=.elf) | grep -q _from_thumb; if [ $$? -eq 0 ]; then echo "ERROR: Bad address found"; false; else true; fi $(CP) -O binary $(@:.bin=.elf) $@ + From 6443e5f05935b2fb9c3a64717208a53ff8749dd0 Mon Sep 17 00:00:00 2001 From: Howard Su Date: Sun, 3 Mar 2019 23:54:16 +0800 Subject: [PATCH 04/15] use ODIR for optmize.ld --- src/Makefile.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Makefile.inc b/src/Makefile.inc index 158604deae..3115614fff 100644 --- a/src/Makefile.inc +++ b/src/Makefile.inc @@ -229,7 +229,7 @@ $(MODELDIR): $(TARGET).$(EXEEXT): $(LINKFILE) $(OBJS) $(LIBOPENCM3) @echo " + Building '$@'" ifdef LINKFILE #Create an empty 'obj/$(TARGET)/optimize.ld' just in case the linker script needs it - echo "" > objs/$(TARGET)/optimize.ld + echo "" > $(ODIR)/optimize.ld endif ifeq ("$(SRC_CXX)", " ") $(CC) -o $@ $(OBJS) $(LIBOPENCM3) $(LFLAGS) $(LFLAGS2) $(CFLAGS) $(EXTRA_CFLAGS) From d572f639a3e99f5d5636c2d48abebdfdb22fa662 Mon Sep 17 00:00:00 2001 From: Howard Su Date: Mon, 4 Mar 2019 09:06:54 +0800 Subject: [PATCH 05/15] TEMP --- src/Makefile.inc | 80 +++----------------------- src/protocol/Makefile.inc | 4 -- src/target/tx/devo/common/Makefile.inc | 12 ++-- 3 files changed, 15 insertions(+), 81 deletions(-) diff --git a/src/Makefile.inc b/src/Makefile.inc index 3115614fff..9ca3b9bc83 100644 --- a/src/Makefile.inc +++ b/src/Makefile.inc @@ -94,7 +94,7 @@ define uniq = ${seen} endef -VPATH = $(call uniq, $(dir $(SRCS))) +VPATH = $(call uniq, $(dir $(SRCS))) $(SDIR) HGVERSION ?= $(shell $(SDIR)/../utils/get_version.pl ${TARGET}) HGVERSION := $(HGVERSION) @@ -149,7 +149,10 @@ ALL += $(TARGET).fs_wrapper ############################################ #this section includes build targets # ############################################ -all : $(ALL) +default: $(TARGET) + echo "Done" + +all : $(OBJS) $(ALL) #################################### # recompile if the Makefile changes# @@ -170,7 +173,7 @@ clean: filesystem/$(FILESYSYTEM) 2> /dev/null || true language: - ../utils/extract_strings.pl -po > $(SDIR)/fs/language/deviation.po + $(SDIR)/../utils/extract_strings.pl -po > $(SDIR)/fs/language/deviation.po zip: $(TARGET).zip @@ -226,7 +229,7 @@ $(MODELDIR): ###################### #The main executable # ###################### -$(TARGET).$(EXEEXT): $(LINKFILE) $(OBJS) $(LIBOPENCM3) +$(SDIR)/$(TARGET).$(EXEEXT): $(LINKFILE) $(OBJS) $(LIBOPENCM3) @echo " + Building '$@'" ifdef LINKFILE #Create an empty 'obj/$(TARGET)/optimize.ld' just in case the linker script needs it echo "" > $(ODIR)/optimize.ld @@ -237,72 +240,6 @@ else $(CXX) -o $@ $(OBJS) $(LIBOPENCM3) $(LFLAGS) $(LFLAGS2) $(CFLAGS) $(EXTRA_CFLAGS) endif -################# -#The filesystem # -################# -%.fs_wrapper: $(LAST_MODEL) - true - -.PHONY: $(PRE_FS) $(LAST_MODEL) -$(LAST_MODEL): $(SDIR)/model_template.ini $(SDIR)/tx_template.ini $(FONTS) $(PRE_FS) - @echo " + Copying template files for $(FILESYSTEM)" - mkdir -p filesystem/$(FILESYSTEM) || true - for i in $(FILESYSTEMS); do cp -prf $(SDIR)/fs/$$i/* filesystem/$(FILESYSTEM)/; done - rm filesystem/$(FILESYSTEM)/*/.ignore 2>/dev/null || true - cp $(SDIR)/tx_template.ini filesystem/$(FILESYSTEM)/tx.ini - echo 'empty' > filesystem/$(FILESYSTEM)/errors.txt - mkdir filesystem/$(FILESYSTEM)/models 2> /dev/null || true - echo 'name=Model1' > filesystem/$(FILESYSTEM)/models/model1.ini \ - && cat $(SDIR)/model_template.ini >> filesystem/$(FILESYSTEM)/models/model1.ini - cp $(SDIR)/model_template.ini filesystem/$(FILESYSTEM)/models/default.ini -ifdef LANGUAGE - mkdir filesystem/$(FILESYSTEM)/language 2> /dev/null; \ - $(SDIR)/../utils/extract_strings.pl -po -fs filesystem/$(FILESYSTEM)/language -targets $(LANGUAGE) -update -objdir $(ODIR) -endif - export tx=$(FILESYSTEM); \ - number=2 ; while [ $$number -le $(NUM_MODELS) ] ; do \ - cp $(SDIR)/model_template.ini filesystem/$$tx/models/model$$number.ini; \ - number=`expr $$number + 1`; \ - done - @echo " + Checking string list length for $(FILESYSTEM)" -ifeq "$(TYPE)" "dev" - $(SDIR)/../utils/check_string_size.pl -target $(FILESYSTEM) -objdir $(ODIR) -else - $(SDIR)/../utils/check_string_size.pl -target $(FILESYSTEM) -objdir $(ODIR) -quiet -endif - $(SDIR)/../utils/run_linter.py --diff --skip-github --no-fail - -###################### -#Necessary Font files# -###################### -filesystem/$(FILESYSTEM)/media/12normal.fon: $(SDIR)/fonts/12normal.bdf - mkdir -p filesystem/$(FILESYSTEM)/media/ - $(SDIR)/../utils/font/bdf_to_font.pl -maxsize 12 -mode bin $< -out $@ -minspace 10 - -filesystem/$(FILESYSTEM)/media/15normal.fon: $(SDIR)/fonts/15normal.bdf - mkdir -p filesystem/$(FILESYSTEM)/media/ - $(SDIR)/../utils/font/bdf_to_font.pl -maxsize 15 -mode bin $< -out $@ -minspace 8 - -# special font for f12e with 18x12 char size -filesystem/$(FILESYSTEM)/media/f12e.fon: $(SDIR)/fonts/f12e.bdf - mkdir -p filesystem/$(FILESYSTEM)/media/ - $(SDIR)/../utils/font/bdf_to_font.pl -maxsize 18 -mode bin $< -out $@ -minspace 8 - -filesystem/$(FILESYSTEM)/media/12ascii.fon: $(SDIR)/fonts/12normal.bdf - mkdir -p filesystem/$(FILESYSTEM)/media/ - $(SDIR)/../utils/font/bdf_to_font.pl -maxsize 12 -mode bin $< -out $@ -minspace 10 -ascii - -filesystem/$(FILESYSTEM)/media/15ascii.fon: $(SDIR)/fonts/15normal.bdf - mkdir -p filesystem/$(FILESYSTEM)/media/ - $(SDIR)/../utils/font/bdf_to_font.pl -maxsize 15 -mode bin $< -out $@ -minspace 8 -ascii - -filesystem/$(FILESYSTEM)/media/23bold.fon: $(SDIR)/fonts/23bold.bdf - mkdir -p filesystem/$(FILESYSTEM)/media/ - $(SDIR)/../utils/font/bdf_to_font.pl -maxsize 23 -mode bin $< -out $@ -minspace 8 - -filesystem/$(FILESYSTEM)/media/04b03.fon: $(SDIR)/fonts/04b03.bdf - mkdir -p filesystem/$(FILESYSTEM)/media/ - $(SDIR)/../utils/font/bdf_to_font.pl -maxsize 5 -mode bin $< -out $@ -minspace 5 ############################## #Build rules for all .o files# @@ -329,7 +266,8 @@ $(ODIR)/version.o: $(ODIR)/hgstamp $(ODIR)/hgstamp: echo $(HGVERSION) > $(ODIR)/hgstamp -BUILD_TARGET := 1 ifdef MODULAR include protocol/Makefile.inc endif + +include fs/Makefile.inc \ No newline at end of file diff --git a/src/protocol/Makefile.inc b/src/protocol/Makefile.inc index cde6126294..194565f944 100644 --- a/src/protocol/Makefile.inc +++ b/src/protocol/Makefile.inc @@ -1,5 +1,3 @@ -ifndef BUILD_TARGET - PROTO_MODULES += $(ODIR)/protocol/devo.mod PROTO_MODULES += $(ODIR)/protocol/dsm2.mod PROTO_MODULES += $(ODIR)/protocol/dsmx.mod @@ -292,5 +290,3 @@ $(ODIR)/protocol/pxx.mod : $(ODIR)/pxxout.bin $(ODIR)/protocol/loli.mod : $(ODIR)/loli_nrf24l01.bin @echo Building 'loli' module /bin/mkdir -p $(ODIR)/protocol/ 2>/dev/null; /bin/cp $< $@ - -endif #BUILD_TARGET diff --git a/src/target/tx/devo/common/Makefile.inc b/src/target/tx/devo/common/Makefile.inc index 0cba6a8c12..c06a0ce922 100644 --- a/src/target/tx/devo/common/Makefile.inc +++ b/src/target/tx/devo/common/Makefile.inc @@ -53,7 +53,7 @@ endif MODULE_CFLAGS = -fno-builtin #LFLAGS = -nostartfiles -Wl,-gc-sections -Wl,-Map=$(TARGET).map,--cref -nostdlib -LFLAGS = -nostartfiles -Wl,-gc-sections -Wl,-Map=$(TARGET).map,--cref -lc -lnosys -L$(SDIR) -L$(SDIR)/protocol -Lobjs/$(TARGET) -Wl,-warn-common +LFLAGS = -nostartfiles -Wl,-gc-sections -Wl,-Map=$(TARGET).map,--cref -lc -lnosys -L$(SDIR) -L$(SDIR)/protocol -L$(SDIR)/objs/$(TARGET) -Wl,-warn-common LINKFILE = $(SDIR)/target/tx/devo/$(TARGET)/$(TARGET).ld LFLAGS2 = -Wl,-T$(LINKFILE) @@ -82,7 +82,7 @@ endif #-lnosys -ALL = $(LIBOPENCM3) $(TARGET).dfu +ALL = $(LIBOPENCM3) $(SDIR)/$(TARGET).dfu ifdef ENABLE_LTO $(foreach src,$(filter %_isr.c,$(SRCS)),\ @@ -95,11 +95,11 @@ else FLOCKS = flock objs/.lock endif -$(TARGET).bin: $(TARGET).elf +$(SDIR)/$(TARGET).bin: $(SDIR)/$(TARGET).elf ifdef OPTIMIZE_DFU - $(CP) $(TARGET).elf objs/$(TARGET)/$(TARGET).elf + $(CP) $(SDIR)/$(TARGET).elf $(SDIR)/objs/$(TARGET)/$(TARGET).elf @echo " + Optimizing placement and re-linking" - $(SDIR)/../utils/repack_ld.pl -mapfile $(TARGET).map -linkfile $(LINKFILE) > objs/$(TARGET)/optimize.ld + $(SDIR)/../utils/repack_ld.pl -mapfile $(TARGET).map -linkfile $(LINKFILE) > $(SDIR)/objs/$(TARGET)/optimize.ld $(CC) -o $< $(OBJS) $(LIBOPENCM3) $(LFLAGS) $(LFLAGS2OPT) $(CFLAGS) endif ifdef MODULAR # the following builds a symbol file with thumb addresses (address+1 for functions, address+0 for variables) @@ -112,7 +112,7 @@ $(LIBOPENCM3): test -s $(SDIR)/libopencm3/Makefile || { echo "Fetch libopencm3 via 'git submodule update --init'"; exit 1; } +$(FLOCKS) $(MAKE) -C $(SDIR)/libopencm3 TARGETS=stm32/f1 lib -$(TARGET).dfu: $(TARGET).bin +$(SDIR)/$(TARGET).dfu: $(SDIR)/$(TARGET).bin $(SDIR)/../utils/dfu.py --name "$(HGVERSION) Firmware" $(DFU_ARGS):$< $@ $(SDIR)/../utils/get_mem_usage.pl $(TARGET).map From 64512a0a5c834c990df0c992b4fa1800010c97a3 Mon Sep 17 00:00:00 2001 From: Howard Su Date: Fri, 8 Mar 2019 13:50:54 +0800 Subject: [PATCH 06/15] more fixes --- doc/build.txt | 60 +++++++++++++++ src/Makefile | 5 +- src/Makefile.inc | 98 +++++++++++------------- src/fs/Makefile.inc | 66 ++++++++++++++++ src/target/tx/devo/common/Makefile.inc | 95 ++++++++++++----------- src/target/tx/devo/devof12e/Makefile | 19 +++++ src/target/tx/devo/devof12e/Makefile.inc | 29 ------- 7 files changed, 242 insertions(+), 130 deletions(-) create mode 100644 doc/build.txt create mode 100644 src/fs/Makefile.inc create mode 100644 src/target/tx/devo/devof12e/Makefile delete mode 100644 src/target/tx/devo/devof12e/Makefile.inc diff --git a/doc/build.txt b/doc/build.txt new file mode 100644 index 0000000000..757ecf56e6 --- /dev/null +++ b/doc/build.txt @@ -0,0 +1,60 @@ +Design Document for build system + +Build system is using make. + +src/Makefile - this is meta Makefile which has the logic to find the right target under target/ folder and build it by invoke another make. It defines each target as a build target, each family as a build target. In addition to zip_ etc to build zip package for certain target. + Exported Variables: + SDIR = the full path src folder + +src/Makefile.inc - this is core of the build logic. This makefile compose the final build steps and execute them. This file should included as last one in Makefile. + Import Variables: + TARGET = the target name, can be devo10 or emu_devo10 + FAMILY = the family name + EXEEXT = the default exe extention name + + CROSS = set this to prefix of cross-compiler. otherwise leave it as empty + + SRCS_C = the c files to be compiled + SRCS_CPP = the cpp files to be compiled + CFLAGS = the C compile flags + CXXFLAGS = the C++ compile flags + LDFLAGS = the link flags + INCLUDES = the folder to includes + DEFINES = the macro definitions + + MOD_SRCS_C = the c files for module + MOD_CFLAGS = the c compile flags for module + MOD_LDFLAGS = the link flags for modules + + ALL = Additional targets beside $(TARGET).$(EXEEXT) + +src/fs/Makefile.inc - this contains the logic to create filesystem folder for certain target + Import Variables: + TARGET = the target name + FILESYSTEM = the filesystem to be choosed between different predefined sets + FONTS = the fonts to be includes + +src/target///Makefile - this file is entry point for build for target. It normally includes other makefile.inc to compose the build. Normally this file will includes src/target//common/Makefile.inc. + Export Variables: + TARGET = the target name + SRCS = default the files + ODIR = ODIR is defined as $(SDIR)/objs/$(TARGET) + + Import Variables: + SDIR + +src/target//common/Makefile.inc - this contains the logic to abstract common from a Tx family + Import Variables: + TARGET + DTU_PARAM + + Export Variables: + + +src/drivres/mcu//Makefile.inc - this contains the logic for certain platform. For example, stm32 contains the logic for cross-compile and the logic to build libopencm3. x86 contains the logic to build tx on PC platform. + +a typical include chain is like the following + target///Makefile <- target//common/Makefile.inc <- target/drivres/mcu//Makefile.inc + <- target/drivres///Makefile.inc + <- fs/Makefile.inc + <- Makefile.inc diff --git a/src/Makefile b/src/Makefile index 5214ce2417..ab7a1f3781 100644 --- a/src/Makefile +++ b/src/Makefile @@ -12,8 +12,6 @@ export ########################################### ## Provide some convenient make targets ## ########################################### -TARGET ?= devo8 -default: $(TARGET) ALLTARGETS = $(filter-out common,$(notdir $(wildcard target/tx/*/*))) @@ -24,6 +22,7 @@ TXS ?= devo6 devo7e devo7e-256 devo8 devo10 devo12e devo12 devof7 devof7-XMS dev EMUS = $(foreach dir,$(TXS:%=emu_%),$(if $(wildcard target/$(dir)),$(dir),)) ALLEMUS = $(foreach dir,$(ALLTXS:%=emu_%),$(if $(wildcard target/$(dir)),$(dir),)) +.PHONY: txs emus both fss zips emuzips winzips release everything txs: $(TXS) emus: $(EMUS) both: txs emus @@ -31,10 +30,12 @@ fss: $(TXS:%=fs_%) zips: $(TXS:%=zip_%) emuzips: $(EMUS:%=zip_%) winzips: $(EMUS:%=zip_win_%) +release: $(TXS:%=zip_%) $(EMUS:%=zip_win_%) $(TXS:%=fs_%) everything: txs emus fss # Generate the targets for a transmitter. define make-target +.PHONY: $1 win_$1 fs_$1 both_$1 zip_$1 zip_win_$1 release_$1 all_$1 $1: +$(MAKE) -C target/tx/$2/$1 win_$1: diff --git a/src/Makefile.inc b/src/Makefile.inc index 9ca3b9bc83..684cb01da7 100644 --- a/src/Makefile.inc +++ b/src/Makefile.inc @@ -49,26 +49,26 @@ DUMP ?= objdump #error please define SCREENSIZE #endif -SRC_C += $(wildcard $(SDIR)/*.c) \ - $(wildcard $(SDIR)/misc/*.c) \ - $(wildcard $(SDIR)/screen/*.c) \ - $(wildcard $(SDIR)/screen/$(SCREENSIZE)/*.c) \ - $(wildcard $(SDIR)/gui/*.c) \ - $(wildcard $(SDIR)/pages/$(SCREENSIZE)/*.c) \ - $(wildcard $(SDIR)/config/*.c) +SRC_C += $(wildcard $(SDIR)*.c) \ + $(wildcard $(SDIR)misc/*.c) \ + $(wildcard $(SDIR)screen/*.c) \ + $(wildcard $(SDIR)screen/$(SCREENSIZE)/*.c) \ + $(wildcard $(SDIR)gui/*.c) \ + $(wildcard $(SDIR)pages/$(SCREENSIZE)/*.c) \ + $(wildcard $(SDIR)config/*.c) ifdef MODULAR - SRC_C += $(SDIR)/protocol/protocol.c - PROTO_SRC_C := $(filter-out $(SDIR)/protocol/protocol.c, $(wildcard $(SDIR)/protocol/*.c) $(wildcard $(SDIR)/protocol/spi/*.c)) + SRC_C += $(SDIR)protocol/protocol.c + PROTO_SRC_C := $(filter-out $(SDIR)protocol/protocol.c, $(wildcard $(SDIR)protocol/*.c) $(wildcard $(SDIR)protocol/spi/*.c)) else - SRC_C := $(SRC_C) $(wildcard $(SDIR)/protocol/*.c) $(wildcard $(SDIR)/protocol/spi/*.c) + SRC_C += $(wildcard $(SDIR)protocol/*.c) $(wildcard $(SDIR)protocol/spi/*.c) endif -SRC_C := $(SRC_C) $(wildcard $(SDIR)/pages/$(SCREENSIZE)/standard/*.c) -SRC_C := $(SRC_C) $(wildcard $(SDIR)/pages/$(SCREENSIZE)/advanced/*.c) +SRC_C += $(wildcard $(SDIR)pages/$(SCREENSIZE)/standard/*.c) +SRC_C += $(wildcard $(SDIR)pages/$(SCREENSIZE)/advanced/*.c) -SRC_S := $(SRC_S) $(wildcard *.s) -SRC_CXX := $(SRC_CXX) $(wildcard *.cpp) +SRC_S += $(wildcard *.s) +SRC_CXX += $(wildcard *.cpp) SRCS := $(SRC_C) $(SRC_CXX) $(SRC_S) ############################################ #END SECTION # @@ -78,14 +78,14 @@ SRCS := $(SRC_C) $(SRC_CXX) $(SRC_S) ############################################ #This section intermediate build files # ############################################ -ODIR = $(SDIR)/objs/$(TARGET)$(ODIREXT) -OBJS := $(patsubst %.c,$(ODIR)/%.o,$(notdir $(SRCS))) +ODIR = $(SDIR)objs/$(TARGET)$(ODIREXT)/ +OBJS := $(patsubst %.c,$(ODIR)%.o,$(notdir $(SRCS))) ifdef MODULAR -PROTO_OBJS := $(addprefix $(ODIR)/, $(notdir $(PROTO_SRC_C:.c=.o))) -PROTO_LIBS := $(addprefix $(ODIR)/, $(notdir $(PROTO_SRC_C:.c=.bin))) -PROTO_EXTRA_OBJS := $(addprefix $(ODIR)/, $(notdir $(PROTO_EXTRA_C:.c=.o_))) -SYMBOL_FILE := $(ODIR)/symbolfile +PROTO_OBJS := $(addprefix $(ODIR), $(notdir $(PROTO_SRC_C:.c=.o))) +PROTO_LIBS := $(addprefix $(ODIR), $(notdir $(PROTO_SRC_C:.c=.bin))) +PROTO_EXTRA_OBJS := $(addprefix $(ODIR), $(notdir $(PROTO_EXTRA_C:.c=.o_))) +SYMBOL_FILE := $(ODIR)symbolfile endif define uniq = @@ -94,9 +94,9 @@ define uniq = ${seen} endef -VPATH = $(call uniq, $(dir $(SRCS))) $(SDIR) - -HGVERSION ?= $(shell $(SDIR)/../utils/get_version.pl ${TARGET}) +VPATH = $(call uniq, $(dir $(SRCS))) +$(warning $(VPATH)) +HGVERSION ?= $(shell $(SDIR)../utils/get_version.pl ${TARGET}) HGVERSION := $(HGVERSION) # Rebuild on hg version change. @@ -104,9 +104,9 @@ HGVERSION := $(HGVERSION) # We need to always run this code, as opposed to running it from a prerequisite # The HGTEST variable is not used HGTEST := $(shell mkdir -p $(ODIR); \ - [ -f $(ODIR)/hgstamp ] || touch $(ODIR)/hgstamp; \ - echo $(HGVERSION) | cmp -s $(ODIR)/hgstamp - \ - || echo $(HGVERSION) > $(ODIR)/hgstamp) + [ -f $(ODIR)hgstamp ] || touch $(ODIR)hgstamp; \ + echo $(HGVERSION) | cmp -s $(ODIR)hgstamp - \ + || echo $(HGVERSION) > $(ODIR)hgstamp) ############################################ #END SECTION # ############################################ @@ -123,8 +123,8 @@ CFLAGS += -DENABLE_MODULAR=$(MODULAR) endif CFLAGS := $(CFLAGS) -g -Wall -Wextra -Werror=undef -I$(SDIR) -D$(PROGMODE) -std=gnu99 \ - -I$(SDIR)/target/tx/$(FAMILY)/$(TARGET) -I$(SDIR)/gui/$(SCREENSIZE) \ - -I$(SDIR)/pages/$(SCREENSIZE) \ + -I$(SDIR)target/tx/$(FAMILY)/$(TARGET) -I$(SDIR)gui/$(SCREENSIZE) \ + -I$(SDIR)pages/$(SCREENSIZE) \ -DHGVERSION="\"${HGVERSION}\"" CXXFLAGS := $(CXXFLAGS) $(patsubst -std=gnu99,,$(CFLAGS)) EXEEXT ?= elf @@ -149,10 +149,8 @@ ALL += $(TARGET).fs_wrapper ############################################ #this section includes build targets # ############################################ -default: $(TARGET) - echo "Done" - -all : $(OBJS) $(ALL) +.PHONY: all +all : $(warning $(ALL)) $(ALL) $(OBJS) #################################### # recompile if the Makefile changes# @@ -169,11 +167,11 @@ $(VERBOSE).SILENT: clean: rm -f $(TARGET).$(EXEEXT) $(TARGET).exe $(TARGET).bin $(TARGET).dfu $(TARGET).list \ - $(TARGET).map $(ODIR)/*.o $(ODIR)/*.o_ $(ODIR)/*.P $(ODIR)/*.bin \ + $(TARGET).map $(ODIR)*.o $(ODIR)*.o_ $(ODIR)*.P $(ODIR)*.bin \ filesystem/$(FILESYSYTEM) 2> /dev/null || true language: - $(SDIR)/../utils/extract_strings.pl -po > $(SDIR)/fs/language/deviation.po + $(SDIR)../utils/extract_strings.pl -po > $(SDIR)fs/language/deviation.po zip: $(TARGET).zip @@ -190,7 +188,7 @@ zip: $(TARGET).zip ifdef MODULAR export p=`pwd`; cd $(ODIR) && zip -ur $$p/deviation-$(HGVERSION).zip protocol/*.mod export p=`pwd`; cd $(ODIR) && zip -u $$p/debug-$(HGVERSION).zip *.elf - rm -rf $(ODIR)/protocol + rm -rf $(ODIR)protocol endif ifeq "$(INCLUDE_FS)" "1" export p=`pwd`; cd filesystem/$(FILESYSTEM) && zip -ur $$p/deviation-$(HGVERSION).zip * @@ -204,8 +202,6 @@ fs: $(TARGET).fs %.fs: rm -f deviation-fs-$(HGVERSION).zip; zip -r deviation-fs-$(HGVERSION).zip filesystem/$(FILESYSTEM) -release: $(TXS:%=zip_%) $(EMUS:%=zip_win_%) $(TXS:%=fs_%) - coverity: rm -rf cov-int 2>/dev/null; $(MAKE) distclean cov-build --dir cov-int make TARGET=devo8 @@ -213,7 +209,7 @@ coverity: tar -cvzf coverity-$(HGVERSION).tgz cov-int lint: - $(SDIR)/../utils/run_linter.py --diff --debug + $(SDIR)../utils/run_linter.py --diff --debug ########################################## #Ensure necessary directories are created# @@ -229,31 +225,31 @@ $(MODELDIR): ###################### #The main executable # ###################### -$(SDIR)/$(TARGET).$(EXEEXT): $(LINKFILE) $(OBJS) $(LIBOPENCM3) +$(SDIR)$(TARGET).$(EXEEXT): $(LINKFILE) $(OBJS) $(LIBOPENCM3) @echo " + Building '$@'" ifdef LINKFILE #Create an empty 'obj/$(TARGET)/optimize.ld' just in case the linker script needs it - echo "" > $(ODIR)/optimize.ld + echo "" > $(ODIR)optimize.ld endif ifeq ("$(SRC_CXX)", " ") - $(CC) -o $@ $(OBJS) $(LIBOPENCM3) $(LFLAGS) $(LFLAGS2) $(CFLAGS) $(EXTRA_CFLAGS) + $(CC) -o $@ $(OBJS) $(LIBOPENCM3) $(LFLAGS) $(CFLAGS) $(EXTRA_CFLAGS) else - $(CXX) -o $@ $(OBJS) $(LIBOPENCM3) $(LFLAGS) $(LFLAGS2) $(CFLAGS) $(EXTRA_CFLAGS) + $(CXX) -o $@ $(OBJS) $(LIBOPENCM3) $(LFLAGS) $(CFLAGS) $(EXTRA_CFLAGS) endif ############################## #Build rules for all .o files# ############################## -$(ODIR)/%.o: %.c +$(ODIR)%.o: %.c @echo " + Compiling '$<'" $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(CFLAGS_$(basename $(notdir $<))) -c -o $@ $< -$(ODIR)/%.o: %.cpp +$(ODIR)%.o: %.cpp @echo " + Compiling '$<'" $(CXX) $(CXXFLAGS) $(EXTRA_CFLAGS) $(CXXFLAGS_$(basename $(notdir $<))) -c -o $@ $< #For module building -$(ODIR)/%.o_: %.c +$(ODIR)%.o_: %.c @echo " + Compiling '$<' as module" $(CC) $(CFLAGS) $(MODULE_CFLAGS) $(CFLAGS_$(basename $(notdir $<))) -c -o $@ $< @@ -261,13 +257,9 @@ $(ODIR)/%.o_: %.c #Ensure version is up to date# ############################## # Rebuild on hg version change. -$(ODIR)/version.o: $(ODIR)/hgstamp +$(ODIR)version.o: $(ODIR)hgstamp -$(ODIR)/hgstamp: - echo $(HGVERSION) > $(ODIR)/hgstamp - -ifdef MODULAR -include protocol/Makefile.inc -endif +$(ODIR)hgstamp: + echo $(HGVERSION) > $(ODIR)hgstamp -include fs/Makefile.inc \ No newline at end of file +include $(SDIR)fs/Makefile.inc \ No newline at end of file diff --git a/src/fs/Makefile.inc b/src/fs/Makefile.inc new file mode 100644 index 0000000000..451c28e04d --- /dev/null +++ b/src/fs/Makefile.inc @@ -0,0 +1,66 @@ +################# +#The filesystem # +################# +%.fs_wrapper: $(LAST_MODEL) + true + +.PHONY: $(PRE_FS) $(LAST_MODEL) +$(LAST_MODEL): $(SDIR)/model_template.ini $(SDIR)/tx_template.ini $(FONTS) $(PRE_FS) + @echo " + Copying template files for $(FILESYSTEM)" + mkdir -p filesystem/$(FILESYSTEM) || true + for i in $(FILESYSTEMS); do cp -prf $(SDIR)/fs/$$i/* filesystem/$(FILESYSTEM)/; done + rm filesystem/$(FILESYSTEM)/*/.ignore 2>/dev/null || true + cp $(SDIR)/tx_template.ini filesystem/$(FILESYSTEM)/tx.ini + echo 'empty' > filesystem/$(FILESYSTEM)/errors.txt + mkdir filesystem/$(FILESYSTEM)/models 2> /dev/null || true + echo 'name=Model1' > filesystem/$(FILESYSTEM)/models/model1.ini \ + && cat $(SDIR)/model_template.ini >> filesystem/$(FILESYSTEM)/models/model1.ini + cp $(SDIR)/model_template.ini filesystem/$(FILESYSTEM)/models/default.ini +ifdef LANGUAGE + mkdir filesystem/$(FILESYSTEM)/language 2> /dev/null; \ + $(SDIR)/../utils/extract_strings.pl -po -fs filesystem/$(FILESYSTEM)/language -targets $(LANGUAGE) -update -objdir $(ODIR) +endif + export tx=$(FILESYSTEM); \ + number=2 ; while [ $$number -le $(NUM_MODELS) ] ; do \ + cp $(SDIR)/model_template.ini filesystem/$$tx/models/model$$number.ini; \ + number=`expr $$number + 1`; \ + done + @echo " + Checking string list length for $(FILESYSTEM)" +ifeq "$(TYPE)" "dev" + $(SDIR)/../utils/check_string_size.pl -target $(FILESYSTEM) -objdir $(ODIR) +else + $(SDIR)/../utils/check_string_size.pl -target $(FILESYSTEM) -objdir $(ODIR) -quiet +endif + $(SDIR)/../utils/run_linter.py --diff --skip-github --no-fail + +###################### +#Necessary Font files# +###################### +filesystem/$(FILESYSTEM)/media/12normal.fon: $(SDIR)/fonts/12normal.bdf + mkdir -p filesystem/$(FILESYSTEM)/media/ + $(SDIR)/../utils/font/bdf_to_font.pl -maxsize 12 -mode bin $< -out $@ -minspace 10 + +filesystem/$(FILESYSTEM)/media/15normal.fon: $(SDIR)/fonts/15normal.bdf + mkdir -p filesystem/$(FILESYSTEM)/media/ + $(SDIR)/../utils/font/bdf_to_font.pl -maxsize 15 -mode bin $< -out $@ -minspace 8 + +# special font for f12e with 18x12 char size +filesystem/$(FILESYSTEM)/media/f12e.fon: $(SDIR)/fonts/f12e.bdf + mkdir -p filesystem/$(FILESYSTEM)/media/ + $(SDIR)/../utils/font/bdf_to_font.pl -maxsize 18 -mode bin $< -out $@ -minspace 8 + +filesystem/$(FILESYSTEM)/media/12ascii.fon: $(SDIR)/fonts/12normal.bdf + mkdir -p filesystem/$(FILESYSTEM)/media/ + $(SDIR)/../utils/font/bdf_to_font.pl -maxsize 12 -mode bin $< -out $@ -minspace 10 -ascii + +filesystem/$(FILESYSTEM)/media/15ascii.fon: $(SDIR)/fonts/15normal.bdf + mkdir -p filesystem/$(FILESYSTEM)/media/ + $(SDIR)/../utils/font/bdf_to_font.pl -maxsize 15 -mode bin $< -out $@ -minspace 8 -ascii + +filesystem/$(FILESYSTEM)/media/23bold.fon: $(SDIR)/fonts/23bold.bdf + mkdir -p filesystem/$(FILESYSTEM)/media/ + $(SDIR)/../utils/font/bdf_to_font.pl -maxsize 23 -mode bin $< -out $@ -minspace 8 + +filesystem/$(FILESYSTEM)/media/04b03.fon: $(SDIR)/fonts/04b03.bdf + mkdir -p filesystem/$(FILESYSTEM)/media/ + $(SDIR)/../utils/font/bdf_to_font.pl -maxsize 5 -mode bin $< -out $@ -minspace 5 diff --git a/src/target/tx/devo/common/Makefile.inc b/src/target/tx/devo/common/Makefile.inc index c06a0ce922..39c01d8fbe 100644 --- a/src/target/tx/devo/common/Makefile.inc +++ b/src/target/tx/devo/common/Makefile.inc @@ -4,43 +4,43 @@ USE_JTAG ?= 0 FAMILY=devo CROSS = arm-none-eabi- -EXTRA_MAKEFILES := $(EXTRA_MAKEFILES) $(SDIR)/target/tx/devo/common/Makefile.inc - -PROTO_LINKFILE = $(SDIR)/target/tx/devo/$(TARGET)/protocol.ld - -LIBOPENCM3 = $(SDIR)/libopencm3/lib/libopencm3_stm32f1.a - -SRC_C = $(wildcard $(SDIR)/target/tx/devo/$(TARGET)/*.c) \ - $(wildcard $(SDIR)/target/drivers/mcu/stm32/*.c) \ - $(wildcard $(SDIR)/target/drivers/storage/*.c) \ - $(wildcard $(SDIR)/target/drivers/indicators/*.c) \ - $(wildcard $(SDIR)/target/tx/devo/common/*.c) \ - $(addprefix $(SDIR)/target/drivers/display/, $(DISPLAY_DRIVER)) \ - $(wildcard $(SDIR)/target/drivers/filesystems/*.c) \ - $(wildcard $(SDIR)/target/drivers/filesystems/petit_fat/*.c) \ - $(wildcard $(SDIR)/target/drivers/filesystems/devofs/*.c) \ - $(wildcard $(SDIR)/target/drivers/input/button_matrix/*.c) \ - $(wildcard $(SDIR)/target/drivers/serial/uart/*.c) \ - $(wildcard $(SDIR)/target/drivers/serial/soft_serial/*.c) \ - $(wildcard $(SDIR)/target/drivers/sound/piezo/*.c) \ - $(wildcard $(SDIR)/target/drivers/sound/uart_audio/*.c) \ - $(wildcard $(SDIR)/target/drivers/usb/*.c) \ - $(SDIR)/target/drivers/backlight/backlight.c \ - $(SDIR)/target/drivers/rtc/rtc_driver.c \ - $(SDIR)/target/drivers/haptic/haptic.c \ - $(SDIR)/target/drivers/input/analog/analog.c +EXTRA_MAKEFILES := $(EXTRA_MAKEFILES) $(SDIR)target/tx/devo/common/Makefile.inc + +PROTO_LINKFILE = $(SDIR)target/tx/devo/$(TARGET)/protocol.ld + +LIBOPENCM3 = $(SDIR)libopencm3/lib/libopencm3_stm32f1.a + +SRC_C = $(wildcard $(SDIR)target/tx/devo/$(TARGET)/*.c) \ + $(wildcard $(SDIR)target/drivers/mcu/stm32/*.c) \ + $(wildcard $(SDIR)target/drivers/storage/*.c) \ + $(wildcard $(SDIR)target/drivers/indicators/*.c) \ + $(wildcard $(SDIR)target/tx/devo/common/*.c) \ + $(addprefix $(SDIR)target/drivers/display/, $(DISPLAY_DRIVER)) \ + $(wildcard $(SDIR)target/drivers/filesystems/*.c) \ + $(wildcard $(SDIR)target/drivers/filesystems/petit_fat/*.c) \ + $(wildcard $(SDIR)target/drivers/filesystems/devofs/*.c) \ + $(wildcard $(SDIR)target/drivers/input/button_matrix/*.c) \ + $(wildcard $(SDIR)target/drivers/serial/uart/*.c) \ + $(wildcard $(SDIR)target/drivers/serial/soft_serial/*.c) \ + $(wildcard $(SDIR)target/drivers/sound/piezo/*.c) \ + $(wildcard $(SDIR)target/drivers/sound/uart_audio/*.c) \ + $(wildcard $(SDIR)target/drivers/usb/*.c) \ + $(SDIR)target/drivers/backlight/backlight.c \ + $(SDIR)target/drivers/rtc/rtc_driver.c \ + $(SDIR)target/drivers/haptic/haptic.c \ + $(SDIR)target/drivers/input/analog/analog.c ifdef MODULAR -PROTO_EXTRA_C = $(wildcard $(SDIR)/target/tx/devo/common/protocol/*.c) \ - $(SDIR)/target/drivers/usb/devo_hid.c \ - $(wildcard $(SDIR)/protocol/spi/*.c) \ - $(SDIR)/target/tx/devo/common/module_signature.c \ - $(SDIR)/target/tx/devo/common/uart.c +PROTO_EXTRA_C = $(wildcard $(SDIR)target/tx/devo/common/protocol/*.c) \ + $(SDIR)target/drivers/usb/devo_hid.c \ + $(wildcard $(SDIR)protocol/spi/*.c) \ + $(SDIR)target/tx/devo/common/module_signature.c \ + $(SDIR)target/tx/devo/common/uart.c else -SRC_C += $(wildcard $(SDIR)/target/tx/devo/common/protocol/*.c) +SRC_C += $(wildcard $(SDIR)target/tx/devo/common/protocol/*.c) endif -CFLAGS = -D"assert_param(x)=" -DSTM32F10X_HD -DSTM32F1 -mcpu=cortex-m3 -mthumb -mfix-cortex-m3-ldrd -fdata-sections -I$(SDIR)/target/tx/devo/common -I$(SDIR)/libopencm3/include -I$(SDIR)/target/drivers/filesystems -fno-builtin-printf -Os --specs=nano.specs +CFLAGS = -D"assert_param(x)=" -DSTM32F10X_HD -DSTM32F1 -mcpu=cortex-m3 -mthumb -mfix-cortex-m3-ldrd -fdata-sections -I$(SDIR)target/tx/devo/common -I$(SDIR)libopencm3/include -I$(SDIR)target/drivers/filesystems -fno-builtin-printf -Os --specs=nano.specs ifeq "$(HAS_4IN1_FLASH)" "1" CFLAGS += -D"HAS_4IN1_FLASH=1" endif @@ -53,9 +53,9 @@ endif MODULE_CFLAGS = -fno-builtin #LFLAGS = -nostartfiles -Wl,-gc-sections -Wl,-Map=$(TARGET).map,--cref -nostdlib -LFLAGS = -nostartfiles -Wl,-gc-sections -Wl,-Map=$(TARGET).map,--cref -lc -lnosys -L$(SDIR) -L$(SDIR)/protocol -L$(SDIR)/objs/$(TARGET) -Wl,-warn-common +LFLAGS = -nostartfiles -Wl,-gc-sections -Wl,-Map=$(TARGET).map,--cref -lc -lnosys -L$(SDIR) -L$(SDIR)protocol -L$(SDIR)objs/$(TARGET) -Wl,-warn-common -LINKFILE = $(SDIR)/target/tx/devo/$(TARGET)/$(TARGET).ld +LINKFILE = $(SDIR)target/tx/devo/$(TARGET)/$(TARGET).ld LFLAGS2 = -Wl,-T$(LINKFILE) ifdef ENABLE_LTO @@ -65,7 +65,7 @@ CFLAGS += -ffunction-sections endif ifdef OPTIMIZE_DFU -LINKFILEOPT = $(SDIR)/target/tx/devo/$(TARGET)/$(TARGET)_opt.ld +LINKFILEOPT = $(SDIR)target/tx/devo/$(TARGET)/$(TARGET)_opt.ld ifeq (,$(wildcard $(LINKFILEOPT))) LINKFILEOPT = $(LINKFILE) endif @@ -82,7 +82,7 @@ endif #-lnosys -ALL = $(LIBOPENCM3) $(SDIR)/$(TARGET).dfu +ALL += $(LIBOPENCM3) $(SDIR)$(TARGET).dfu ifdef ENABLE_LTO $(foreach src,$(filter %_isr.c,$(SRCS)),\ @@ -95,31 +95,34 @@ else FLOCKS = flock objs/.lock endif -$(SDIR)/$(TARGET).bin: $(SDIR)/$(TARGET).elf +$(SDIR)$(TARGET).bin: $(SDIR)$(TARGET).elf ifdef OPTIMIZE_DFU - $(CP) $(SDIR)/$(TARGET).elf $(SDIR)/objs/$(TARGET)/$(TARGET).elf + $(CP) $(SDIR)$(TARGET).elf $(SDIR)objs/$(TARGET)/$(TARGET).elf @echo " + Optimizing placement and re-linking" - $(SDIR)/../utils/repack_ld.pl -mapfile $(TARGET).map -linkfile $(LINKFILE) > $(SDIR)/objs/$(TARGET)/optimize.ld + $(SDIR)../utils/repack_ld.pl -mapfile $(TARGET).map -linkfile $(LINKFILE) > $(SDIR)objs/$(TARGET)/optimize.ld $(CC) -o $< $(OBJS) $(LIBOPENCM3) $(LFLAGS) $(LFLAGS2OPT) $(CFLAGS) endif ifdef MODULAR # the following builds a symbol file with thumb addresses (address+1 for functions, address+0 for variables) - $(DUMP) -t $< | $(SDIR)/../utils/build_symbolfile.pl > $(SYMBOL_FILE) + $(DUMP) -t $< | $(SDIR)../utils/build_symbolfile.pl > $(SYMBOL_FILE) endif $(CP) -O binary $< $@ $(DUMP) -S $< > $(TARGET).list +$(warning $(LIBOPENCM3)) + $(LIBOPENCM3): - test -s $(SDIR)/libopencm3/Makefile || { echo "Fetch libopencm3 via 'git submodule update --init'"; exit 1; } - +$(FLOCKS) $(MAKE) -C $(SDIR)/libopencm3 TARGETS=stm32/f1 lib + $(warning $(LIBOPENCM3)) + test -s $(SDIR)libopencm3/Makefile || { echo "Fetch libopencm3 via 'git submodule update --init'"; exit 1; } + +$(FLOCKS) $(MAKE) -C $(SDIR)libopencm3 TARGETS=stm32/f1 lib -$(SDIR)/$(TARGET).dfu: $(SDIR)/$(TARGET).bin - $(SDIR)/../utils/dfu.py --name "$(HGVERSION) Firmware" $(DFU_ARGS):$< $@ - $(SDIR)/../utils/get_mem_usage.pl $(TARGET).map +$(SDIR)$(TARGET).dfu: $(SDIR)$(TARGET).bin + $(SDIR)../utils/dfu.py --name "$(HGVERSION) Firmware" $(DFU_ARGS):$< $@ + $(SDIR)../utils/get_mem_usage.pl $(TARGET).map ################################### #The protocol modules (if needed) # ################################### -$(ODIR)/%.bin: $(ODIR)/%.o_ $(SDIR)/protocol/exports.ld $(PROTO_LINKFILE) $(PROTO_EXTRA_OBJS) $(TARGET).bin +$(ODIR)%.bin: $(ODIR)%.o_ $(SDIR)protocol/exports.ld $(PROTO_LINKFILE) $(PROTO_EXTRA_OBJS) $(TARGET).bin @echo " + Building '$@'" $(LD) -o $(@:.bin=.elf) $< $(PROTO_EXTRA_OBJS) $(LIBOPENCM3) -gc-sections -Map=$(@:.bin=.map) \ --cref -T$(PROTO_LINKFILE) --just-symbols=$(SYMBOL_FILE) diff --git a/src/target/tx/devo/devof12e/Makefile b/src/target/tx/devo/devof12e/Makefile new file mode 100644 index 0000000000..7e028e0760 --- /dev/null +++ b/src/target/tx/devo/devof12e/Makefile @@ -0,0 +1,19 @@ +TARGET=devof12e +SCREENSIZE := text +DISPLAY_DRIVER := i2c/video_tw8816.c +FILESYSTEMS := common text text_gfx + +DFU_ARGS := -c 12 -b 0x08004000 + +DEFAULT_PROTOCOLS := +INCLUDE_FS := 0 +OPTIMIZE_DFU := 1 + +MEDIA_FILES = +NUM_MODELS ?= 10 + +include $(SDIR)/target/tx/devo/common/Makefile.inc +include $(SDIR)/Makefile.inc + +$(TARGET).fs_wrapper: $(LAST_MODEL) + rm filesystem/$(FILESYSTEM)/datalog.bin diff --git a/src/target/tx/devo/devof12e/Makefile.inc b/src/target/tx/devo/devof12e/Makefile.inc deleted file mode 100644 index 79e5671440..0000000000 --- a/src/target/tx/devo/devof12e/Makefile.inc +++ /dev/null @@ -1,29 +0,0 @@ -SCREENSIZE := text -DISPLAY_DRIVER := i2c/video_tw8816.c -FILESYSTEMS := common text text_gfx - -DFU_ARGS := -c 12 -b 0x08004000 - -DEFAULT_PROTOCOLS := -INCLUDE_FS := 0 -OPTIMIZE_DFU := 1 - -include $(SDIR)/target/tx/devo/common/Makefile.inc -include target/tx/devo/common/Makefile.devofs.inc - -ifndef BUILD_TARGET - -MEDIA_FILES = -NUM_MODELS ?= 10 - -else - -#$(TARGET)-lib.dfu: $(wildcard filesystem/devof7/media/*.*) $(TARGET).dfu $(PRE_FS) $(TARGET).fs_wrapper -# target/common/devo/devofs/buildfs.pl -invert filesystem/devof7 > $(ODIR)/$(TARGET)-lib.bin -# dd if=$(ODIR)/$(TARGET)-lib.bin of=$(ODIR)/$(TARGET)-lib.1.bin bs=4096 count=1 -# dd if=$(ODIR)/$(TARGET)-lib.bin of=$(ODIR)/$(TARGET)-lib.2.bin bs=4096 skip=1 -# ../utils/dfu.py --name "$(HGVERSION) Library" --alt 2 -b 0x0000:$(ODIR)/$(TARGET)-lib.1.bin --alt 1 -b 0x1000:$(ODIR)/$(TARGET)-lib.2.bin $@ - -$(TARGET).fs_wrapper: $(LAST_MODEL) - rm filesystem/$(FILESYSTEM)/datalog.bin -endif From c8a16ca52a36b30425148e0ae4cda8e86f58daa5 Mon Sep 17 00:00:00 2001 From: Howard Su Date: Fri, 8 Mar 2019 14:06:15 +0800 Subject: [PATCH 07/15] add global targets --- src/Makefile | 19 ++++++++++++++++--- src/Makefile.inc | 12 ++---------- src/target/tx/devo/common/Makefile.inc | 2 +- 3 files changed, 19 insertions(+), 14 deletions(-) diff --git a/src/Makefile b/src/Makefile index ab7a1f3781..f13c222b2f 100644 --- a/src/Makefile +++ b/src/Makefile @@ -6,8 +6,7 @@ MAKEFLAGS += --no-builtin-rules # Setup common folder structure variables mkfile_path := $(abspath $(lastword $(MAKEFILE_LIST))) -SDIR = $(dir $(mkfile_path)) -export +export SDIR = $(dir $(mkfile_path)) ########################################### ## Provide some convenient make targets ## @@ -22,6 +21,11 @@ TXS ?= devo6 devo7e devo7e-256 devo8 devo10 devo12e devo12 devof7 devof7-XMS dev EMUS = $(foreach dir,$(TXS:%=emu_%),$(if $(wildcard target/$(dir)),$(dir),)) ALLEMUS = $(foreach dir,$(ALLTXS:%=emu_%),$(if $(wildcard target/$(dir)),$(dir),)) +default: + @echo specify the target to build. target can be one of + @echo $(TXS) + @echo $(addprefix emu_, $(TXS)) + .PHONY: txs emus both fss zips emuzips winzips release everything txs: $(TXS) emus: $(EMUS) @@ -69,10 +73,19 @@ endef # Now generate all the convenience targets $(foreach t,$(ALLTARGETS),$(eval $(call make-target,$t,$(notdir $(patsubst %/,%,$(dir $(wildcard target/tx/*/$(t)))))))) -.PHONY: distclean +.PHONY: distclean coverity lint distclean: rm -f *.$(EXEEXT) *.exe *.bin *.dfu *.list *.map rm -rf objs rm -rf filesystem $(MAKE) -C libopencm3 clean > /dev/null rm -rf deviation*.zip + +coverity: + rm -rf cov-int 2>/dev/null; $(MAKE) distclean + cov-build --dir cov-int make -C target/tx/devo/devo8 + cov-build --dir cov-int make -C target/tx/devo/devo10 + tar -cvzf coverity-$(HGVERSION).tgz cov-int + +lint: + $(SDIR)../utils/run_linter.py --diff --debug \ No newline at end of file diff --git a/src/Makefile.inc b/src/Makefile.inc index 684cb01da7..9294f4b657 100644 --- a/src/Makefile.inc +++ b/src/Makefile.inc @@ -140,7 +140,7 @@ MODELDIR = filesystem/$(FILESYSTEM)/models LAST_MODEL := $(MODELDIR)/model$(NUM_MODELS).ini -ALL += $(TARGET).fs_wrapper +ALL := $(ODIR) $(TARGET).fs_wrapper ############################################ #END SECTION # @@ -150,7 +150,7 @@ ALL += $(TARGET).fs_wrapper #this section includes build targets # ############################################ .PHONY: all -all : $(warning $(ALL)) $(ALL) $(OBJS) +all : $(ALL) $(OBJS) #################################### # recompile if the Makefile changes# @@ -202,14 +202,6 @@ fs: $(TARGET).fs %.fs: rm -f deviation-fs-$(HGVERSION).zip; zip -r deviation-fs-$(HGVERSION).zip filesystem/$(FILESYSTEM) -coverity: - rm -rf cov-int 2>/dev/null; $(MAKE) distclean - cov-build --dir cov-int make TARGET=devo8 - cov-build --dir cov-int make TARGET=devo10 - tar -cvzf coverity-$(HGVERSION).tgz cov-int - -lint: - $(SDIR)../utils/run_linter.py --diff --debug ########################################## #Ensure necessary directories are created# diff --git a/src/target/tx/devo/common/Makefile.inc b/src/target/tx/devo/common/Makefile.inc index 39c01d8fbe..e933b6c2ce 100644 --- a/src/target/tx/devo/common/Makefile.inc +++ b/src/target/tx/devo/common/Makefile.inc @@ -110,7 +110,7 @@ endif $(warning $(LIBOPENCM3)) -$(LIBOPENCM3): +$(LIBOPENCM3): $(ODIR) $(warning $(LIBOPENCM3)) test -s $(SDIR)libopencm3/Makefile || { echo "Fetch libopencm3 via 'git submodule update --init'"; exit 1; } +$(FLOCKS) $(MAKE) -C $(SDIR)libopencm3 TARGETS=stm32/f1 lib From c9e7d0fba3665041328dcc53fe28a8909ef25e46 Mon Sep 17 00:00:00 2001 From: Howard Su Date: Fri, 8 Mar 2019 15:15:12 +0800 Subject: [PATCH 08/15] Fix build for Tx --- src/Makefile.inc | 33 +++++++++----------- src/target/drivers/mcu/emu/Makefile.inc | 27 ++++++++++------- src/target/tx/devo/common/Makefile.inc | 16 +++++----- src/target/tx/other/test/Makefile | 40 +++++++++++++++++++++++++ src/target/tx/other/test/Makefile.inc | 36 ---------------------- src/target/tx/other/test/make-tests.sh | 1 + 6 files changed, 79 insertions(+), 74 deletions(-) create mode 100644 src/target/tx/other/test/Makefile delete mode 100644 src/target/tx/other/test/Makefile.inc diff --git a/src/Makefile.inc b/src/Makefile.inc index 9294f4b657..d34f5f3173 100644 --- a/src/Makefile.inc +++ b/src/Makefile.inc @@ -12,9 +12,6 @@ # We want to turn on INCLUDE_FS by default INCLUDE_FS ?= 1 -# Use VERBOSE=1 to enable verbose make -PROGMODE ?= STATUS_SCREEN - NUM_MODELS ?= 30 TYPE ?= prd @@ -95,7 +92,6 @@ define uniq = endef VPATH = $(call uniq, $(dir $(SRCS))) -$(warning $(VPATH)) HGVERSION ?= $(shell $(SDIR)../utils/get_version.pl ${TARGET}) HGVERSION := $(HGVERSION) @@ -122,7 +118,7 @@ MODULE_CFLAGS := -DMODULAR=$(MODULAR) CFLAGS += -DENABLE_MODULAR=$(MODULAR) endif -CFLAGS := $(CFLAGS) -g -Wall -Wextra -Werror=undef -I$(SDIR) -D$(PROGMODE) -std=gnu99 \ +CFLAGS := $(CFLAGS) -g -Wall -Wextra -Werror=undef -I$(SDIR) -std=gnu99 \ -I$(SDIR)target/tx/$(FAMILY)/$(TARGET) -I$(SDIR)gui/$(SCREENSIZE) \ -I$(SDIR)pages/$(SCREENSIZE) \ -DHGVERSION="\"${HGVERSION}\"" @@ -173,18 +169,17 @@ clean: language: $(SDIR)../utils/extract_strings.pl -po > $(SDIR)fs/language/deviation.po +zip: $(SDIR)$(TARGET).zip -zip: $(TARGET).zip - -%.zip: $(ALL) $(TARGET).dfu $(PROTO_MODULES) +$(SDIR)%.zip: $(ALL) $(PROTO_MODULES) #This is not an emulator build (emulator is hanled in target/common/emu/Makefile.inc) - cp -f $(TARGET).dfu deviation-$(HGVERSION).dfu - rm -f deviation-$(HGVERSION).zip - rm -f debug-$(HGVERSION).zip - zip debug-$(HGVERSION).zip $(TARGET).elf + cp -f $(SDIR)$(TARGET).dfu $(SDIR)deviation-$(HGVERSION).dfu + rm -f $(SDIR)deviation-$(HGVERSION).zip + rm -f $(SDIR)debug-$(HGVERSION).zip + zip $(SDIR)debug-$(HGVERSION).zip $(SDIR)$(TARGET).elf # $(MAKE) zipping more compatible with other distributions export p=`pwd`; cd $(ODIR) && test -e devo.fs && zip -u $$p/deviation-$(HGVERSION).zip devo.fs && rm devo.fs || true - zip deviation-$(HGVERSION).zip deviation-$(HGVERSION).dfu UPDATING.md + zip $(SDIR)deviation-$(HGVERSION).zip $(SDIR)deviation-$(HGVERSION).dfu $(SDIR)UPDATING.md ifdef MODULAR export p=`pwd`; cd $(ODIR) && zip -ur $$p/deviation-$(HGVERSION).zip protocol/*.mod export p=`pwd`; cd $(ODIR) && zip -u $$p/debug-$(HGVERSION).zip *.elf @@ -193,9 +188,9 @@ endif ifeq "$(INCLUDE_FS)" "1" export p=`pwd`; cd filesystem/$(FILESYSTEM) && zip -ur $$p/deviation-$(HGVERSION).zip * endif - zip -u deviation-$(HGVERSION).zip debug-$(HGVERSION).zip - rm -f debug-$(HGVERSION).zip - rm -f deviation-$(HGVERSION).dfu + zip -u $(SDIR)deviation-$(HGVERSION).zip $(SDIR)debug-$(HGVERSION).zip + rm -f $(SDIR)debug-$(HGVERSION).zip + rm -f $(SDIR)deviation-$(HGVERSION).dfu fs: $(TARGET).fs @@ -218,11 +213,11 @@ $(MODELDIR): #The main executable # ###################### $(SDIR)$(TARGET).$(EXEEXT): $(LINKFILE) $(OBJS) $(LIBOPENCM3) - @echo " + Building '$@'" + @echo " + Building '$@' '$(SRC_CXX)'" ifdef LINKFILE #Create an empty 'obj/$(TARGET)/optimize.ld' just in case the linker script needs it echo "" > $(ODIR)optimize.ld endif -ifeq ("$(SRC_CXX)", " ") +ifeq ("$(SRC_CXX)", "") $(CC) -o $@ $(OBJS) $(LIBOPENCM3) $(LFLAGS) $(CFLAGS) $(EXTRA_CFLAGS) else $(CXX) -o $@ $(OBJS) $(LIBOPENCM3) $(LFLAGS) $(CFLAGS) $(EXTRA_CFLAGS) @@ -254,4 +249,4 @@ $(ODIR)version.o: $(ODIR)hgstamp $(ODIR)hgstamp: echo $(HGVERSION) > $(ODIR)hgstamp -include $(SDIR)fs/Makefile.inc \ No newline at end of file +include $(SDIR)fs/Makefile.inc diff --git a/src/target/drivers/mcu/emu/Makefile.inc b/src/target/drivers/mcu/emu/Makefile.inc index c4444bcb10..d8bae31a85 100644 --- a/src/target/drivers/mcu/emu/Makefile.inc +++ b/src/target/drivers/mcu/emu/Makefile.inc @@ -1,26 +1,29 @@ -SRC_CXX = $(wildcard $(SDIR)/target/tx/$(FAMILY)/$(TARGET)/*.cpp) \ - $(wildcard $(SDIR)/target/drivers/mcu/emu/*.cpp) -SRC_C = $(wildcard $(SDIR)/target/tx/$(FAMILY)/$(TARGET)/*.c) \ - $(wildcard $(SDIR)/target/drivers/mcu/emu/*.c) \ - $(wildcard $(SDIR)/target/drivers/filesystems/*.c) +ifneq ("$(TARGET)", "test") +SRC_CXX = $(wildcard $(SDIR)target/tx/$(FAMILY)/$(TARGET)/*.cpp) \ + $(wildcard $(SDIR)target/drivers/mcu/emu/*.cpp) +endif + +SRC_C = $(wildcard $(SDIR)target/tx/$(FAMILY)/$(TARGET)/*.c) \ + $(wildcard $(SDIR)target/drivers/mcu/emu/*.c) \ + $(wildcard $(SDIR)target/drivers/filesystems/*.c) ifeq ("$(SCREENSIZE)", "128x64x1") -SRC_C += $(SDIR)/target/drivers/display/emu/emu_monochrome.c +SRC_C += $(SDIR)target/drivers/display/emu/emu_monochrome.c else ifneq ("$(SCREENSIZE)", "text") -SRC_C += $(SDIR)/target/drivers/display/emu/emu_color.c +SRC_C += $(SDIR)target/drivers/display/emu/emu_color.c endif ifdef USE_INTERNAL_FS -SRC_C += $(wildcard $(SDIR)/target/drivers/filesystems/devofs/*.c) \ - $(wildcard $(SDIR)/target/drivers/filesystems/petit_fat/*.c) +SRC_C += $(wildcard $(SDIR)target/drivers/filesystems/devofs/*.c) \ + $(wildcard $(SDIR)target/drivers/filesystems/petit_fat/*.c) CFLAGS = -DEMULATOR=USE_INTERNAL_FS else CFLAGS = -DEMULATOR=USE_NATIVE_FS endif -CFLAGS += -I$(SDIR)/target/drivers/mcu/emu -I$(SDIR)/target/drivers/filesystems +CFLAGS += -I$(SDIR)target/drivers/mcu/emu -I$(SDIR)target/drivers/filesystems -ALL += $(TARGET).$(EXEEXT) +ALL += $(SDIR)$(TARGET).$(EXEEXT) TYPE ?= dev @@ -52,6 +55,8 @@ else endif endif +default: $(SDIR)$(TARGET).$(EXEEXT) + CFLAGS += -DFILESYSTEM_DIR="\"filesystem/$(FILESYSTEM)\"" $(TARGET).zip: $(TARGET).$(EXEEXT) $(TARGET).fs_wrapper diff --git a/src/target/tx/devo/common/Makefile.inc b/src/target/tx/devo/common/Makefile.inc index e933b6c2ce..f59a1e582a 100644 --- a/src/target/tx/devo/common/Makefile.inc +++ b/src/target/tx/devo/common/Makefile.inc @@ -53,7 +53,7 @@ endif MODULE_CFLAGS = -fno-builtin #LFLAGS = -nostartfiles -Wl,-gc-sections -Wl,-Map=$(TARGET).map,--cref -nostdlib -LFLAGS = -nostartfiles -Wl,-gc-sections -Wl,-Map=$(TARGET).map,--cref -lc -lnosys -L$(SDIR) -L$(SDIR)protocol -L$(SDIR)objs/$(TARGET) -Wl,-warn-common +LFLAGS = -nostartfiles -Wl,-gc-sections -Wl,-Map=$(SDIR)$(TARGET).map,--cref -lc -lnosys -L$(SDIR) -L$(SDIR)protocol -L$(SDIR)objs/$(TARGET) -Wl,-warn-common LINKFILE = $(SDIR)target/tx/devo/$(TARGET)/$(TARGET).ld LFLAGS2 = -Wl,-T$(LINKFILE) @@ -92,32 +92,32 @@ endif ifeq ($(OS),Windows_NT) FLOCKS = else - FLOCKS = flock objs/.lock + FLOCKS = flock $(ODIR)../.lock endif +.PHONY: default +default: $(SDIR)$(TARGET).dfu + $(SDIR)$(TARGET).bin: $(SDIR)$(TARGET).elf ifdef OPTIMIZE_DFU $(CP) $(SDIR)$(TARGET).elf $(SDIR)objs/$(TARGET)/$(TARGET).elf @echo " + Optimizing placement and re-linking" - $(SDIR)../utils/repack_ld.pl -mapfile $(TARGET).map -linkfile $(LINKFILE) > $(SDIR)objs/$(TARGET)/optimize.ld + $(SDIR)../utils/repack_ld.pl -mapfile $(SDIR)$(TARGET).map -linkfile $(LINKFILE) > $(SDIR)objs/$(TARGET)/optimize.ld $(CC) -o $< $(OBJS) $(LIBOPENCM3) $(LFLAGS) $(LFLAGS2OPT) $(CFLAGS) endif ifdef MODULAR # the following builds a symbol file with thumb addresses (address+1 for functions, address+0 for variables) $(DUMP) -t $< | $(SDIR)../utils/build_symbolfile.pl > $(SYMBOL_FILE) endif $(CP) -O binary $< $@ - $(DUMP) -S $< > $(TARGET).list - -$(warning $(LIBOPENCM3)) + $(DUMP) -S $< > $(SDIR)$(TARGET).list $(LIBOPENCM3): $(ODIR) - $(warning $(LIBOPENCM3)) test -s $(SDIR)libopencm3/Makefile || { echo "Fetch libopencm3 via 'git submodule update --init'"; exit 1; } +$(FLOCKS) $(MAKE) -C $(SDIR)libopencm3 TARGETS=stm32/f1 lib $(SDIR)$(TARGET).dfu: $(SDIR)$(TARGET).bin $(SDIR)../utils/dfu.py --name "$(HGVERSION) Firmware" $(DFU_ARGS):$< $@ - $(SDIR)../utils/get_mem_usage.pl $(TARGET).map + $(SDIR)../utils/get_mem_usage.pl $(SDIR)$(TARGET).map ################################### #The protocol modules (if needed) # diff --git a/src/target/tx/other/test/Makefile b/src/target/tx/other/test/Makefile new file mode 100644 index 0000000000..1b72bb68f6 --- /dev/null +++ b/src/target/tx/other/test/Makefile @@ -0,0 +1,40 @@ +SCREENSIZE := 320x240x16 +FILESYSTEMS := common base_fonts 320x240x16 +FONTS = filesystem/$(FILESYSTEM)/media/15normal.fon \ + filesystem/$(FILESYSTEM)/media/23bold.fon +LANGUAGE := devo8 + +TARGET = test +FAMILY = other + +CFLAGS += -DTEST --coverage -g -O0 -fPIC +SRC_C += $(wildcard $(SDIR)target/tx/$(FAMILY)/$(TARGET)/*.c) \ + $(wildcard $(SDIR)target/drivers/filesystems/*.c) + +ifdef USE_INTERNAL_FS +SRC_C += $(wildcard $(SDIR)target/drivers/filesystems/devofs/*.c) \ + $(wildcard $(SDIR)target/drivers/filesystems/petit_fat/*.c) +CFLAGS = -DEMULATOR=USE_INTERNAL_FS +else +CFLAGS = -DEMULATOR=USE_NATIVE_FS +endif + +TYPE ?= dev + +CFLAGS += -I$(SDIR)target/drivers/filesystems +LFLAGS += -lz + +SRC_C += objs/test/AllTests.c + +CFLAGS += -DFILESYSTEM_DIR="\"filesystem/$(FILESYSTEM)\"" + +EXEEXT = +ALL += $(ODIR)AllTests.c $(TARGET).$(EXEEXT) + +default: $(ODIR)AllTests.c $(TARGET).$(EXEEXT) + +$(ODIR)AllTests.c: make-tests.sh $(SDIR)tests/*.c + echo $(PWD) + sh make-tests.sh > $(ODIR)AllTests.c + +include $(SDIR)Makefile.inc diff --git a/src/target/tx/other/test/Makefile.inc b/src/target/tx/other/test/Makefile.inc deleted file mode 100644 index 4843023877..0000000000 --- a/src/target/tx/other/test/Makefile.inc +++ /dev/null @@ -1,36 +0,0 @@ -SCREENSIZE := 320x240x16 -FILESYSTEMS := common base_fonts 320x240x16 -FONTS = filesystem/$(FILESYSTEM)/media/15normal.fon \ - filesystem/$(FILESYSTEM)/media/23bold.fon -LANGUAGE := devo8 - -CFLAGS += -DTEST --coverage -g -O0 -fPIC -ifndef BUILD_TARGET - -SRC_C = $(wildcard $(SDIR)/target/tx/$(FAMILY)/$(TARGET)/*.c) \ - $(wildcard $(SDIR)/target/drivers/filesystems/*.c) - -ifdef USE_INTERNAL_FS -SRC_C += $(wildcard $(SDIR)/target/drivers/filesystems/devofs/*.c) \ - $(wildcard $(SDIR)/target/drivers/filesystems/petit_fat/*.c) -CFLAGS = -DEMULATOR=USE_INTERNAL_FS -else -CFLAGS = -DEMULATOR=USE_NATIVE_FS -endif - -CFLAGS += -I$(SDIR)/target/drivers/filesystems -LFLAGS += -lz - -ALL = $(TARGET).$(EXEEXT) - -TYPE ?= dev - -SRC_C += objs/test/AllTests.c - -else #BUILD_TARGET -CFLAGS += -DFILESYSTEM_DIR="\"filesystem/$(FILESYSTEM)\"" - -objs/test/AllTests.c: target/tx/$(FAMILY)/$(TARGET)/make-tests.sh tests/*.c - sh target/tx/$(FAMILY)/$(TARGET)/make-tests.sh > $(ODIR)/AllTests.c - -endif #BUILD_TARGET diff --git a/src/target/tx/other/test/make-tests.sh b/src/target/tx/other/test/make-tests.sh index 93a44667b0..722c488c6d 100755 --- a/src/target/tx/other/test/make-tests.sh +++ b/src/target/tx/other/test/make-tests.sh @@ -5,6 +5,7 @@ # Prints to stdout. # Author: Asim Jalis # Date: 01/08/2003 +echo $PWD FILES=`find tests/ -name '*.c' | sort` echo ' From d7f40ebd3d1ce9ebdba071d5b5bc4037a2fc68bd Mon Sep 17 00:00:00 2001 From: Howard Su Date: Fri, 8 Mar 2019 15:19:49 +0800 Subject: [PATCH 09/15] Rename makefile.inc to makefile --- src/target/tx/devo/devo10/{Makefile.inc => Makefile} | 0 src/target/tx/devo/devo12/{Makefile.inc => Makefile} | 0 src/target/tx/devo/devo12e/{Makefile.inc => Makefile} | 0 src/target/tx/devo/devo6/{Makefile.inc => Makefile} | 0 src/target/tx/devo/devo7e-256/{Makefile.inc => Makefile} | 0 src/target/tx/devo/devo7e/{Makefile.inc => Makefile} | 0 src/target/tx/devo/devof12e-XMS/{Makefile.inc => Makefile} | 0 src/target/tx/devo/devof4-XMS/{Makefile.inc => Makefile} | 0 src/target/tx/devo/devof4/{Makefile.inc => Makefile} | 0 src/target/tx/devo/devof7-XMS/{Makefile.inc => Makefile} | 0 src/target/tx/devo/devof7/{Makefile.inc => Makefile} | 0 src/target/tx/devo/emu_devo10/{Makefile.inc => Makefile} | 0 src/target/tx/devo/emu_devo12/{Makefile.inc => Makefile} | 0 src/target/tx/devo/emu_devo12e/{Makefile.inc => Makefile} | 0 src/target/tx/devo/emu_devo6/{Makefile.inc => Makefile} | 0 src/target/tx/devo/emu_devo7e-256/{Makefile.inc => Makefile} | 0 src/target/tx/devo/emu_devo7e/{Makefile.inc => Makefile} | 0 src/target/tx/devo/emu_devof12e-XMS/{Makefile.inc => Makefile} | 0 src/target/tx/devo/emu_devof12e/{Makefile.inc => Makefile} | 0 src/target/tx/devo/emu_devof7/{Makefile.inc => Makefile} | 0 src/target/tx/devo/emu_t8sg/{Makefile.inc => Makefile} | 0 src/target/tx/devo/emu_t8sg_v2/{Makefile.inc => Makefile} | 0 src/target/tx/devo/ir8m/{Makefile.inc => Makefile} | 0 src/target/tx/devo/t8sg/{Makefile.inc => Makefile} | 0 src/target/tx/devo/t8sg_v2/{Makefile.inc => Makefile} | 0 src/target/tx/devo/t8sg_v2_plus/{Makefile.inc => Makefile} | 0 26 files changed, 0 insertions(+), 0 deletions(-) rename src/target/tx/devo/devo10/{Makefile.inc => Makefile} (100%) rename src/target/tx/devo/devo12/{Makefile.inc => Makefile} (100%) rename src/target/tx/devo/devo12e/{Makefile.inc => Makefile} (100%) rename src/target/tx/devo/devo6/{Makefile.inc => Makefile} (100%) rename src/target/tx/devo/devo7e-256/{Makefile.inc => Makefile} (100%) rename src/target/tx/devo/devo7e/{Makefile.inc => Makefile} (100%) rename src/target/tx/devo/devof12e-XMS/{Makefile.inc => Makefile} (100%) rename src/target/tx/devo/devof4-XMS/{Makefile.inc => Makefile} (100%) rename src/target/tx/devo/devof4/{Makefile.inc => Makefile} (100%) rename src/target/tx/devo/devof7-XMS/{Makefile.inc => Makefile} (100%) rename src/target/tx/devo/devof7/{Makefile.inc => Makefile} (100%) rename src/target/tx/devo/emu_devo10/{Makefile.inc => Makefile} (100%) rename src/target/tx/devo/emu_devo12/{Makefile.inc => Makefile} (100%) rename src/target/tx/devo/emu_devo12e/{Makefile.inc => Makefile} (100%) rename src/target/tx/devo/emu_devo6/{Makefile.inc => Makefile} (100%) rename src/target/tx/devo/emu_devo7e-256/{Makefile.inc => Makefile} (100%) rename src/target/tx/devo/emu_devo7e/{Makefile.inc => Makefile} (100%) rename src/target/tx/devo/emu_devof12e-XMS/{Makefile.inc => Makefile} (100%) rename src/target/tx/devo/emu_devof12e/{Makefile.inc => Makefile} (100%) rename src/target/tx/devo/emu_devof7/{Makefile.inc => Makefile} (100%) rename src/target/tx/devo/emu_t8sg/{Makefile.inc => Makefile} (100%) rename src/target/tx/devo/emu_t8sg_v2/{Makefile.inc => Makefile} (100%) rename src/target/tx/devo/ir8m/{Makefile.inc => Makefile} (100%) rename src/target/tx/devo/t8sg/{Makefile.inc => Makefile} (100%) rename src/target/tx/devo/t8sg_v2/{Makefile.inc => Makefile} (100%) rename src/target/tx/devo/t8sg_v2_plus/{Makefile.inc => Makefile} (100%) diff --git a/src/target/tx/devo/devo10/Makefile.inc b/src/target/tx/devo/devo10/Makefile similarity index 100% rename from src/target/tx/devo/devo10/Makefile.inc rename to src/target/tx/devo/devo10/Makefile diff --git a/src/target/tx/devo/devo12/Makefile.inc b/src/target/tx/devo/devo12/Makefile similarity index 100% rename from src/target/tx/devo/devo12/Makefile.inc rename to src/target/tx/devo/devo12/Makefile diff --git a/src/target/tx/devo/devo12e/Makefile.inc b/src/target/tx/devo/devo12e/Makefile similarity index 100% rename from src/target/tx/devo/devo12e/Makefile.inc rename to src/target/tx/devo/devo12e/Makefile diff --git a/src/target/tx/devo/devo6/Makefile.inc b/src/target/tx/devo/devo6/Makefile similarity index 100% rename from src/target/tx/devo/devo6/Makefile.inc rename to src/target/tx/devo/devo6/Makefile diff --git a/src/target/tx/devo/devo7e-256/Makefile.inc b/src/target/tx/devo/devo7e-256/Makefile similarity index 100% rename from src/target/tx/devo/devo7e-256/Makefile.inc rename to src/target/tx/devo/devo7e-256/Makefile diff --git a/src/target/tx/devo/devo7e/Makefile.inc b/src/target/tx/devo/devo7e/Makefile similarity index 100% rename from src/target/tx/devo/devo7e/Makefile.inc rename to src/target/tx/devo/devo7e/Makefile diff --git a/src/target/tx/devo/devof12e-XMS/Makefile.inc b/src/target/tx/devo/devof12e-XMS/Makefile similarity index 100% rename from src/target/tx/devo/devof12e-XMS/Makefile.inc rename to src/target/tx/devo/devof12e-XMS/Makefile diff --git a/src/target/tx/devo/devof4-XMS/Makefile.inc b/src/target/tx/devo/devof4-XMS/Makefile similarity index 100% rename from src/target/tx/devo/devof4-XMS/Makefile.inc rename to src/target/tx/devo/devof4-XMS/Makefile diff --git a/src/target/tx/devo/devof4/Makefile.inc b/src/target/tx/devo/devof4/Makefile similarity index 100% rename from src/target/tx/devo/devof4/Makefile.inc rename to src/target/tx/devo/devof4/Makefile diff --git a/src/target/tx/devo/devof7-XMS/Makefile.inc b/src/target/tx/devo/devof7-XMS/Makefile similarity index 100% rename from src/target/tx/devo/devof7-XMS/Makefile.inc rename to src/target/tx/devo/devof7-XMS/Makefile diff --git a/src/target/tx/devo/devof7/Makefile.inc b/src/target/tx/devo/devof7/Makefile similarity index 100% rename from src/target/tx/devo/devof7/Makefile.inc rename to src/target/tx/devo/devof7/Makefile diff --git a/src/target/tx/devo/emu_devo10/Makefile.inc b/src/target/tx/devo/emu_devo10/Makefile similarity index 100% rename from src/target/tx/devo/emu_devo10/Makefile.inc rename to src/target/tx/devo/emu_devo10/Makefile diff --git a/src/target/tx/devo/emu_devo12/Makefile.inc b/src/target/tx/devo/emu_devo12/Makefile similarity index 100% rename from src/target/tx/devo/emu_devo12/Makefile.inc rename to src/target/tx/devo/emu_devo12/Makefile diff --git a/src/target/tx/devo/emu_devo12e/Makefile.inc b/src/target/tx/devo/emu_devo12e/Makefile similarity index 100% rename from src/target/tx/devo/emu_devo12e/Makefile.inc rename to src/target/tx/devo/emu_devo12e/Makefile diff --git a/src/target/tx/devo/emu_devo6/Makefile.inc b/src/target/tx/devo/emu_devo6/Makefile similarity index 100% rename from src/target/tx/devo/emu_devo6/Makefile.inc rename to src/target/tx/devo/emu_devo6/Makefile diff --git a/src/target/tx/devo/emu_devo7e-256/Makefile.inc b/src/target/tx/devo/emu_devo7e-256/Makefile similarity index 100% rename from src/target/tx/devo/emu_devo7e-256/Makefile.inc rename to src/target/tx/devo/emu_devo7e-256/Makefile diff --git a/src/target/tx/devo/emu_devo7e/Makefile.inc b/src/target/tx/devo/emu_devo7e/Makefile similarity index 100% rename from src/target/tx/devo/emu_devo7e/Makefile.inc rename to src/target/tx/devo/emu_devo7e/Makefile diff --git a/src/target/tx/devo/emu_devof12e-XMS/Makefile.inc b/src/target/tx/devo/emu_devof12e-XMS/Makefile similarity index 100% rename from src/target/tx/devo/emu_devof12e-XMS/Makefile.inc rename to src/target/tx/devo/emu_devof12e-XMS/Makefile diff --git a/src/target/tx/devo/emu_devof12e/Makefile.inc b/src/target/tx/devo/emu_devof12e/Makefile similarity index 100% rename from src/target/tx/devo/emu_devof12e/Makefile.inc rename to src/target/tx/devo/emu_devof12e/Makefile diff --git a/src/target/tx/devo/emu_devof7/Makefile.inc b/src/target/tx/devo/emu_devof7/Makefile similarity index 100% rename from src/target/tx/devo/emu_devof7/Makefile.inc rename to src/target/tx/devo/emu_devof7/Makefile diff --git a/src/target/tx/devo/emu_t8sg/Makefile.inc b/src/target/tx/devo/emu_t8sg/Makefile similarity index 100% rename from src/target/tx/devo/emu_t8sg/Makefile.inc rename to src/target/tx/devo/emu_t8sg/Makefile diff --git a/src/target/tx/devo/emu_t8sg_v2/Makefile.inc b/src/target/tx/devo/emu_t8sg_v2/Makefile similarity index 100% rename from src/target/tx/devo/emu_t8sg_v2/Makefile.inc rename to src/target/tx/devo/emu_t8sg_v2/Makefile diff --git a/src/target/tx/devo/ir8m/Makefile.inc b/src/target/tx/devo/ir8m/Makefile similarity index 100% rename from src/target/tx/devo/ir8m/Makefile.inc rename to src/target/tx/devo/ir8m/Makefile diff --git a/src/target/tx/devo/t8sg/Makefile.inc b/src/target/tx/devo/t8sg/Makefile similarity index 100% rename from src/target/tx/devo/t8sg/Makefile.inc rename to src/target/tx/devo/t8sg/Makefile diff --git a/src/target/tx/devo/t8sg_v2/Makefile.inc b/src/target/tx/devo/t8sg_v2/Makefile similarity index 100% rename from src/target/tx/devo/t8sg_v2/Makefile.inc rename to src/target/tx/devo/t8sg_v2/Makefile diff --git a/src/target/tx/devo/t8sg_v2_plus/Makefile.inc b/src/target/tx/devo/t8sg_v2_plus/Makefile similarity index 100% rename from src/target/tx/devo/t8sg_v2_plus/Makefile.inc rename to src/target/tx/devo/t8sg_v2_plus/Makefile From 041ec470df549bf3c8a15c4b54cd50f3bab21a98 Mon Sep 17 00:00:00 2001 From: Howard Su Date: Fri, 8 Mar 2019 15:24:40 +0800 Subject: [PATCH 10/15] rename makefile.inc to makefile --- src/target/tx/opentx/t12/{Makefile.inc => Makefile} | 0 src/target/tx/radiolink/at10/{Makefile.inc => Makefile} | 0 src/target/tx/radiolink/at9/{Makefile.inc => Makefile} | 0 src/target/tx/radiolink/emu_at10/{Makefile.inc => Makefile} | 0 src/target/tx/radiolink/emu_at9/{Makefile.inc => Makefile} | 0 5 files changed, 0 insertions(+), 0 deletions(-) rename src/target/tx/opentx/t12/{Makefile.inc => Makefile} (100%) rename src/target/tx/radiolink/at10/{Makefile.inc => Makefile} (100%) rename src/target/tx/radiolink/at9/{Makefile.inc => Makefile} (100%) rename src/target/tx/radiolink/emu_at10/{Makefile.inc => Makefile} (100%) rename src/target/tx/radiolink/emu_at9/{Makefile.inc => Makefile} (100%) diff --git a/src/target/tx/opentx/t12/Makefile.inc b/src/target/tx/opentx/t12/Makefile similarity index 100% rename from src/target/tx/opentx/t12/Makefile.inc rename to src/target/tx/opentx/t12/Makefile diff --git a/src/target/tx/radiolink/at10/Makefile.inc b/src/target/tx/radiolink/at10/Makefile similarity index 100% rename from src/target/tx/radiolink/at10/Makefile.inc rename to src/target/tx/radiolink/at10/Makefile diff --git a/src/target/tx/radiolink/at9/Makefile.inc b/src/target/tx/radiolink/at9/Makefile similarity index 100% rename from src/target/tx/radiolink/at9/Makefile.inc rename to src/target/tx/radiolink/at9/Makefile diff --git a/src/target/tx/radiolink/emu_at10/Makefile.inc b/src/target/tx/radiolink/emu_at10/Makefile similarity index 100% rename from src/target/tx/radiolink/emu_at10/Makefile.inc rename to src/target/tx/radiolink/emu_at10/Makefile diff --git a/src/target/tx/radiolink/emu_at9/Makefile.inc b/src/target/tx/radiolink/emu_at9/Makefile similarity index 100% rename from src/target/tx/radiolink/emu_at9/Makefile.inc rename to src/target/tx/radiolink/emu_at9/Makefile From c3dd3659e7d9f13866ae241334eadf6726e7e81a Mon Sep 17 00:00:00 2001 From: Howard Su Date: Fri, 8 Mar 2019 21:55:08 +0800 Subject: [PATCH 11/15] Get txs and emus build --- src/Makefile | 4 +- src/Makefile.inc | 22 ++++--- src/target/drivers/mcu/emu/Makefile.inc | 6 +- src/target/tx/devo/common/Makefile.devofs.inc | 5 -- src/target/tx/devo/common/Makefile.inc | 10 +-- src/target/tx/devo/devo10/Makefile | 3 + src/target/tx/devo/devo12/Makefile | 8 +-- src/target/tx/devo/devo12e/Makefile | 6 +- src/target/tx/devo/devo6/Makefile | 6 +- src/target/tx/devo/devo7e-256/Makefile | 11 ++-- src/target/tx/devo/devo7e/Makefile | 6 +- src/target/tx/devo/devo8/Makefile | 3 +- src/target/tx/devo/devof12e-XMS/Makefile | 16 +++-- src/target/tx/devo/devof4-XMS/Makefile | 9 ++- src/target/tx/devo/devof4/Makefile | 12 ++-- src/target/tx/devo/devof7-XMS/Makefile | 9 ++- src/target/tx/devo/devof7/Makefile | 16 +++-- src/target/tx/devo/emu_devo10/Makefile | 6 +- src/target/tx/devo/emu_devo12/Makefile | 6 +- src/target/tx/devo/emu_devo12e/Makefile | 6 +- src/target/tx/devo/emu_devo6/Makefile | 6 +- src/target/tx/devo/emu_devo7e-256/Makefile | 8 ++- src/target/tx/devo/emu_devo7e/Makefile | 8 ++- src/target/tx/devo/emu_devof12e-XMS/Makefile | 15 ++++- .../tx/devo/emu_devof12e-XMS/capabilities.h | 1 - .../tx/devo/emu_devof12e-XMS/channels.c | 1 - .../tx/devo/emu_devof12e-XMS/char_map.h | 1 - src/target/tx/devo/emu_devof12e-XMS/lcd.c | 1 - src/target/tx/devo/emu_devof12e-XMS/lcd.h | 1 - .../tx/devo/emu_devof12e-XMS/lcd_page_props.h | 1 - .../tx/devo/emu_devof12e-XMS/mapped_gfx.c | 1 - src/target/tx/devo/emu_devof12e-XMS/tw8816.c | 1 - .../tx/devo/emu_devof12e-XMS/tw8816_map.c | 1 - src/target/tx/devo/emu_devof12e/Makefile | 5 +- src/target/tx/devo/emu_devof7/Makefile | 8 ++- src/target/tx/devo/emu_devof7/ia9211_map.c | 1 - src/target/tx/devo/emu_devof7/lcd.c | 1 + src/target/tx/devo/emu_t8sg/Makefile | 8 ++- src/target/tx/devo/emu_t8sg_v2/Makefile | 8 ++- src/target/tx/devo/ir8m/Makefile | 7 +-- src/target/tx/devo/t8sg/Makefile | 7 +-- src/target/tx/devo/t8sg_v2/Makefile | 9 ++- src/target/tx/devo/t8sg_v2_plus/Makefile | 7 +-- src/target/tx/opentx/t12/Makefile | 14 ++--- src/target/tx/radiolink/at10/Makefile | 22 +++---- src/target/tx/radiolink/at9/Makefile | 13 ++-- src/target/tx/radiolink/common/Makefile.inc | 61 ++++++++++++------- 47 files changed, 211 insertions(+), 176 deletions(-) delete mode 100644 src/target/tx/devo/emu_devof12e-XMS/capabilities.h delete mode 100644 src/target/tx/devo/emu_devof12e-XMS/channels.c delete mode 100644 src/target/tx/devo/emu_devof12e-XMS/char_map.h delete mode 100644 src/target/tx/devo/emu_devof12e-XMS/lcd.c delete mode 100644 src/target/tx/devo/emu_devof12e-XMS/lcd.h delete mode 100644 src/target/tx/devo/emu_devof12e-XMS/lcd_page_props.h delete mode 100644 src/target/tx/devo/emu_devof12e-XMS/mapped_gfx.c delete mode 100644 src/target/tx/devo/emu_devof12e-XMS/tw8816.c delete mode 100644 src/target/tx/devo/emu_devof12e-XMS/tw8816_map.c delete mode 100644 src/target/tx/devo/emu_devof7/ia9211_map.c diff --git a/src/Makefile b/src/Makefile index d97dca86c0..00ad8cddc9 100644 --- a/src/Makefile +++ b/src/Makefile @@ -18,8 +18,8 @@ ALLTARGETS = $(filter-out common,$(notdir $(wildcard target/tx/*/*))) TXS ?= devo6 devo7e devo7e-256 devo8 devo10 devo12e devo12 devof7 devof7-XMS devof4 devof4-XMS devof12e devof12e-XMS at9 at10 t8sg t8sg_v2 t8sg_v2_plus ir8m #Filter non-existant emus -EMUS = $(foreach dir,$(TXS:%=emu_%),$(if $(wildcard target/$(dir)),$(dir),)) -ALLEMUS = $(foreach dir,$(ALLTXS:%=emu_%),$(if $(wildcard target/$(dir)),$(dir),)) +EMUS = $(addprefix emu_, $(TXS)) +ALLEMUS = $(addprefix emu_, $(ALLTXS)) default: @echo specify the target to build. target can be one of diff --git a/src/Makefile.inc b/src/Makefile.inc index d34f5f3173..83a1aaed52 100644 --- a/src/Makefile.inc +++ b/src/Makefile.inc @@ -76,7 +76,9 @@ SRCS := $(SRC_C) $(SRC_CXX) $(SRC_S) #This section intermediate build files # ############################################ ODIR = $(SDIR)objs/$(TARGET)$(ODIREXT)/ -OBJS := $(patsubst %.c,$(ODIR)%.o,$(notdir $(SRCS))) +OBJS := $(patsubst %.c,$(ODIR)%.o,$(notdir $(SRC_C))) $(patsubst %.cpp,$(ODIR)%.o,$(notdir $(SRC_CXX))) + +$(warning $(OBJS)) ifdef MODULAR PROTO_OBJS := $(addprefix $(ODIR), $(notdir $(PROTO_SRC_C:.c=.o))) @@ -213,31 +215,30 @@ $(MODELDIR): #The main executable # ###################### $(SDIR)$(TARGET).$(EXEEXT): $(LINKFILE) $(OBJS) $(LIBOPENCM3) - @echo " + Building '$@' '$(SRC_CXX)'" + @echo " + Building '$(notdir $@)'" ifdef LINKFILE #Create an empty 'obj/$(TARGET)/optimize.ld' just in case the linker script needs it echo "" > $(ODIR)optimize.ld endif ifeq ("$(SRC_CXX)", "") - $(CC) -o $@ $(OBJS) $(LIBOPENCM3) $(LFLAGS) $(CFLAGS) $(EXTRA_CFLAGS) + $(CC) -o $@ $(OBJS) $(LIBOPENCM3) $(LFLAGS) $(LFLAGS2) $(CFLAGS) $(EXTRA_CFLAGS) else - $(CXX) -o $@ $(OBJS) $(LIBOPENCM3) $(LFLAGS) $(CFLAGS) $(EXTRA_CFLAGS) + $(CXX) -o $@ $(OBJS) $(LIBOPENCM3) $(LFLAGS) $(LFLAGS2) $(CFLAGS) $(EXTRA_CFLAGS) endif - ############################## #Build rules for all .o files# ############################## $(ODIR)%.o: %.c - @echo " + Compiling '$<'" - $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(CFLAGS_$(basename $(notdir $<))) -c -o $@ $< + @echo " + Compiling '$(notdir $<)'" + $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(CFLAGS_$(basename $(notdir $<))) -MT $@ -MD -MP -MF $(@:.o=.d) -c -o $@ $< $(ODIR)%.o: %.cpp - @echo " + Compiling '$<'" - $(CXX) $(CXXFLAGS) $(EXTRA_CFLAGS) $(CXXFLAGS_$(basename $(notdir $<))) -c -o $@ $< + @echo " + Compiling '$(notdir $<)'" + $(CXX) $(CXXFLAGS) $(EXTRA_CFLAGS) $(CXXFLAGS_$(basename $(notdir $<))) -MD -MP -MF $(@:.o=.d) -c -o $@ $< #For module building $(ODIR)%.o_: %.c - @echo " + Compiling '$<' as module" + @echo " + Compiling '$(notdir $<)' as module" $(CC) $(CFLAGS) $(MODULE_CFLAGS) $(CFLAGS_$(basename $(notdir $<))) -c -o $@ $< ############################## @@ -250,3 +251,4 @@ $(ODIR)hgstamp: echo $(HGVERSION) > $(ODIR)hgstamp include $(SDIR)fs/Makefile.inc +-include $(OBJS:.o=.d) diff --git a/src/target/drivers/mcu/emu/Makefile.inc b/src/target/drivers/mcu/emu/Makefile.inc index d8bae31a85..f5b5c3e779 100644 --- a/src/target/drivers/mcu/emu/Makefile.inc +++ b/src/target/drivers/mcu/emu/Makefile.inc @@ -16,9 +16,9 @@ endif ifdef USE_INTERNAL_FS SRC_C += $(wildcard $(SDIR)target/drivers/filesystems/devofs/*.c) \ $(wildcard $(SDIR)target/drivers/filesystems/petit_fat/*.c) -CFLAGS = -DEMULATOR=USE_INTERNAL_FS +CFLAGS += -DEMULATOR=USE_INTERNAL_FS else -CFLAGS = -DEMULATOR=USE_NATIVE_FS +CFLAGS += -DEMULATOR=USE_NATIVE_FS endif CFLAGS += -I$(SDIR)target/drivers/mcu/emu -I$(SDIR)target/drivers/filesystems @@ -45,7 +45,7 @@ ifdef WINDOWS EXEEXT = exe ODIREXT = -w32 else - EXEEXT = + EXEEXT = elf CFLAGS := $(CFLAGS) $(shell fltk-config --cflags) LFLAGS := $(LFLAGS) $(shell fltk-config --ldflags) ifndef SOUND diff --git a/src/target/tx/devo/common/Makefile.devofs.inc b/src/target/tx/devo/common/Makefile.devofs.inc index 417155927a..77f5e664d6 100644 --- a/src/target/tx/devo/common/Makefile.devofs.inc +++ b/src/target/tx/devo/common/Makefile.devofs.inc @@ -1,9 +1,6 @@ -ifndef BUILD_TARGET ALL += $(ODIR)/devo.fs -else - ifdef MODULAR DEFAULT_PROTOCOLS = devo.mod dsm2.mod @@ -18,5 +15,3 @@ ifneq "$(REQUIRED_PROTOCOLS)" "" cp -pf $(REQUIRED_PROTOCOLS) $(ODIR)/tmpfs/protocol/ endif target/drivers/filesystems/devofs/buildfs.py -c -f $@ -d $(ODIR)/tmpfs - -endif diff --git a/src/target/tx/devo/common/Makefile.inc b/src/target/tx/devo/common/Makefile.inc index 5bbfa45a16..685a68576a 100644 --- a/src/target/tx/devo/common/Makefile.inc +++ b/src/target/tx/devo/common/Makefile.inc @@ -2,6 +2,8 @@ HAS_4IN1_FLASH ?= 0 HAS_FLASH_DETECT ?= 0 USE_JTAG ?= 0 +ODIR = $(SDIR)objs/$(TARGET) + FAMILY=devo CROSS = arm-none-eabi- EXTRA_MAKEFILES := $(EXTRA_MAKEFILES) $(SDIR)target/tx/devo/common/Makefile.inc @@ -10,7 +12,7 @@ PROTO_LINKFILE = $(SDIR)target/tx/devo/$(TARGET)/protocol.ld LIBOPENCM3 = $(SDIR)libopencm3/lib/libopencm3_stm32f1.a -SRC_C = $(wildcard $(SDIR)target/tx/devo/$(TARGET)/*.c) \ +SRC_C += $(wildcard $(SDIR)target/tx/devo/$(TARGET)/*.c) \ $(wildcard $(SDIR)target/drivers/mcu/stm32/*.c) \ $(wildcard $(SDIR)target/drivers/storage/*.c) \ $(wildcard $(SDIR)target/drivers/indicators/*.c) \ @@ -31,7 +33,7 @@ SRC_C = $(wildcard $(SDIR)target/tx/devo/$(TARGET)/*.c) \ $(SDIR)target/drivers/input/analog/analog.c ifdef MODULAR -PROTO_EXTRA_C = $(wildcard $(SDIR)target/tx/devo/common/protocol/*.c) \ +PROTO_EXTRA_C += $(wildcard $(SDIR)target/tx/devo/common/protocol/*.c) \ $(SDIR)target/drivers/usb/devo_hid.c \ $(wildcard $(SDIR)protocol/spi/*.c) \ $(SDIR)target/tx/devo/common/module_signature.c \ @@ -40,7 +42,7 @@ else SRC_C += $(wildcard $(SDIR)target/tx/devo/common/protocol/*.c) endif -CFLAGS = -D"assert_param(x)=" -DSTM32F10X_HD -DSTM32F1 -mcpu=cortex-m3 -mthumb -mfix-cortex-m3-ldrd -fdata-sections -I$(SDIR)target/tx/devo/common -I$(SDIR)libopencm3/include -I$(SDIR)target/drivers/filesystems -fno-builtin-printf -Os --specs=nano.specs +CFLAGS += -D"assert_param(x)=" -DSTM32F10X_HD -DSTM32F1 -mcpu=cortex-m3 -mthumb -mfix-cortex-m3-ldrd -fdata-sections -I$(SDIR)target/tx/devo/common -I$(SDIR)libopencm3/include -I$(SDIR)target/drivers/filesystems -fno-builtin-printf -Os --specs=nano.specs ifeq "$(HAS_4IN1_FLASH)" "1" CFLAGS += -D"HAS_4IN1_FLASH=1" endif @@ -53,7 +55,7 @@ endif MODULE_CFLAGS := -fno-builtin #LFLAGS = -nostartfiles -Wl,-gc-sections -Wl,-Map=$(TARGET).map,--cref -nostdlib -LFLAGS = -nostartfiles -Wl,-gc-sections -Wl,-Map=$(SDIR)$(TARGET).map,--cref -lc -lnosys -L$(SDIR) -L$(SDIR)protocol -L$(SDIR)objs/$(TARGET) -Wl,-warn-common +LFLAGS = -nostartfiles -Wl,-gc-sections -Wl,-Map=$(SDIR)$(TARGET).map,--cref -lc -lnosys -L$(SDIR) -L$(SDIR)protocol -L$(ODIR) -Wl,-warn-common LINKFILE = $(SDIR)target/tx/devo/$(TARGET)/$(TARGET).ld LFLAGS2 = -Wl,-T$(LINKFILE) diff --git a/src/target/tx/devo/devo10/Makefile b/src/target/tx/devo/devo10/Makefile index c53ad3faa6..055c31d293 100644 --- a/src/target/tx/devo/devo10/Makefile +++ b/src/target/tx/devo/devo10/Makefile @@ -8,4 +8,7 @@ LANGUAGE := devo10 OPTIMIZE_DFU := 1 +TARGET=devo10 + include $(SDIR)/target/tx/devo/common/Makefile.inc +include $(SDIR)/Makefile.inc diff --git a/src/target/tx/devo/devo12/Makefile b/src/target/tx/devo/devo12/Makefile index 6da3707966..e3adb40f1c 100644 --- a/src/target/tx/devo/devo12/Makefile +++ b/src/target/tx/devo/devo12/Makefile @@ -8,12 +8,14 @@ LANGUAGE := devo8,devo12 OPTIMIZE_DFU := 1 +TARGET=devo12 + include $(SDIR)/target/tx/devo/common/Makefile.inc +include $(SDIR)/Makefile.inc -ifndef BUILD_TARGET ALL += $(TARGET)-lib.dfu MEDIA_FILES = -else + $(TARGET)-lib.dfu: $(LAST_MODEL) $(TARGET).dfu $(PRE_FS) /bin/rm -rf $(ODIR)/filesystem 2> /dev/null; true /bin/mkdir $(ODIR)/filesystem @@ -41,5 +43,3 @@ endif zip -u deviation-$(HGVERSION).zip debug-$(HGVERSION).zip rm -f debug-$(HGVERSION).zip rm -f deviation-$(HGVERSION).dfu - -endif #BUILD_TARGET diff --git a/src/target/tx/devo/devo12e/Makefile b/src/target/tx/devo/devo12e/Makefile index 4c39ec597b..dddaadf6dc 100644 --- a/src/target/tx/devo/devo12e/Makefile +++ b/src/target/tx/devo/devo12e/Makefile @@ -6,7 +6,7 @@ FONTS = filesystem/$(FILESYSTEM)/media/12normal.fon \ filesystem/$(FILESYSTEM)/media/04b03.fon LANGUAGE := devo10 -include $(SDIR)/target/tx/devo/common/Makefile.inc +TARGET=devo12e -ifndef BUILD_TARGET -endif +include $(SDIR)/target/tx/devo/common/Makefile.inc +include $(SDIR)/Makefile.inc \ No newline at end of file diff --git a/src/target/tx/devo/devo6/Makefile b/src/target/tx/devo/devo6/Makefile index e4d21f7eef..8ccc3a9c3d 100644 --- a/src/target/tx/devo/devo6/Makefile +++ b/src/target/tx/devo/devo6/Makefile @@ -6,7 +6,7 @@ FONTS = filesystem/$(FILESYSTEM)/media/15normal.fon \ filesystem/$(FILESYSTEM)/media/23bold.fon LANGUAGE := devo8 -include $(SDIR)/target/tx/devo/common/Makefile.inc +TARGET=devo6 -ifndef BUILD_TARGET -endif +include $(SDIR)/target/tx/devo/common/Makefile.inc +include $(SDIR)/Makefile.inc \ No newline at end of file diff --git a/src/target/tx/devo/devo7e-256/Makefile b/src/target/tx/devo/devo7e-256/Makefile index 8b4451ea24..e7b69077e1 100644 --- a/src/target/tx/devo/devo7e-256/Makefile +++ b/src/target/tx/devo/devo7e-256/Makefile @@ -8,17 +8,16 @@ LANGUAGE := devo10 OPTIMIZE_DFU := 1 -include $(SDIR)/target/tx/devo/common/Makefile.inc - -ifndef BUILD_TARGET - +TARGET=devo7e-256 SRC_C += $(SDIR)/target/tx/devo/devo7e/crc.c -else +include $(SDIR)/target/tx/devo/common/Makefile.inc +include $(SDIR)/Makefile.inc + $(TARGET).fs_wrapper: $(LAST_MODEL) perl -p -i -e 's/; has_pa-cyrf6936 = 1/ has_pa-cyrf6936 = 0/' filesystem/$(FILESYSTEM)/hardware.ini perl -p -i -e 's/;switch_types: 3x2, 3x1, 2x2/;switch_types: 3x4, 3x3, 3x2, 3x1, 2x8, 2x7, 2x6, 2x5, 2x4, 2x3, 2x2, 2x1, potx2, potx1\n;May occur more than once if necessary.\n;Add nostock if stock FMOD and HOLD switches have been removed./' filesystem/$(FILESYSTEM)/hardware.ini perl -p -i -e 's/;extra-switches=/; extra-switches = nostock\n; extra-switches = 3x4\n; extra-switches = 2x2\n; extra-switches = potx2/' filesystem/$(FILESYSTEM)/hardware.ini -endif + diff --git a/src/target/tx/devo/devo7e/Makefile b/src/target/tx/devo/devo7e/Makefile index 3f601efe46..d442253905 100644 --- a/src/target/tx/devo/devo7e/Makefile +++ b/src/target/tx/devo/devo7e/Makefile @@ -10,10 +10,10 @@ MODULAR := 0x20004000 DFU_ARGS := -c 7 -b 0x08003000 ENABLE_LTO := 1 +TARGET=devo7e + include $(SDIR)/target/tx/devo/common/Makefile.inc +include $(SDIR)/Makefile.inc -ifdef BUILD_TARGET $(TARGET).fs_wrapper: $(LAST_MODEL) perl -p -i -e 's/; has_pa-cyrf6936 = 1/ has_pa-cyrf6936 = 0/' filesystem/$(FILESYSTEM)/hardware.ini - -endif diff --git a/src/target/tx/devo/devo8/Makefile b/src/target/tx/devo/devo8/Makefile index 35abf3a914..2e9fcbec3c 100644 --- a/src/target/tx/devo/devo8/Makefile +++ b/src/target/tx/devo/devo8/Makefile @@ -1,4 +1,3 @@ -TARGET=devo8 FILESYSTEMS := common base_fonts 320x240x16 SCREENSIZE := 320x240x16 DISPLAY_DRIVER := 8080/320x240x16.c @@ -9,5 +8,7 @@ LANGUAGE := devo8 OPTIMIZE_DFU := 1 +TARGET=devo8 + include $(SDIR)/target/tx/devo/common/Makefile.inc include $(SDIR)/Makefile.inc \ No newline at end of file diff --git a/src/target/tx/devo/devof12e-XMS/Makefile b/src/target/tx/devo/devof12e-XMS/Makefile index 663b53a127..f699cca9df 100644 --- a/src/target/tx/devo/devof12e-XMS/Makefile +++ b/src/target/tx/devo/devof12e-XMS/Makefile @@ -7,18 +7,16 @@ FONTS = filesystem/$(FILESYSTEM)/media/f12e.fon OPTIMIZE_DFU := 1 -include $(SDIR)/target/tx/devo/common/Makefile.inc +SRC_C += $(SDIR)target/tx/devo/devof12e/channels.c \ + $(SDIR)target/tx/devo/devof12e/crc.c \ + $(SDIR)target/tx/devo/devof12e/lcd.c \ + $(SDIR)target/tx/devo/devof12e/mapped_gfx.c -ifndef BUILD_TARGET +TARGET=devof12e-XMS -SRC_C += $(SDIR)/target/tx/devo/devof12e/channels.c \ - $(SDIR)/target/tx/devo/devof12e/crc.c \ - $(SDIR)/target/tx/devo/devof12e/lcd.c \ - $(SDIR)/target/tx/devo/devof12e/mapped_gfx.c - -else +include $(SDIR)target/tx/devo/common/Makefile.inc +include $(SDIR)Makefile.inc $(TARGET).fs_wrapper: $(LAST_MODEL) perl -p -i -e 's/=12normal/=f12e/' filesystem/$(FILESYSTEM)/media/config.ini -endif diff --git a/src/target/tx/devo/devof4-XMS/Makefile b/src/target/tx/devo/devof4-XMS/Makefile index 3445c0d952..73462ac32a 100644 --- a/src/target/tx/devo/devof4-XMS/Makefile +++ b/src/target/tx/devo/devof4-XMS/Makefile @@ -6,10 +6,9 @@ OPTIMIZE_DFU := 1 MODULAR := 0x20004000 DFU_ARGS := -c 4 -b 0x08003000 -include target/tx/devo/common/Makefile.inc - -ifndef BUILD_TARGET - SRC_C += $(SDIR)/target/tx/devo/devof7/crc.c -endif +TARGET=devof4-XMS + +include $(SDIR)target/tx/devo/common/Makefile.inc +include $(SDIR)Makefile.inc diff --git a/src/target/tx/devo/devof4/Makefile b/src/target/tx/devo/devof4/Makefile index 6645d00fdf..449da4a5b3 100644 --- a/src/target/tx/devo/devof4/Makefile +++ b/src/target/tx/devo/devof4/Makefile @@ -11,17 +11,16 @@ PRE_FS = $(ODIR)/.pre_fs INCLUDE_FS := 0 -include target/tx/devo/common/Makefile.inc -include target/tx/devo/common/Makefile.devofs.inc - -ifndef BUILD_TARGET - MEDIA_FILES = NUM_MODELS ?= 10 SRC_C += $(SDIR)/target/tx/devo/devof7/crc.c -else +TARGET=devof4 + +include $(SDIR)target/tx/devo/common/Makefile.inc +include $(SDIR)target/tx/devo/common/Makefile.devofs.inc +include $(SDIR)Makefile.inc #$(TARGET)-lib.dfu: $(wildcard filesystem/devof7/media/*.*) $(TARGET).dfu $(PRE_FS) $(TARGET).fs_wrapper # target/common/devo/devofs/buildfs.pl -invert filesystem/devof7 > $(ODIR)/$(TARGET)-lib.bin @@ -31,4 +30,3 @@ else $(TARGET).fs_wrapper: $(LAST_MODEL) rm filesystem/$(FILESYSTEM)/datalog.bin -endif diff --git a/src/target/tx/devo/devof7-XMS/Makefile b/src/target/tx/devo/devof7-XMS/Makefile index eef59ec055..1920d92b3e 100644 --- a/src/target/tx/devo/devof7-XMS/Makefile +++ b/src/target/tx/devo/devof7-XMS/Makefile @@ -6,11 +6,10 @@ OPTIMIZE_DFU := 1 MODULAR := 0x20004000 DFU_ARGS := -c 7 -b 0x08003000 -include target/tx/devo/common/Makefile.inc - -ifndef BUILD_TARGET - SRC_C += $(SDIR)/target/tx/devo/devof7/channels.c \ $(SDIR)/target/tx/devo/devof7/crc.c -endif +TARGET=devof7-XMS + +include $(SDIR)/target/tx/devo/common/Makefile.inc +include $(SDIR)/Makefile.inc \ No newline at end of file diff --git a/src/target/tx/devo/devof7/Makefile b/src/target/tx/devo/devof7/Makefile index 29d1856619..fe55b5c673 100644 --- a/src/target/tx/devo/devof7/Makefile +++ b/src/target/tx/devo/devof7/Makefile @@ -9,17 +9,16 @@ DFU_ARGS := -c 7 -b 0x08003000 PRE_FS = $(ODIR)/.pre_fs -INCLUDE_FS := 0 - -include target/tx/devo/common/Makefile.inc -include target/tx/devo/common/Makefile.devofs.inc - -ifndef BUILD_TARGET - MEDIA_FILES = NUM_MODELS ?= 10 -else +INCLUDE_FS := 0 + +TARGET=devof7 + +include $(SDIR)target/tx/devo/common/Makefile.inc +include $(SDIR)target/tx/devo/common/Makefile.devofs.inc +include $(SDIR)Makefile.inc #$(TARGET)-lib.dfu: $(wildcard filesystem/devof7/media/*.*) $(TARGET).dfu $(PRE_FS) $(TARGET).fs_wrapper # target/tx/devo/common/devofs/buildfs.pl -invert filesystem/devof7 > $(ODIR)/$(TARGET)-lib.bin @@ -29,4 +28,3 @@ else $(TARGET).fs_wrapper: $(LAST_MODEL) rm filesystem/$(FILESYSTEM)/datalog.bin -endif diff --git a/src/target/tx/devo/emu_devo10/Makefile b/src/target/tx/devo/emu_devo10/Makefile index 7653e8d659..456c6b8fa6 100644 --- a/src/target/tx/devo/emu_devo10/Makefile +++ b/src/target/tx/devo/emu_devo10/Makefile @@ -4,4 +4,8 @@ FONTS = filesystem/$(FILESYSTEM)/media/12normal.fon \ filesystem/$(FILESYSTEM)/media/04b03.fon LANGUAGE := devo10 -include target/drivers/mcu/emu/Makefile.inc +TARGET = emu_devo10 +FAMILY = devo + +include $(SDIR)/target/drivers/mcu/emu/Makefile.inc +include $(SDIR)/Makefile.inc \ No newline at end of file diff --git a/src/target/tx/devo/emu_devo12/Makefile b/src/target/tx/devo/emu_devo12/Makefile index 1a0ab7fb82..98394a0884 100644 --- a/src/target/tx/devo/emu_devo12/Makefile +++ b/src/target/tx/devo/emu_devo12/Makefile @@ -4,4 +4,8 @@ FONTS = filesystem/$(FILESYSTEM)/media/15normal.fon \ filesystem/$(FILESYSTEM)/media/23bold.fon LANGUAGE := devo8,devo12 -include target/drivers/mcu/emu/Makefile.inc +TARGET = emu_devo12 +FAMILY = devo + +include $(SDIR)/target/drivers/mcu/emu/Makefile.inc +include $(SDIR)/Makefile.inc \ No newline at end of file diff --git a/src/target/tx/devo/emu_devo12e/Makefile b/src/target/tx/devo/emu_devo12e/Makefile index 7653e8d659..ffecc4b3cd 100644 --- a/src/target/tx/devo/emu_devo12e/Makefile +++ b/src/target/tx/devo/emu_devo12e/Makefile @@ -4,4 +4,8 @@ FONTS = filesystem/$(FILESYSTEM)/media/12normal.fon \ filesystem/$(FILESYSTEM)/media/04b03.fon LANGUAGE := devo10 -include target/drivers/mcu/emu/Makefile.inc +TARGET = emu_devo12e +FAMILY = devo + +include $(SDIR)/target/drivers/mcu/emu/Makefile.inc +include $(SDIR)/Makefile.inc \ No newline at end of file diff --git a/src/target/tx/devo/emu_devo6/Makefile b/src/target/tx/devo/emu_devo6/Makefile index 7314d25d56..21bff12a00 100644 --- a/src/target/tx/devo/emu_devo6/Makefile +++ b/src/target/tx/devo/emu_devo6/Makefile @@ -4,4 +4,8 @@ FONTS = filesystem/$(FILESYSTEM)/media/15normal.fon \ filesystem/$(FILESYSTEM)/media/23bold.fon LANGUAGE :=devo8 -include target/drivers/mcu/emu/Makefile.inc +TARGET = emu_devo6 +FAMILY = devo + +include $(SDIR)/target/drivers/mcu/emu/Makefile.inc +include $(SDIR)/Makefile.inc \ No newline at end of file diff --git a/src/target/tx/devo/emu_devo7e-256/Makefile b/src/target/tx/devo/emu_devo7e-256/Makefile index d8c1535339..0450313077 100644 --- a/src/target/tx/devo/emu_devo7e-256/Makefile +++ b/src/target/tx/devo/emu_devo7e-256/Makefile @@ -4,11 +4,13 @@ FONTS = filesystem/$(FILESYSTEM)/media/12normal.fon \ filesystem/$(FILESYSTEM)/media/04b03.fon LANGUAGE := devo10 -include target/drivers/mcu/emu/Makefile.inc +TARGET = emu_devo7e-256 +FAMILY = devo + +include $(SDIR)/target/drivers/mcu/emu/Makefile.inc +include $(SDIR)/Makefile.inc -ifdef BUILD_TARGET $(TARGET).fs_wrapper: $(LAST_MODEL) perl -p -i -e 's/; has_pa-cyrf6936 = 1/ has_pa-cyrf6936 = 0/' filesystem/$(FILESYSTEM)/hardware.ini perl -p -i -e 's/;switch_types: 3x2, 3x1, 2x2/;switch_types: 3x4, 3x3, 3x2, 3x1, 2x8, 2x7, 2x6, 2x5, 2x4, 2x3, 2x2, 2x1, potx2, potx1\n;May occur more than once if necessary.\n;Add nostock if stock FMOD and HOLD switches have been removed./' filesystem/$(FILESYSTEM)/hardware.ini perl -p -i -e 's/;extra-switches=/; extra-switches = nostock\n; extra-switches = 3x4\n; extra-switches = 2x2\n; extra-switches = potx2/' filesystem/$(FILESYSTEM)/hardware.ini -endif diff --git a/src/target/tx/devo/emu_devo7e/Makefile b/src/target/tx/devo/emu_devo7e/Makefile index 7cc08f2353..89c353d90d 100644 --- a/src/target/tx/devo/emu_devo7e/Makefile +++ b/src/target/tx/devo/emu_devo7e/Makefile @@ -4,9 +4,11 @@ FONTS = filesystem/$(FILESYSTEM)/media/12normal.fon \ filesystem/$(FILESYSTEM)/media/04b03.fon LANGUAGE = devo10 -include target/drivers/mcu/emu/Makefile.inc +TARGET = emu_devo7e +FAMILY = devo + +include $(SDIR)/target/drivers/mcu/emu/Makefile.inc +include $(SDIR)/Makefile.inc -ifdef BUILD_TARGET $(TARGET).fs_wrapper: $(LAST_MODEL) perl -p -i -e 's/; has_pa-cyrf6936 = 1/ has_pa-cyrf6936 = 0/' filesystem/$(FILESYSTEM)/hardware.ini -endif diff --git a/src/target/tx/devo/emu_devof12e-XMS/Makefile b/src/target/tx/devo/emu_devof12e-XMS/Makefile index c70bea2db5..4da4f8eb7c 100644 --- a/src/target/tx/devo/emu_devof12e-XMS/Makefile +++ b/src/target/tx/devo/emu_devof12e-XMS/Makefile @@ -3,11 +3,20 @@ FILESYSTEMS := common text text_gfx LANGUAGE := devo10 FONTS = filesystem/$(FILESYSTEM)/media/f12e.fon -include target/drivers/mcu/emu/Makefile.inc +TARGET = emu_devof12e-XMS +FAMILY = devo -ifdef BUILD_TARGET +SRC_C += $(SDIR)target/tx/devo/devof12e/lcd.c \ + $(SDIR)target/tx/devo/devof12e/mapped_gfx.c \ + $(SDIR)target/tx/devo/emu_devof12e/channels.c \ + $(SDIR)target/tx/devo/emu_devof12e/tw8816.c \ + $(SDIR)target/tx/devo/emu_devof12e/tw8816_map.c + +CFLAGS += -I$(SDIR)target/tx/devo/emu_devof12e + +include $(SDIR)target/drivers/mcu/emu/Makefile.inc +include $(SDIR)Makefile.inc $(TARGET).fs_wrapper: $(LAST_MODEL) perl -p -i -e 's/=12normal/=f12e/' filesystem/$(FILESYSTEM)/media/config.ini -endif diff --git a/src/target/tx/devo/emu_devof12e-XMS/capabilities.h b/src/target/tx/devo/emu_devof12e-XMS/capabilities.h deleted file mode 100644 index 79901c5090..0000000000 --- a/src/target/tx/devo/emu_devof12e-XMS/capabilities.h +++ /dev/null @@ -1 +0,0 @@ -#include "../devof12e/capabilities.h" diff --git a/src/target/tx/devo/emu_devof12e-XMS/channels.c b/src/target/tx/devo/emu_devof12e-XMS/channels.c deleted file mode 100644 index dc018fa70f..0000000000 --- a/src/target/tx/devo/emu_devof12e-XMS/channels.c +++ /dev/null @@ -1 +0,0 @@ -#include "../emu_devof12e/channels.c" diff --git a/src/target/tx/devo/emu_devof12e-XMS/char_map.h b/src/target/tx/devo/emu_devof12e-XMS/char_map.h deleted file mode 100644 index aa1ed4b515..0000000000 --- a/src/target/tx/devo/emu_devof12e-XMS/char_map.h +++ /dev/null @@ -1 +0,0 @@ -#include "../devof12e/char_map.h" diff --git a/src/target/tx/devo/emu_devof12e-XMS/lcd.c b/src/target/tx/devo/emu_devof12e-XMS/lcd.c deleted file mode 100644 index 350f9eae90..0000000000 --- a/src/target/tx/devo/emu_devof12e-XMS/lcd.c +++ /dev/null @@ -1 +0,0 @@ -#include "../emu_devof12e/lcd.c" diff --git a/src/target/tx/devo/emu_devof12e-XMS/lcd.h b/src/target/tx/devo/emu_devof12e-XMS/lcd.h deleted file mode 100644 index 1dfe05cc78..0000000000 --- a/src/target/tx/devo/emu_devof12e-XMS/lcd.h +++ /dev/null @@ -1 +0,0 @@ -#include "../emu_devof12e/lcd.h" diff --git a/src/target/tx/devo/emu_devof12e-XMS/lcd_page_props.h b/src/target/tx/devo/emu_devof12e-XMS/lcd_page_props.h deleted file mode 100644 index c97e16061b..0000000000 --- a/src/target/tx/devo/emu_devof12e-XMS/lcd_page_props.h +++ /dev/null @@ -1 +0,0 @@ -#include "../devof12e/lcd_page_props.h" diff --git a/src/target/tx/devo/emu_devof12e-XMS/mapped_gfx.c b/src/target/tx/devo/emu_devof12e-XMS/mapped_gfx.c deleted file mode 100644 index 0000d29cf0..0000000000 --- a/src/target/tx/devo/emu_devof12e-XMS/mapped_gfx.c +++ /dev/null @@ -1 +0,0 @@ -#include "../devof12e/mapped_gfx.c" diff --git a/src/target/tx/devo/emu_devof12e-XMS/tw8816.c b/src/target/tx/devo/emu_devof12e-XMS/tw8816.c deleted file mode 100644 index c73a03abee..0000000000 --- a/src/target/tx/devo/emu_devof12e-XMS/tw8816.c +++ /dev/null @@ -1 +0,0 @@ -#include "../emu_devof12e/tw8816.c" diff --git a/src/target/tx/devo/emu_devof12e-XMS/tw8816_map.c b/src/target/tx/devo/emu_devof12e-XMS/tw8816_map.c deleted file mode 100644 index 879296892e..0000000000 --- a/src/target/tx/devo/emu_devof12e-XMS/tw8816_map.c +++ /dev/null @@ -1 +0,0 @@ -#include "target/drivers/display/i2c/tw8816_map.h" diff --git a/src/target/tx/devo/emu_devof12e/Makefile b/src/target/tx/devo/emu_devof12e/Makefile index 803cdc4c09..ea654cff52 100644 --- a/src/target/tx/devo/emu_devof12e/Makefile +++ b/src/target/tx/devo/emu_devof12e/Makefile @@ -2,5 +2,8 @@ SCREENSIZE := text NUM_MODELS ?= 10 FILESYSTEMS := common text text_gfx +TARGET = emu_devof12e +FAMILY = devo -include target/drivers/mcu/emu/Makefile.inc +include $(SDIR)/target/drivers/mcu/emu/Makefile.inc +include $(SDIR)/Makefile.inc \ No newline at end of file diff --git a/src/target/tx/devo/emu_devof7/Makefile b/src/target/tx/devo/emu_devof7/Makefile index d2d868ba6a..cae364d797 100644 --- a/src/target/tx/devo/emu_devof7/Makefile +++ b/src/target/tx/devo/emu_devof7/Makefile @@ -2,5 +2,11 @@ SCREENSIZE := text NUM_MODELS ?= 10 FILESYSTEMS := common text +TARGET = emu_devof7 +FAMILY = devo -include target/drivers/mcu/emu/Makefile.inc +SRC += $(SDIR)/target/tx/devo/devof7/ia9211_map.c +CFLAGS +=-I$(SDIR)/target/drivers/display/spi/ + +include $(SDIR)/target/drivers/mcu/emu/Makefile.inc +include $(SDIR)/Makefile.inc \ No newline at end of file diff --git a/src/target/tx/devo/emu_devof7/ia9211_map.c b/src/target/tx/devo/emu_devof7/ia9211_map.c deleted file mode 100644 index a99285ae8a..0000000000 --- a/src/target/tx/devo/emu_devof7/ia9211_map.c +++ /dev/null @@ -1 +0,0 @@ -#include "../devof7/ia9211_map.c" diff --git a/src/target/tx/devo/emu_devof7/lcd.c b/src/target/tx/devo/emu_devof7/lcd.c index 73465c5c26..835fa731d7 100644 --- a/src/target/tx/devo/emu_devof7/lcd.c +++ b/src/target/tx/devo/emu_devof7/lcd.c @@ -21,6 +21,7 @@ #include "lcd.h" #include "ia9211_font.h" #include "ia9211_bigfont.h" +#include "ia9211_map.h" struct rgb { u8 r; diff --git a/src/target/tx/devo/emu_t8sg/Makefile b/src/target/tx/devo/emu_t8sg/Makefile index d13aac908e..c0515491fa 100644 --- a/src/target/tx/devo/emu_t8sg/Makefile +++ b/src/target/tx/devo/emu_t8sg/Makefile @@ -4,9 +4,12 @@ FONTS = filesystem/$(FILESYSTEM)/media/12normal.fon \ filesystem/$(FILESYSTEM)/media/04b03.fon LANGUAGE := devo10 -include target/drivers/mcu/emu/Makefile.inc +TARGET = emu_t8sg +FAMILY = devo + +include $(SDIR)/target/drivers/mcu/emu/Makefile.inc +include $(SDIR)/Makefile.inc -ifdef BUILD_TARGET $(TARGET).fs_wrapper: $(LAST_MODEL) perl -p -i -e 's/; enable-a7105 = A13/ enable-a7105 = A13/' filesystem/$(FILESYSTEM)/hardware.ini perl -p -i -e 's/; has_pa-a7105 = 1/ has_pa-a7105 = 1/' filesystem/$(FILESYSTEM)/hardware.ini @@ -17,4 +20,3 @@ $(TARGET).fs_wrapper: $(LAST_MODEL) perl -p -i -e 's/;switch_types: 3x2, 3x1, 2x2/;switch_types: 3x4, 3x3, 3x2, 3x1, 2x8, 2x7, 2x6, 2x5, 2x4, 2x3, 2x2, 2x1, potx2, potx1\n;May occur more than once if necessary.\n;Add nostock if stock FMOD and HOLD switches have been removed./' filesystem/$(FILESYSTEM)/hardware.ini perl -p -i -e 's/;extra-switches=/ extra-switches = nostock\n extra-switches = 3x4\n; extra-switches = 2x2\n extra-switches = potx2/' filesystem/$(FILESYSTEM)/hardware.ini rm -f filesystem/$(FILESYSTEM)/hardware.ini.bak -endif diff --git a/src/target/tx/devo/emu_t8sg_v2/Makefile b/src/target/tx/devo/emu_t8sg_v2/Makefile index a483c567bb..7becc1fee9 100644 --- a/src/target/tx/devo/emu_t8sg_v2/Makefile +++ b/src/target/tx/devo/emu_t8sg_v2/Makefile @@ -4,9 +4,12 @@ FONTS = filesystem/$(FILESYSTEM)/media/12normal.fon \ filesystem/$(FILESYSTEM)/media/04b03.fon LANGUAGE := devo10 -include target/drivers/mcu/emu/Makefile.inc +TARGET = emu_t8sg_v2 +FAMILY = devo + +include $(SDIR)/target/drivers/mcu/emu/Makefile.inc +include $(SDIR)/Makefile.inc -ifdef BUILD_TARGET $(TARGET).fs_wrapper: $(LAST_MODEL) perl -p -i -e 's/; enable-a7105 = A13/ enable-a7105 = A13/' filesystem/$(FILESYSTEM)/hardware.ini perl -p -i -e 's/; has_pa-a7105 = 1/ has_pa-a7105 = 1/' filesystem/$(FILESYSTEM)/hardware.ini @@ -17,4 +20,3 @@ $(TARGET).fs_wrapper: $(LAST_MODEL) perl -p -i -e 's/;switch_types: 3x2, 3x1, 2x2/;switch_types: 3x4, 3x3, 3x2, 3x1, 2x8, 2x7, 2x6, 2x5, 2x4, 2x3, 2x2, 2x1, potx2, potx1\n;May occur more than once if necessary.\n;Add nostock if stock FMOD and HOLD switches have been removed./' filesystem/$(FILESYSTEM)/hardware.ini perl -p -i -e 's/;extra-switches=/ extra-switches = nostock\n extra-switches = 3x4\n extra-switches = 2x2\n extra-switches = potx2/' filesystem/$(FILESYSTEM)/hardware.ini rm -f filesystem/$(FILESYSTEM)/hardware.ini.bak -endif diff --git a/src/target/tx/devo/ir8m/Makefile b/src/target/tx/devo/ir8m/Makefile index 367db43209..993e334177 100644 --- a/src/target/tx/devo/ir8m/Makefile +++ b/src/target/tx/devo/ir8m/Makefile @@ -7,9 +7,10 @@ LANGUAGE := devo10 OPTIMIZE_DFU := 1 -include $(SDIR)/target/tx/devo/common/Makefile.inc +TARGET := ir8m -ifdef BUILD_TARGET +include $(SDIR)target/tx/devo/common/Makefile.inc +include $(SDIR)/Makefile.inc $(TARGET).fs_wrapper: $(LAST_MODEL) perl -p -i -e 's/; enable-a7105 = A13/ enable-a7105 = A13/' filesystem/$(FILESYSTEM)/hardware.ini @@ -21,5 +22,3 @@ $(TARGET).fs_wrapper: $(LAST_MODEL) perl -p -i -e 's/;switch_types: 3x2, 3x1, 2x2/;switch_types: 3x4, 3x3, 3x2, 3x1, 2x8, 2x7, 2x6, 2x5, 2x4, 2x3, 2x2, 2x1, potx2, potx1\n;May occur more than once if necessary.\n;Add nostock if stock FMOD and HOLD switches have been removed./' filesystem/$(FILESYSTEM)/hardware.ini perl -p -i -e 's/;extra-switches=/ extra-switches = nostock\n extra-switches = 3x4\n; extra-switches = 2x2\n extra-switches = potx2/' filesystem/$(FILESYSTEM)/hardware.ini rm -f filesystem/$(FILESYSTEM)/hardware.ini.bak - -endif diff --git a/src/target/tx/devo/t8sg/Makefile b/src/target/tx/devo/t8sg/Makefile index 469f09d1ac..3adb7f912e 100644 --- a/src/target/tx/devo/t8sg/Makefile +++ b/src/target/tx/devo/t8sg/Makefile @@ -8,9 +8,10 @@ LANGUAGE := devo10 OPTIMIZE_DFU := 1 -include $(SDIR)/target/tx/devo/common/Makefile.inc +TARGET := t8sg -ifdef BUILD_TARGET +include $(SDIR)target/tx/devo/common/Makefile.inc +include $(SDIR)/Makefile.inc $(TARGET).fs_wrapper: $(LAST_MODEL) perl -p -i -e 's/; enable-a7105 = A13/ enable-a7105 = A13/' filesystem/$(FILESYSTEM)/hardware.ini @@ -22,5 +23,3 @@ $(TARGET).fs_wrapper: $(LAST_MODEL) perl -p -i -e 's/;switch_types: 3x2, 3x1, 2x2/;switch_types: 3x4, 3x3, 3x2, 3x1, 2x8, 2x7, 2x6, 2x5, 2x4, 2x3, 2x2, 2x1, potx2, potx1\n;May occur more than once if necessary.\n;Add nostock if stock FMOD and HOLD switches have been removed./' filesystem/$(FILESYSTEM)/hardware.ini perl -p -i -e 's/;extra-switches=/ extra-switches = nostock\n extra-switches = 3x4\n; extra-switches = 2x2\n extra-switches = potx2/' filesystem/$(FILESYSTEM)/hardware.ini rm -f filesystem/$(FILESYSTEM)/hardware.ini.bak - -endif diff --git a/src/target/tx/devo/t8sg_v2/Makefile b/src/target/tx/devo/t8sg_v2/Makefile index 2bebf9a46e..1c52b91f6a 100644 --- a/src/target/tx/devo/t8sg_v2/Makefile +++ b/src/target/tx/devo/t8sg_v2/Makefile @@ -8,9 +8,10 @@ LANGUAGE := devo10 OPTIMIZE_DFU := 1 -include $(SDIR)/target/tx/devo/common/Makefile.inc +TARGET := t8sg_v2 -ifdef BUILD_TARGET +include $(SDIR)target/tx/devo/common/Makefile.inc +include $(SDIR)/Makefile.inc $(TARGET).fs_wrapper: $(LAST_MODEL) perl -p -i -e 's/; enable-a7105 = A13/ enable-a7105 = A13/' filesystem/$(FILESYSTEM)/hardware.ini @@ -21,6 +22,4 @@ $(TARGET).fs_wrapper: $(LAST_MODEL) perl -p -i -e 's/; has_pa-nrf24l01 = 1/ has_pa-nrf24l01 = 1/' filesystem/$(FILESYSTEM)/hardware.ini perl -p -i -e 's/;switch_types: 3x2, 3x1, 2x2/;switch_types: 3x4, 3x3, 3x2, 3x1, 2x8, 2x7, 2x6, 2x5, 2x4, 2x3, 2x2, 2x1, potx2, potx1\n;May occur more than once if necessary.\n;Add nostock if stock FMOD and HOLD switches have been removed./' filesystem/$(FILESYSTEM)/hardware.ini perl -p -i -e 's/;extra-switches=/ extra-switches = nostock\n extra-switches = 3x4\n extra-switches = 2x2\n extra-switches = potx2/' filesystem/$(FILESYSTEM)/hardware.ini - rm -f filesystem/$(FILESYSTEM)/hardware.ini.bak - -endif + rm -f filesystem/$(FILESYSTEM)/hardware.ini.bak \ No newline at end of file diff --git a/src/target/tx/devo/t8sg_v2_plus/Makefile b/src/target/tx/devo/t8sg_v2_plus/Makefile index 04b33d1c12..0524be3e18 100644 --- a/src/target/tx/devo/t8sg_v2_plus/Makefile +++ b/src/target/tx/devo/t8sg_v2_plus/Makefile @@ -8,9 +8,10 @@ LANGUAGE := devo10 OPTIMIZE_DFU := 1 -include $(SDIR)/target/tx/devo/common/Makefile.inc +TARGET := t8sg_v2_plus -ifdef BUILD_TARGET +include $(SDIR)target/tx/devo/common/Makefile.inc +include $(SDIR)/Makefile.inc $(TARGET).fs_wrapper: $(LAST_MODEL) perl -p -i -e 's/; enable-a7105 = A13/ enable-a7105 = A13/' filesystem/$(FILESYSTEM)/hardware.ini @@ -22,5 +23,3 @@ $(TARGET).fs_wrapper: $(LAST_MODEL) perl -p -i -e 's/;switch_types: 3x2, 3x1, 2x2/;switch_types: 3x4, 3x3, 3x2, 3x1, 2x8, 2x7, 2x6, 2x5, 2x4, 2x3, 2x2, 2x1, potx2, potx1\n;May occur more than once if necessary.\n;Add nostock if stock FMOD and HOLD switches have been removed./' filesystem/$(FILESYSTEM)/hardware.ini perl -p -i -e 's/;extra-switches=/ extra-switches = nostock\n extra-switches = 3x4\n extra-switches = 2x2\n extra-switches = potx2/' filesystem/$(FILESYSTEM)/hardware.ini rm -f filesystem/$(FILESYSTEM)/hardware.ini.bak - -endif diff --git a/src/target/tx/opentx/t12/Makefile b/src/target/tx/opentx/t12/Makefile index 2b10f2744b..37233b5d0c 100644 --- a/src/target/tx/opentx/t12/Makefile +++ b/src/target/tx/opentx/t12/Makefile @@ -5,7 +5,8 @@ FONTS = filesystem/$(FILESYSTEM)/media/12normal.fon \ filesystem/$(FILESYSTEM)/media/04b03.fon LANGUAGE := devo10 -ifndef BUILD_TARGET +FAMILY = opentx +TARGET = t12 CROSS = arm-none-eabi- @@ -18,7 +19,7 @@ SRC_C = $(wildcard target/tx/$(FAMILY)/$(TARGET)/*.c) \ $(wildcard target/drivers/mcu/stm32/*.c) \ $(wildcard target/drivers/serial/soft_serial/*.c) \ $(wildcard target/drivers/serial/usb_cdc/*.c) \ - target/drivers/filesystems/FatFs/ff.c \ + target/drivers/filesystems/FatFs/ff.c \ target/drivers/filesystems/FatFs/fattime.c \ target/drivers/filesystems/FatFs/option/ccsbcs.c \ $(wildcard target/drivers/storage/mmc_flash/*.c) \ @@ -41,17 +42,14 @@ LFLAGS2OPT = -Wl,-Ttarget/$(TARGET)/$(TARGET)_opt.ld ALL = $(TARGET).dfu -else #BUILD_TARGET - $(TARGET).bin: $(TARGET).elf $(CP) -O binary $< $@ $(DUMP) -S $< > $(TARGET).list -$(LIBOPENCM3): - make -C libopencm3 TARGETS=stm32/f2 lib +$(SDIR)$(LIBOPENCM3): $(ODIR) + test -s $(SDIR)libopencm3/Makefile || { echo "Fetch libopencm3 via 'git submodule update --init'"; exit 1; } + +$(FLOCKS) $(MAKE) -C $(SDIR)libopencm3 TARGETS=stm32/f2 lib $(TARGET).dfu: $(TARGET).bin ../utils/dfu.py --name "$(HGVERSION) Firmware" $(DFU_ARGS):$< $@ ../utils/get_mem_usage.pl $(TARGET).map - -endif #BUILD_TARGET diff --git a/src/target/tx/radiolink/at10/Makefile b/src/target/tx/radiolink/at10/Makefile index 75f268fac7..55c9c00bb3 100644 --- a/src/target/tx/radiolink/at10/Makefile +++ b/src/target/tx/radiolink/at10/Makefile @@ -9,10 +9,7 @@ FILESYSTEMS := common base_fonts 320x240x16 else FILESYSTEMS := common base_fonts 320x240x1 endif - -include $(SDIR)/target/tx/radiolink/common/Makefile.inc - -ifndef BUILD_TARGET +TARGET = at10 ALL = $(LIBOPENCM3) $(TARGET).bin $(TARGET).mac @@ -23,11 +20,16 @@ ifneq "$(HAS_4IN1_FLASH)" "1" SRC_C := $(filter-out $(SDIR)/target/common/stm32/spi_flash.c, $(SRC_C)) endif -else #BUILD_TARGET -$(TARGET).mac: $(TARGET).bin +.PHONY: default +default: $(SDIR)$(TARGET).mac + +include $(SDIR)target/tx/radiolink/common/Makefile.inc +include $(SDIR)/Makefile.inc + +$(SDIR)$(TARGET).mac: $(SDIR)$(TARGET).bin cat $(SDIR)/target/tx/radiolink/at10/header.mac $(TARGET).bin > $@ -$(TARGET).bin: $(TARGET).elf $(ODIR)/devo.fs +$(SDIR)$(TARGET).bin: $(SDIR) $(TARGET).elf $(ODIR)/devo.fs $(CP) -O binary $(TARGET).elf $(ODIR)/$@ $(DUMP) -S $(TARGET).elf > $(TARGET).list $(SDIR)/../utils/get_mem_usage.pl $(TARGET).map @@ -42,7 +44,7 @@ $(TARGET).fs_wrapper: $(LAST_MODEL) perl -p -i -e 's/drawn_background=0/drawn_background=1/' filesystem/$(FILESYSTEM)/media/config.ini rm filesystem/$(FILESYSTEM)/datalog.bin -$(TARGET).zip: $(ALL) +$(SDIR)$(TARGET).zip: $(ALL) cp -f $(TARGET).bin deviation-$(HGVERSION).bin cp -f $(TARGET).mac deviation-$(HGVERSION).mac rm -f deviation-$(HGVERSION).zip @@ -51,6 +53,4 @@ $(TARGET).zip: $(ALL) # make zipping more compatible with other distributions zip deviation-$(HGVERSION).zip deviation-$(HGVERSION).mac deviation-$(HGVERSION).bin $(EXTRA_DFUS) zip -u deviation-$(HGVERSION).zip debug-$(HGVERSION).zip - rm -f debug-$(HGVERSION).zip - -endif #BUILD_TARGET + rm -f debug-$(HGVERSION).zip \ No newline at end of file diff --git a/src/target/tx/radiolink/at9/Makefile b/src/target/tx/radiolink/at9/Makefile index 92a3adbf67..412b281de0 100644 --- a/src/target/tx/radiolink/at9/Makefile +++ b/src/target/tx/radiolink/at9/Makefile @@ -12,20 +12,21 @@ endif DFU_ARGS := -D 0x0483:0xdf12 -b 0x08003000 -include $(SDIR)/target/tx/radiolink/common/Makefile.inc - -ifndef BUILD_TARGET ifneq "$(HAS_4IN1_FLASH)" "1" EXTRA_DFUS = $(TARGET)-fs.dfu endif -ALL = $(LIBOPENCM3) $(TARGET).dfu $(EXTRA_DFUS) +.PHONY: default +default: $(SDIR)$(TARGET).dfu + +ALL = $(LIBOPENCM3) $(SDIR).dfu $(EXTRA_DFUS) SRC_C += $(SDIR)/target/drivers/display/8080/320x240x16.c \ $(wildcard $(SDIR)/target/drivers/input/rotary/*.c) -else #BUILD_TARGET +include $(SDIR)/target/tx/radiolink/common/Makefile.inc +include $(SDIR)/Makefile.inc $(TARGET).bin: $(TARGET).elf $(CP) -O binary $< $@ @@ -52,5 +53,3 @@ $(TARGET).zip: $(ALL) zip -u deviation-$(HGVERSION).zip debug-$(HGVERSION).zip rm -f debug-$(HGVERSION).zip rm -f deviation-$(HGVERSION).dfu - -endif #BUILD_TARGET diff --git a/src/target/tx/radiolink/common/Makefile.inc b/src/target/tx/radiolink/common/Makefile.inc index 976b69f9ce..55b350a363 100644 --- a/src/target/tx/radiolink/common/Makefile.inc +++ b/src/target/tx/radiolink/common/Makefile.inc @@ -1,7 +1,11 @@ CROSS = arm-none-eabi- -LINKFILE = $(SDIR)/target/tx/$(FAMILY)/$(TARGET)/$(TARGET).ld -LIBOPENCM3 = $(SDIR)/libopencm3/lib/libopencm3_stm32f1.a +FAMILY = radiolink + +ODIR = $(SDIR)objs/$(TARGET) + +LINKFILE = $(SDIR)target/tx/$(FAMILY)/$(TARGET)/$(TARGET).ld +LIBOPENCM3 = $(SDIR)libopencm3/lib/libopencm3_stm32f1.a ifeq "$(HAS_4IN1_FLASH)" "1" NUM_MODELS ?= 30 @@ -9,46 +13,57 @@ else NUM_MODELS ?= 10 endif -SRC_C := $(wildcard $(SDIR)/target/tx/$(FAMILY)/common/*.c) \ - $(wildcard $(SDIR)/target/tx/$(FAMILY)/$(TARGET)/*.c) \ - $(wildcard $(SDIR)/target/drivers/mcu/stm32/*.c) \ - $(wildcard $(SDIR)/target/drivers/indicators/*.c) \ - $(wildcard $(SDIR)/target/drivers/filesystems/*.c) \ - $(wildcard $(SDIR)/target/drivers/filesystems/devofs/*.c) \ - $(wildcard $(SDIR)/target/drivers/filesystems/petit_fat/*.c) \ - $(wildcard $(SDIR)/target/tx/devo/common/protocol/*.c) \ - $(wildcard $(SDIR)/target/drivers/serial/uart/*.c) \ - $(wildcard $(SDIR)/target/drivers/usb/*.c) \ - $(SDIR)/target/drivers/storage/mcu_flash.c \ - $(SDIR)/target/drivers/backlight/backlight.c \ - $(SDIR)/target/drivers/input/analog/analog.c +SRC_C += $(wildcard $(SDIR)target/tx/$(FAMILY)/common/*.c) \ + $(wildcard $(SDIR)target/tx/$(FAMILY)/$(TARGET)/*.c) \ + $(wildcard $(SDIR)target/drivers/mcu/stm32/*.c) \ + $(wildcard $(SDIR)target/drivers/indicators/*.c) \ + $(wildcard $(SDIR)target/drivers/filesystems/*.c) \ + $(wildcard $(SDIR)target/drivers/filesystems/devofs/*.c) \ + $(wildcard $(SDIR)target/drivers/filesystems/petit_fat/*.c) \ + $(wildcard $(SDIR)target/tx/devo/common/protocol/*.c) \ + $(wildcard $(SDIR)target/drivers/serial/uart/*.c) \ + $(wildcard $(SDIR)target/drivers/usb/*.c) \ + $(SDIR)target/drivers/storage/mcu_flash.c \ + $(SDIR)target/drivers/backlight/backlight.c \ + $(SDIR)target/drivers/input/analog/analog.c + +ifeq ($(OS),Windows_NT) + FLOCKS = +else + FLOCKS = flock $(ODIR)../.lock +endif ifeq "$(HAS_4IN1_FLASH)" "1" -SRC_C += $(SDIR)/target/drivers/storage/spi_flash.c +SRC_C += $(SDIR)target/drivers/storage/spi_flash.c endif -CFLAGS = -D"assert_param(x)=" -DSTM32F10X_HD -DSTM32F1 -mcpu=cortex-m3 -mthumb -mfix-cortex-m3-ldrd -fdata-sections -ffunction-sections -I$(SDIR)/libopencm3/include -I$(SDIR)/target/drivers/filesystems -I$(SDIR)/target/tx/radiolink/common -fno-builtin-printf -Os --specs=nano.specs +CFLAGS = -D"assert_param(x)=" -DSTM32F10X_HD -DSTM32F1 -mcpu=cortex-m3 -mthumb -mfix-cortex-m3-ldrd -fdata-sections -I$(SDIR)libopencm3/include -I$(SDIR)target/drivers/filesystems -I$(SDIR)target/tx/radiolink/common -fno-builtin-printf -Os --specs=nano.specs ifeq "$(HAS_4IN1_FLASH)" "1" CFLAGS += -D"HAS_4IN1_FLASH=1" endif MODULE_CFLAGS = -fno-builtin -LFLAGS = -nostartfiles -Wl,-gc-sections -Wl,-Map=$(TARGET).map,--cref -lc -lnosys -L$(SDIR) -L$(SDIR)/protocol -Lobjs/$(TARGET) +LFLAGS = -nostartfiles -Wl,-gc-sections -Wl,-Map=$(TARGET).map,--cref -lc -lnosys -L$(SDIR) -L$(SDIR)protocol -L$(ODIR) LFLAGS2 = -Wl,-T$(LINKFILE) ifdef ENABLE_LTO CFLAGS += -flto -ffat-lto-objects -fwhole-program -DENABLE_LTO +else +CFLAGS += -ffunction-sections endif ifdef ENABLE_LTO $(foreach src,$(filter %_isr.c,$(SRCS)),\ - $(eval CFLAGS_$(basename $(notdir $(src))) = -fno-lto)) + $(eval CFLAGS_$(basename $(notdir $(src))) = -fno-lto)) endif -$(LIBOPENCM3): - test -s $(SDIR)/libopencm3/Makefile || { echo "Fetch libopencm3 via 'git submodule update --init'"; exit 1; } - +$(MAKE) -C $(SDIR)/libopencm3 TARGETS=stm32/f1 lib +TARGET := t12 +include $(SDIR)/Makefile.inc + +$(SDIR)$(LIBOPENCM3): $(ODIR) + test -s $(SDIR)libopencm3/Makefile || { echo "Fetch libopencm3 via 'git submodule update --init'"; exit 1; } + +$(FLOCKS) $(MAKE) -C $(SDIR)libopencm3 TARGETS=stm32/f1 lib $(ODIR)/devo.fs: $(LAST_MODEL) $(PRE_FS) $(TARGET).fs_wrapper - target/drivers/filesystems/devofs/buildfs.py -c -i -f $@ -d filesystem/$(FILESYSTEM) + target/drivers/filesystems/devofs/buildfs.py -c -i -f $@ -d $(SDIR)/filesystem/$(FILESYSTEM) From 63588ecb962044b9ba511c12690b917a8509dcfb Mon Sep 17 00:00:00 2001 From: Howard Su Date: Fri, 8 Mar 2019 22:15:22 +0800 Subject: [PATCH 12/15] Fix at9 and at10 --- src/target/tx/opentx/t12/Makefile | 6 +++-- src/target/tx/radiolink/at10/Makefile | 14 ++++++------ src/target/tx/radiolink/at9/Makefile | 25 +++++++++++---------- src/target/tx/radiolink/common/Makefile.inc | 5 +---- 4 files changed, 25 insertions(+), 25 deletions(-) diff --git a/src/target/tx/opentx/t12/Makefile b/src/target/tx/opentx/t12/Makefile index 37233b5d0c..3c6bb4891f 100644 --- a/src/target/tx/opentx/t12/Makefile +++ b/src/target/tx/opentx/t12/Makefile @@ -47,9 +47,11 @@ $(TARGET).bin: $(TARGET).elf $(DUMP) -S $< > $(TARGET).list $(SDIR)$(LIBOPENCM3): $(ODIR) - test -s $(SDIR)libopencm3/Makefile || { echo "Fetch libopencm3 via 'git submodule update --init'"; exit 1; } - +$(FLOCKS) $(MAKE) -C $(SDIR)libopencm3 TARGETS=stm32/f2 lib + test -s $(SDIR)libopencm3/Makefile || { echo "Fetch libopencm3 via 'git submodule update --init'"; exit 1; } + +$(FLOCKS) $(MAKE) -C $(SDIR)libopencm3 TARGETS=stm32/f2 lib $(TARGET).dfu: $(TARGET).bin ../utils/dfu.py --name "$(HGVERSION) Firmware" $(DFU_ARGS):$< $@ ../utils/get_mem_usage.pl $(TARGET).map + +include $(SDIR)/Makefile.inc diff --git a/src/target/tx/radiolink/at10/Makefile b/src/target/tx/radiolink/at10/Makefile index 55c9c00bb3..ff00be81a3 100644 --- a/src/target/tx/radiolink/at10/Makefile +++ b/src/target/tx/radiolink/at10/Makefile @@ -13,26 +13,26 @@ TARGET = at10 ALL = $(LIBOPENCM3) $(TARGET).bin $(TARGET).mac -SRC_C += $(SDIR)/target/drivers/display/8080/320x240x16.c \ - $(wildcard $(SDIR)/target/drivers/input/rotary/*.c) +SRC_C += $(SDIR)target/drivers/display/8080/320x240x16.c \ + $(wildcard $(SDIR)target/drivers/input/rotary/*.c) ifneq "$(HAS_4IN1_FLASH)" "1" -SRC_C := $(filter-out $(SDIR)/target/common/stm32/spi_flash.c, $(SRC_C)) +SRC_C := $(filter-out $(SDIR)target/common/stm32/spi_flash.c, $(SRC_C)) endif .PHONY: default default: $(SDIR)$(TARGET).mac include $(SDIR)target/tx/radiolink/common/Makefile.inc -include $(SDIR)/Makefile.inc +include $(SDIR)Makefile.inc $(SDIR)$(TARGET).mac: $(SDIR)$(TARGET).bin - cat $(SDIR)/target/tx/radiolink/at10/header.mac $(TARGET).bin > $@ + cat $(SDIR)target/tx/radiolink/at10/header.mac $(TARGET).bin > $@ -$(SDIR)$(TARGET).bin: $(SDIR) $(TARGET).elf $(ODIR)/devo.fs +$(SDIR)$(TARGET).bin: $(SDIR) $(TARGET).elf $(ODIR)/devo.fs $(CP) -O binary $(TARGET).elf $(ODIR)/$@ $(DUMP) -S $(TARGET).elf > $(TARGET).list - $(SDIR)/../utils/get_mem_usage.pl $(TARGET).map + $(SDIR)../utils/get_mem_usage.pl $(TARGET).map ifneq "$(HAS_4IN1_FLASH)" "1" # padding firmware to 216KB truncate --size=216K $(ODIR)/$@ diff --git a/src/target/tx/radiolink/at9/Makefile b/src/target/tx/radiolink/at9/Makefile index 412b281de0..8d7bbfc27b 100644 --- a/src/target/tx/radiolink/at9/Makefile +++ b/src/target/tx/radiolink/at9/Makefile @@ -12,6 +12,7 @@ endif DFU_ARGS := -D 0x0483:0xdf12 -b 0x08003000 +TARGET = at9 ifneq "$(HAS_4IN1_FLASH)" "1" EXTRA_DFUS = $(TARGET)-fs.dfu @@ -22,28 +23,28 @@ default: $(SDIR)$(TARGET).dfu ALL = $(LIBOPENCM3) $(SDIR).dfu $(EXTRA_DFUS) -SRC_C += $(SDIR)/target/drivers/display/8080/320x240x16.c \ - $(wildcard $(SDIR)/target/drivers/input/rotary/*.c) +SRC_C += $(SDIR)target/drivers/display/8080/320x240x16.c \ + $(wildcard $(SDIR)target/drivers/input/rotary/*.c) -include $(SDIR)/target/tx/radiolink/common/Makefile.inc -include $(SDIR)/Makefile.inc +include $(SDIR)target/tx/radiolink/common/Makefile.inc +include $(SDIR)Makefile.inc -$(TARGET).bin: $(TARGET).elf +$(SDIR)$(TARGET).bin: $(SDIR)$(TARGET).elf $(CP) -O binary $< $@ - $(DUMP) -S $< > $(TARGET).list + $(DUMP) -S $< > $(SDIR)$(TARGET).list -$(TARGET).dfu: $(TARGET).bin - $(SDIR)/../utils/dfu.py --name "$(HGVERSION) Firmware" $(DFU_ARGS):$< $@ - $(SDIR)/../utils/get_mem_usage.pl $(TARGET).map +$(SDIR)$(TARGET).dfu: $(SDIR)$(TARGET).bin + $(SDIR)../utils/dfu.py --name "$(HGVERSION) Firmware" $(DFU_ARGS):$< $@ + $(SDIR)../utils/get_mem_usage.pl $(SDIR)$(TARGET).map -$(TARGET)-fs.dfu: $(ODIR)/devo.fs - $(SDIR)/../utils/dfu.py --name "$(HGVERSION) Filesystem" -D 0x0483:0xdf12 -b 0x08040000:$< $@ +$(SDIR)$(TARGET)-fs.dfu: $(ODIR)/devo.fs + $(SDIR)../utils/dfu.py --name "$(HGVERSION) Filesystem" -D 0x0483:0xdf12 -b 0x08040000:$< $@ $(TARGET).fs_wrapper: $(LAST_MODEL) perl -p -i -e 's/=15normal/=15ascii/' filesystem/$(FILESYSTEM)/media/config.ini rm filesystem/$(FILESYSTEM)/datalog.bin -$(TARGET).zip: $(ALL) +$(SDIR)$(TARGET).zip: $(ALL) cp -f $(TARGET).dfu deviation-$(HGVERSION).dfu rm -f deviation-$(HGVERSION).zip rm -f debug-$(HGVERSION).zip diff --git a/src/target/tx/radiolink/common/Makefile.inc b/src/target/tx/radiolink/common/Makefile.inc index 55b350a363..3d8051abee 100644 --- a/src/target/tx/radiolink/common/Makefile.inc +++ b/src/target/tx/radiolink/common/Makefile.inc @@ -44,7 +44,7 @@ CFLAGS += -D"HAS_4IN1_FLASH=1" endif MODULE_CFLAGS = -fno-builtin -LFLAGS = -nostartfiles -Wl,-gc-sections -Wl,-Map=$(TARGET).map,--cref -lc -lnosys -L$(SDIR) -L$(SDIR)protocol -L$(ODIR) +LFLAGS = -nostartfiles -Wl,-gc-sections -Wl,-Map=$(SDIR)$(TARGET).map,--cref -lc -lnosys -L$(SDIR) -L$(SDIR)protocol -L$(ODIR) LFLAGS2 = -Wl,-T$(LINKFILE) ifdef ENABLE_LTO @@ -58,9 +58,6 @@ $(foreach src,$(filter %_isr.c,$(SRCS)),\ $(eval CFLAGS_$(basename $(notdir $(src))) = -fno-lto)) endif -TARGET := t12 -include $(SDIR)/Makefile.inc - $(SDIR)$(LIBOPENCM3): $(ODIR) test -s $(SDIR)libopencm3/Makefile || { echo "Fetch libopencm3 via 'git submodule update --init'"; exit 1; } +$(FLOCKS) $(MAKE) -C $(SDIR)libopencm3 TARGETS=stm32/f1 lib From 6786457a43c0809279ef3ba247acaa9feb8f19f1 Mon Sep 17 00:00:00 2001 From: Howard Su Date: Fri, 8 Mar 2019 22:35:15 +0800 Subject: [PATCH 13/15] fix t12 --- src/target/tx/opentx/t12/Makefile | 65 +++++++++++++++------------- src/target/tx/radiolink/at9/Makefile | 2 +- 2 files changed, 35 insertions(+), 32 deletions(-) diff --git a/src/target/tx/opentx/t12/Makefile b/src/target/tx/opentx/t12/Makefile index 3c6bb4891f..7cf53a2445 100644 --- a/src/target/tx/opentx/t12/Makefile +++ b/src/target/tx/opentx/t12/Makefile @@ -10,48 +10,51 @@ TARGET = t12 CROSS = arm-none-eabi- -LINKFILE = $(SDIR)/target/tx/$(FAMILY)/$(TARGET)/$(TARGET).ld - -LIBOPENCM3 = libopencm3/lib/libopencm3_stm32f2.a - -SRC_C = $(wildcard target/tx/$(FAMILY)/$(TARGET)/*.c) \ - target/drivers/display/spi/128x64x1_nt7538.c \ - $(wildcard target/drivers/mcu/stm32/*.c) \ - $(wildcard target/drivers/serial/soft_serial/*.c) \ - $(wildcard target/drivers/serial/usb_cdc/*.c) \ - target/drivers/filesystems/FatFs/ff.c \ - target/drivers/filesystems/FatFs/fattime.c \ - target/drivers/filesystems/FatFs/option/ccsbcs.c \ - $(wildcard target/drivers/storage/mmc_flash/*.c) \ - $(wildcard target/drivers/filesystems/*.c) \ - target/drivers/backlight/backlight.c \ - target/drivers/haptic/haptic.c \ - target/drivers/rtc/rtc_driver.c \ - target/drivers/input/analog/analog.c \ - target/drivers/indicators/led.c \ - target/drivers/input/button_switch/button_switch.c - -CFLAGS = -D"assert_param(x)=" -DSTM32F20X_HD -DSTM32F2 -mcpu=cortex-m3 -mthumb -mfix-cortex-m3-ldrd -fdata-sections -ffunction-sections -Ilibopencm3/include -fno-builtin-printf -Os -I$(SDIR)/target/drivers/filesystems +LINKFILE = $(SDIR)target/tx/$(FAMILY)/$(TARGET)/$(TARGET).ld + +LIBOPENCM3 = $(SDIR)libopencm3/lib/libopencm3_stm32f2.a + +SRC_C = $(wildcard $(SDIR)target/tx/$(FAMILY)/$(TARGET)/*.c) \ + $(SDIR)target/drivers/display/spi/128x64x1_nt7538.c \ + $(wildcard $(SDIR)target/drivers/mcu/stm32/*.c) \ + $(wildcard $(SDIR)target/drivers/serial/soft_serial/*.c) \ + $(wildcard $(SDIR)target/drivers/serial/usb_cdc/*.c) \ + $(SDIR)target/drivers/filesystems/FatFs/ff.c \ + $(SDIR)target/drivers/filesystems/FatFs/fattime.c \ + $(SDIR)target/drivers/filesystems/FatFs/option/ccsbcs.c \ + $(wildcard $(SDIR)target/drivers/storage/mmc_flash/*.c) \ + $(wildcard $(SDIR)target/drivers/filesystems/*.c) \ + $(SDIR)target/drivers/backlight/backlight.c \ + $(SDIR)target/drivers/haptic/haptic.c \ + $(SDIR)target/drivers/rtc/rtc_driver.c \ + $(SDIR)target/drivers/input/analog/analog.c \ + $(SDIR)target/drivers/indicators/led.c \ + $(SDIR)target/drivers/input/button_switch/button_switch.c + +CFLAGS = -D"assert_param(x)=" -DSTM32F20X_HD -DSTM32F2 -mcpu=cortex-m3 -mthumb -mfix-cortex-m3-ldrd -fdata-sections -ffunction-sections -I$(SDIR)libopencm3/include -fno-builtin-printf -Os -I$(SDIR)target/drivers/filesystems MODULE_FLAGS = -fno-builtin -LFLAGS = -nostartfiles -Wl,-gc-sections -Wl,-Map=$(TARGET).map,--cref -lc +LFLAGS = -nostartfiles -Wl,-gc-sections -Wl,-Map=$(SDIR)$(TARGET).map,--cref -lc LFLAGS2 = -Wl,-T$(LINKFILE) LFLAGS2OPT = -Wl,-Ttarget/$(TARGET)/$(TARGET)_opt.ld +.PHONY: default +default: $(SDIR)$(TARGET).bin + #-lnosys -ALL = $(TARGET).dfu +ALL = $(LIBOPENCM3) $(SDIR)$(TARGET).bin -$(TARGET).bin: $(TARGET).elf +$(SDIR)$(TARGET).bin: $(SDIR)$(TARGET).elf $(CP) -O binary $< $@ - $(DUMP) -S $< > $(TARGET).list + $(DUMP) -S $< > $(SDIR)$(TARGET).list -$(SDIR)$(LIBOPENCM3): $(ODIR) +$(LIBOPENCM3): $(ODIR) test -s $(SDIR)libopencm3/Makefile || { echo "Fetch libopencm3 via 'git submodule update --init'"; exit 1; } +$(FLOCKS) $(MAKE) -C $(SDIR)libopencm3 TARGETS=stm32/f2 lib -$(TARGET).dfu: $(TARGET).bin - ../utils/dfu.py --name "$(HGVERSION) Firmware" $(DFU_ARGS):$< $@ - ../utils/get_mem_usage.pl $(TARGET).map +$(SDIR)$(TARGET).dfu: $(LIBOPENCM3) $(SDIR)$(TARGET).bin + $(SDIR)../utils/dfu.py --name "$(HGVERSION) Firmware" $(DFU_ARGS):$< $@ + $(SDIR)../utils/get_mem_usage.pl $(SDIR)$(TARGET).map -include $(SDIR)/Makefile.inc +include $(SDIR)Makefile.inc diff --git a/src/target/tx/radiolink/at9/Makefile b/src/target/tx/radiolink/at9/Makefile index 8d7bbfc27b..c1d3b8b8b1 100644 --- a/src/target/tx/radiolink/at9/Makefile +++ b/src/target/tx/radiolink/at9/Makefile @@ -21,7 +21,7 @@ endif .PHONY: default default: $(SDIR)$(TARGET).dfu -ALL = $(LIBOPENCM3) $(SDIR).dfu $(EXTRA_DFUS) +ALL = $(LIBOPENCM3) $(SDIR)$(TARGET).dfu $(EXTRA_DFUS) SRC_C += $(SDIR)target/drivers/display/8080/320x240x16.c \ $(wildcard $(SDIR)target/drivers/input/rotary/*.c) From 0ccc9fefbdb536fe7a1b3503c31dcccbd6684b29 Mon Sep 17 00:00:00 2001 From: Howard Su Date: Thu, 21 Mar 2019 07:41:26 +0800 Subject: [PATCH 14/15] uniq function has bug --- src/Makefile.inc | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/Makefile.inc b/src/Makefile.inc index 83a1aaed52..22225400a0 100644 --- a/src/Makefile.inc +++ b/src/Makefile.inc @@ -87,13 +87,7 @@ PROTO_EXTRA_OBJS := $(addprefix $(ODIR), $(notdir $(PROTO_EXTRA_C:.c=.o_))) SYMBOL_FILE := $(ODIR)symbolfile endif -define uniq = - $(eval seen :=) - $(foreach _,$1,$(if $(filter $_,${seen}),,$(eval seen += $_))) - ${seen} -endef - -VPATH = $(call uniq, $(dir $(SRCS))) +VPATH = $(dir $(SRCS)) HGVERSION ?= $(shell $(SDIR)../utils/get_version.pl ${TARGET}) HGVERSION := $(HGVERSION) From aef7152ec350e05ee92b188e02a99b207a39be10 Mon Sep 17 00:00:00 2001 From: Howard Su Date: Thu, 21 Mar 2019 09:21:39 +0800 Subject: [PATCH 15/15] Introduce FS_ROOT variable --- src/Makefile | 4 ++-- src/Makefile.inc | 37 ++++++++++++++++---------------- src/fs/Makefile.inc | 51 +++++++++++++++++++++++---------------------- 3 files changed, 46 insertions(+), 46 deletions(-) diff --git a/src/Makefile b/src/Makefile index 00ad8cddc9..fca12743f7 100644 --- a/src/Makefile +++ b/src/Makefile @@ -41,7 +41,7 @@ everything: txs emus fss define make-target .PHONY: $1 win_$1 fs_$1 both_$1 zip_$1 zip_win_$1 release_$1 all_$1 $1: - +$(MAKE) -C target/tx/$2/$1 + +$(MAKE) -f target/tx/$2/$1/Makefile win_$1: ifeq ($(OS),Windows_NT) # This builds Windows emulators on a Windows system @@ -88,4 +88,4 @@ coverity: tar -cvzf coverity-$(HGVERSION).tgz cov-int lint: - $(SDIR)../utils/run_linter.py --diff --debug + ../utils/run_linter.py --diff --debug diff --git a/src/Makefile.inc b/src/Makefile.inc index 22225400a0..31bdd98114 100644 --- a/src/Makefile.inc +++ b/src/Makefile.inc @@ -78,8 +78,6 @@ SRCS := $(SRC_C) $(SRC_CXX) $(SRC_S) ODIR = $(SDIR)objs/$(TARGET)$(ODIREXT)/ OBJS := $(patsubst %.c,$(ODIR)%.o,$(notdir $(SRC_C))) $(patsubst %.cpp,$(ODIR)%.o,$(notdir $(SRC_CXX))) -$(warning $(OBJS)) - ifdef MODULAR PROTO_OBJS := $(addprefix $(ODIR), $(notdir $(PROTO_SRC_C:.c=.o))) PROTO_LIBS := $(addprefix $(ODIR), $(notdir $(PROTO_SRC_C:.c=.bin))) @@ -128,11 +126,12 @@ EXEEXT ?= elf #this section defines final build files # ############################################ FILESYSTEM = $(subst emu_,,$(TARGET)) -MODELDIR = filesystem/$(FILESYSTEM)/models +FS_ROOT = $(SDIR)filesystem/$(FILESYSTEM) +MODELDIR = $(FS_ROOT)/models LAST_MODEL := $(MODELDIR)/model$(NUM_MODELS).ini -ALL := $(ODIR) $(TARGET).fs_wrapper +ALL += $(ODIR) $(TARGET).fs_wrapper $(OBJS) ############################################ #END SECTION # @@ -142,7 +141,7 @@ ALL := $(ODIR) $(TARGET).fs_wrapper #this section includes build targets # ############################################ .PHONY: all -all : $(ALL) $(OBJS) +all : $(ALL) #################################### # recompile if the Makefile changes# @@ -160,38 +159,38 @@ $(VERBOSE).SILENT: clean: rm -f $(TARGET).$(EXEEXT) $(TARGET).exe $(TARGET).bin $(TARGET).dfu $(TARGET).list \ $(TARGET).map $(ODIR)*.o $(ODIR)*.o_ $(ODIR)*.P $(ODIR)*.bin \ - filesystem/$(FILESYSYTEM) 2> /dev/null || true + $(FS_ROOT) 2> /dev/null || true language: - $(SDIR)../utils/extract_strings.pl -po > $(SDIR)fs/language/deviation.po + ../utils/extract_strings.pl -po > fs/language/deviation.po -zip: $(SDIR)$(TARGET).zip +zip: $(TARGET).zip -$(SDIR)%.zip: $(ALL) $(PROTO_MODULES) +%.zip: $(ALL) $(PROTO_MODULES) #This is not an emulator build (emulator is hanled in target/common/emu/Makefile.inc) - cp -f $(SDIR)$(TARGET).dfu $(SDIR)deviation-$(HGVERSION).dfu - rm -f $(SDIR)deviation-$(HGVERSION).zip - rm -f $(SDIR)debug-$(HGVERSION).zip - zip $(SDIR)debug-$(HGVERSION).zip $(SDIR)$(TARGET).elf + cp -f $(TARGET).dfu deviation-$(HGVERSION).dfu + rm -f deviation-$(HGVERSION).zip + rm -f debug-$(HGVERSION).zip + zip debug-$(HGVERSION).zip $(TARGET).elf # $(MAKE) zipping more compatible with other distributions export p=`pwd`; cd $(ODIR) && test -e devo.fs && zip -u $$p/deviation-$(HGVERSION).zip devo.fs && rm devo.fs || true - zip $(SDIR)deviation-$(HGVERSION).zip $(SDIR)deviation-$(HGVERSION).dfu $(SDIR)UPDATING.md + zip deviation-$(HGVERSION).zip deviation-$(HGVERSION).dfu UPDATING.md ifdef MODULAR export p=`pwd`; cd $(ODIR) && zip -ur $$p/deviation-$(HGVERSION).zip protocol/*.mod export p=`pwd`; cd $(ODIR) && zip -u $$p/debug-$(HGVERSION).zip *.elf rm -rf $(ODIR)protocol endif ifeq "$(INCLUDE_FS)" "1" - export p=`pwd`; cd filesystem/$(FILESYSTEM) && zip -ur $$p/deviation-$(HGVERSION).zip * + export p=`pwd`; cd $(FS_ROOT) && zip -ur $$p/deviation-$(HGVERSION).zip * endif - zip -u $(SDIR)deviation-$(HGVERSION).zip $(SDIR)debug-$(HGVERSION).zip - rm -f $(SDIR)debug-$(HGVERSION).zip - rm -f $(SDIR)deviation-$(HGVERSION).dfu + zip -u deviation-$(HGVERSION).zip debug-$(HGVERSION).zip + rm -f debug-$(HGVERSION).zip + rm -f deviation-$(HGVERSION).dfu fs: $(TARGET).fs %.fs: - rm -f deviation-fs-$(HGVERSION).zip; zip -r deviation-fs-$(HGVERSION).zip filesystem/$(FILESYSTEM) + rm -f deviation-fs-$(HGVERSION).zip; zip -r deviation-fs-$(HGVERSION).zip $(FS_ROOT) ########################################## diff --git a/src/fs/Makefile.inc b/src/fs/Makefile.inc index 451c28e04d..eda5e4c910 100644 --- a/src/fs/Makefile.inc +++ b/src/fs/Makefile.inc @@ -1,24 +1,25 @@ ################# #The filesystem # ################# + %.fs_wrapper: $(LAST_MODEL) true .PHONY: $(PRE_FS) $(LAST_MODEL) $(LAST_MODEL): $(SDIR)/model_template.ini $(SDIR)/tx_template.ini $(FONTS) $(PRE_FS) @echo " + Copying template files for $(FILESYSTEM)" - mkdir -p filesystem/$(FILESYSTEM) || true - for i in $(FILESYSTEMS); do cp -prf $(SDIR)/fs/$$i/* filesystem/$(FILESYSTEM)/; done - rm filesystem/$(FILESYSTEM)/*/.ignore 2>/dev/null || true - cp $(SDIR)/tx_template.ini filesystem/$(FILESYSTEM)/tx.ini - echo 'empty' > filesystem/$(FILESYSTEM)/errors.txt - mkdir filesystem/$(FILESYSTEM)/models 2> /dev/null || true - echo 'name=Model1' > filesystem/$(FILESYSTEM)/models/model1.ini \ - && cat $(SDIR)/model_template.ini >> filesystem/$(FILESYSTEM)/models/model1.ini - cp $(SDIR)/model_template.ini filesystem/$(FILESYSTEM)/models/default.ini + mkdir -p $(FS_ROOT) || true + for i in $(FILESYSTEMS); do cp -prf $(SDIR)/fs/$$i/* $(FS_ROOT)/; done + rm $(FS_ROOT)/*/.ignore 2>/dev/null || true + cp $(SDIR)/tx_template.ini $(FS_ROOT)/tx.ini + echo 'empty' > $(FS_ROOT)/errors.txt + mkdir $(FS_ROOT)/models 2> /dev/null || true + echo 'name=Model1' > $(FS_ROOT)/models/model1.ini \ + && cat $(SDIR)/model_template.ini >> $(FS_ROOT)/models/model1.ini + cp $(SDIR)/model_template.ini $(FS_ROOT)/models/default.ini ifdef LANGUAGE - mkdir filesystem/$(FILESYSTEM)/language 2> /dev/null; \ - $(SDIR)/../utils/extract_strings.pl -po -fs filesystem/$(FILESYSTEM)/language -targets $(LANGUAGE) -update -objdir $(ODIR) + mkdir $(FS_ROOT)/language 2> /dev/null; \ + $(SDIR)/../utils/extract_strings.pl -po -fs $(FS_ROOT)/language -targets $(LANGUAGE) -update -objdir $(ODIR) endif export tx=$(FILESYSTEM); \ number=2 ; while [ $$number -le $(NUM_MODELS) ] ; do \ @@ -36,31 +37,31 @@ endif ###################### #Necessary Font files# ###################### -filesystem/$(FILESYSTEM)/media/12normal.fon: $(SDIR)/fonts/12normal.bdf - mkdir -p filesystem/$(FILESYSTEM)/media/ +$(FS_ROOT)/media/12normal.fon: $(SDIR)/fonts/12normal.bdf + mkdir -p $(FS_ROOT)/media/ $(SDIR)/../utils/font/bdf_to_font.pl -maxsize 12 -mode bin $< -out $@ -minspace 10 -filesystem/$(FILESYSTEM)/media/15normal.fon: $(SDIR)/fonts/15normal.bdf - mkdir -p filesystem/$(FILESYSTEM)/media/ +$(FS_ROOT)/media/15normal.fon: $(SDIR)/fonts/15normal.bdf + mkdir -p $(FS_ROOT)/media/ $(SDIR)/../utils/font/bdf_to_font.pl -maxsize 15 -mode bin $< -out $@ -minspace 8 # special font for f12e with 18x12 char size -filesystem/$(FILESYSTEM)/media/f12e.fon: $(SDIR)/fonts/f12e.bdf - mkdir -p filesystem/$(FILESYSTEM)/media/ +$(FS_ROOT)/media/f12e.fon: $(SDIR)/fonts/f12e.bdf + mkdir -p $(FS_ROOT)/media/ $(SDIR)/../utils/font/bdf_to_font.pl -maxsize 18 -mode bin $< -out $@ -minspace 8 -filesystem/$(FILESYSTEM)/media/12ascii.fon: $(SDIR)/fonts/12normal.bdf - mkdir -p filesystem/$(FILESYSTEM)/media/ +$(FS_ROOT)/media/12ascii.fon: $(SDIR)/fonts/12normal.bdf + mkdir -p $(FS_ROOT)/media/ $(SDIR)/../utils/font/bdf_to_font.pl -maxsize 12 -mode bin $< -out $@ -minspace 10 -ascii -filesystem/$(FILESYSTEM)/media/15ascii.fon: $(SDIR)/fonts/15normal.bdf - mkdir -p filesystem/$(FILESYSTEM)/media/ +$(FS_ROOT)/media/15ascii.fon: $(SDIR)/fonts/15normal.bdf + mkdir -p $(FS_ROOT)/media/ $(SDIR)/../utils/font/bdf_to_font.pl -maxsize 15 -mode bin $< -out $@ -minspace 8 -ascii -filesystem/$(FILESYSTEM)/media/23bold.fon: $(SDIR)/fonts/23bold.bdf - mkdir -p filesystem/$(FILESYSTEM)/media/ +$(FS_ROOT)/media/23bold.fon: $(SDIR)/fonts/23bold.bdf + mkdir -p $(FS_ROOT)/media/ $(SDIR)/../utils/font/bdf_to_font.pl -maxsize 23 -mode bin $< -out $@ -minspace 8 -filesystem/$(FILESYSTEM)/media/04b03.fon: $(SDIR)/fonts/04b03.bdf - mkdir -p filesystem/$(FILESYSTEM)/media/ +$(FS_ROOT)/media/04b03.fon: $(SDIR)/fonts/04b03.bdf + mkdir -p $(FS_ROOT)/media/ $(SDIR)/../utils/font/bdf_to_font.pl -maxsize 5 -mode bin $< -out $@ -minspace 5