Diff
checker
Testo
Testo
Immagini
Documenti
Excel
Cartelle
Legal
Enterprise
Applicazione per desktop
Prezzi
Accedi
Scarica Diffchecker Desktop
Confronta il testo
Trova la differenza tra due file di testo
Strumenti
Cronologia
Editor live
Comprimi invariate
Senza a capo
Layout
Diviso
Unificato
Livello di dettaglio
Intelligente
Parola
Carattere
Evidenziazione sintassi
Scegli sintassi
Ignora
Trasforma testo
Vai alla prima modifica
Modifica input
Diffchecker Desktop
Il modo più sicuro per usare Diffchecker. Ottieni l'app Diffchecker Desktop: i tuoi diff non lasciano mai il tuo computer!
Ottieni Desktop
Untitled diff
Creato
9 anni fa
Il diff non scade mai
Eliminare
Esporta
Condividere
Spiegare
19 rimozioni
Linee
Totale
Rimosso
Caratteri
Totale
Rimosso
Per continuare a utilizzare questa funzione, aggiorna a
Diff
checker
Pro
Visualizza prezzi
172 linee
Copia tutti
25 aggiunte
Linee
Totale
Aggiunto
Caratteri
Totale
Aggiunto
Per continuare a utilizzare questa funzione, aggiorna a
Diff
checker
Pro
Visualizza prezzi
172 linee
Copia tutti
Copia
Copiato
Copia
Copiato
FROM SDK
12.2
FROM SDK
13.0
# Copyright (c) 2016 Nordic Semiconductor. All Rights Reserved.
# Copyright (c) 2016 Nordic Semiconductor. All Rights Reserved.
#
#
# The information contained herein is property of Nordic Semiconductor ASA.
# The information contained herein is property of Nordic Semiconductor ASA.
# Terms and conditions of usage are described in detail in NORDIC
# Terms and conditions of usage are described in detail in NORDIC
# SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT.
# SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT.
#
#
# Licensees are granted free, non-transferable use of the information. NO
# Licensees are granted free, non-transferable use of the information. NO
# WARRANTY of ANY KIND is provided. This heading must NOT be removed from
# WARRANTY of ANY KIND is provided. This heading must NOT be removed from
# the file.
# the file.
PLATFORM_SUFFIX := $(if $(filter Windows%,$(OS)),windows,posix)
PLATFORM_SUFFIX := $(if $(filter Windows%,$(OS)),windows,posix)
TOOLCHAIN_CONFIG_FILE := $(TEMPLATE_PATH)/Makefile.$(PLATFORM_SUFFIX)
TOOLCHAIN_CONFIG_FILE := $(TEMPLATE_PATH)/Makefile.$(PLATFORM_SUFFIX)
include $(TOOLCHAIN_CONFIG_FILE)
include $(TOOLCHAIN_CONFIG_FILE)
# Toolchain commands
# Toolchain commands
Copia
Copiato
Copia
Copiato
CC :=
'
$(GNU_INSTALL_ROOT)/bin/$(GNU_PREFIX)-gcc
'
CC :=
"
$(GNU_INSTALL_ROOT)/bin/$(GNU_PREFIX)-gcc
"
CXX :=
'
$(GNU_INSTALL_ROOT)/bin/$(GNU_PREFIX)-c++
'
CXX :=
"
$(GNU_INSTALL_ROOT)/bin/$(GNU_PREFIX)-c++
"
AS :=
'
$(GNU_INSTALL_ROOT)/bin/$(GNU_PREFIX)-as
'
AS :=
"
$(GNU_INSTALL_ROOT)/bin/$(GNU_PREFIX)-as
"
AR :=
'
$(GNU_INSTALL_ROOT)/bin/$(GNU_PREFIX)-ar
'
-r
AR :=
"
$(GNU_INSTALL_ROOT)/bin/$(GNU_PREFIX)-ar
"
-r
LD :=
'
$(GNU_INSTALL_ROOT)/bin/$(GNU_PREFIX)-ld
'
LD :=
"
$(GNU_INSTALL_ROOT)/bin/$(GNU_PREFIX)-ld
"
NM :=
'
$(GNU_INSTALL_ROOT)/bin/$(GNU_PREFIX)-nm
'
NM :=
"
$(GNU_INSTALL_ROOT)/bin/$(GNU_PREFIX)-nm
"
OBJDUMP :=
'
$(GNU_INSTALL_ROOT)/bin/$(GNU_PREFIX)-objdump
'
OBJDUMP :=
"
$(GNU_INSTALL_ROOT)/bin/$(GNU_PREFIX)-objdump
"
OBJCOPY :=
'
$(GNU_INSTALL_ROOT)/bin/$(GNU_PREFIX)-objcopy
'
OBJCOPY :=
"
$(GNU_INSTALL_ROOT)/bin/$(GNU_PREFIX)-objcopy
"
SIZE :=
'
$(GNU_INSTALL_ROOT)/bin/$(GNU_PREFIX)-size
'
SIZE :=
"
$(GNU_INSTALL_ROOT)/bin/$(GNU_PREFIX)-size
"
$(if $(shell $(CC) --version),,$(info Cannot find: $(CC).) \
$(if $(shell $(CC) --version),,$(info Cannot find: $(CC).) \
$(info Please set values in: "$(abspath $(TOOLCHAIN_CONFIG_FILE))") \
$(info Please set values in: "$(abspath $(TOOLCHAIN_CONFIG_FILE))") \
$(info according to the actual configuration of your system.) \
$(info according to the actual configuration of your system.) \
$(error Cannot continue))
$(error Cannot continue))
# Use ccache on linux if available
# Use ccache on linux if available
CCACHE := $(if $(filter Windows%,$(OS)),, \
CCACHE := $(if $(filter Windows%,$(OS)),, \
$(if $(wildcard /usr/bin/ccache),ccache))
$(if $(wildcard /usr/bin/ccache),ccache))
CC := $(CCACHE) $(CC)
CC := $(CCACHE) $(CC)
MK := mkdir
MK := mkdir
RM := rm -rf
RM := rm -rf
# echo suspend
# echo suspend
ifeq ($(VERBOSE),1)
ifeq ($(VERBOSE),1)
NO_ECHO :=
NO_ECHO :=
else
else
NO_ECHO := @
NO_ECHO := @
endif
endif
# $1 type of item
# $1 type of item
# $2 path to check
# $2 path to check
define ensure_exists
define ensure_exists
$(if $(wildcard $(2)),, $(warning Cannot find $(1): $(2)))
$(if $(wildcard $(2)),, $(warning Cannot find $(1): $(2)))
endef
endef
# $1 object file
# $1 object file
# $2 source file
# $2 source file
define bind_obj_with_src
define bind_obj_with_src
$(eval $(1) := $(2))
$(eval $(1) := $(2))
endef
endef
# $1 object file
# $1 object file
# $2 target name
# $2 target name
define bind_obj_with_target
define bind_obj_with_target
$(eval $(1)T := $(2))
$(eval $(1)T := $(2))
endef
endef
# $1 target name
# $1 target name
# $2 source file name
# $2 source file name
# Note: this additional .o for .s-files is a workaround for issues with make 4.1
# Note: this additional .o for .s-files is a workaround for issues with make 4.1
# from MinGW (it does nothing to remake .s.o files when a rule for .S.o
# from MinGW (it does nothing to remake .s.o files when a rule for .S.o
# files is defined as well).
# files is defined as well).
define get_object_file_name
define get_object_file_name
$(OUTPUT_DIRECTORY)/$(strip $(1))_$(patsubst %.s,%.s.o,$(notdir $(2))).o
$(OUTPUT_DIRECTORY)/$(strip $(1))_$(patsubst %.s,%.s.o,$(notdir $(2))).o
endef
endef
# $1 target name
# $1 target name
# $2 list of source files
# $2 list of source files
define get_object_files
define get_object_files
$(foreach src_file, $(2), \
$(foreach src_file, $(2), \
$(call ensure_exists,source file, $(src_file)) \
$(call ensure_exists,source file, $(src_file)) \
$(eval obj_file := $(call get_object_file_name, $(1), $(src_file))) \
$(eval obj_file := $(call get_object_file_name, $(1), $(src_file))) \
$(eval DEPENDENCIES += $(obj_file:.o=.d)) \
$(eval DEPENDENCIES += $(obj_file:.o=.d)) \
$(call bind_obj_with_src, $(obj_file), $(src_file)) \
$(call bind_obj_with_src, $(obj_file), $(src_file)) \
$(call bind_obj_with_target, $(obj_file), $(1)) \
$(call bind_obj_with_target, $(obj_file), $(1)) \
$(eval $(obj_file): Makefile) \
$(eval $(obj_file): Makefile) \
$(obj_file))
$(obj_file))
endef
endef
# $1 variable name
# $1 variable name
# $2 target name
# $2 target name
define target_specific
define target_specific
$($(addsuffix _$(strip $(2)), $(1)))
$($(addsuffix _$(strip $(2)), $(1)))
endef
endef
# $1 target name
# $1 target name
# $2 link target name
# $2 link target name
define prepare_build
define prepare_build
$(eval DEPENDENCIES :=) \
$(eval DEPENDENCIES :=) \
$(eval $(2): \
$(eval $(2): \
$(call get_object_files, $(1), $(SRC_FILES) \
$(call get_object_files, $(1), $(SRC_FILES) \
$(call target_specific, SRC_FILES, $(1)))) \
$(call target_specific, SRC_FILES, $(1)))) \
$(eval -include $(DEPENDENCIES)) \
$(eval -include $(DEPENDENCIES)) \
$(eval INC_PATHS_$(strip $(1)) := \
$(eval INC_PATHS_$(strip $(1)) := \
$(foreach folder, $(INC_FOLDERS) $(call target_specific, INC_FOLDERS, $(1)), \
$(foreach folder, $(INC_FOLDERS) $(call target_specific, INC_FOLDERS, $(1)), \
$(call ensure_exists,include folder, $(folder)) \
$(call ensure_exists,include folder, $(folder)) \
-I"$(folder)"))
-I"$(folder)"))
endef
endef
INC_PATHS = $(call target_specific, INC_PATHS, $($@T))
INC_PATHS = $(call target_specific, INC_PATHS, $($@T))
# $1 target name
# $1 target name
define define_target
define define_target
$(eval OUTPUT_FILE := $(OUTPUT_DIRECTORY)/$(strip $(1))) \
$(eval OUTPUT_FILE := $(OUTPUT_DIRECTORY)/$(strip $(1))) \
$(eval $(1): $(OUTPUT_FILE).out $(OUTPUT_FILE).hex $(OUTPUT_FILE).bin) \
$(eval $(1): $(OUTPUT_FILE).out $(OUTPUT_FILE).hex $(OUTPUT_FILE).bin) \
$(call prepare_build, $(1), $(OUTPUT_FILE).out)
$(call prepare_build, $(1), $(OUTPUT_FILE).out)
endef
endef
# $1 target name
# $1 target name
# $2 library file name
# $2 library file name
define define_library
define define_library
$(eval $(1) := $(2)) \
$(eval $(1) := $(2)) \
$(call prepare_build, $(1), $(1))
$(call prepare_build, $(1), $(1))
endef
endef
.PHONY: $(TARGETS) default all clean help flash
.PHONY: $(TARGETS) default all clean help flash
all: $(TARGETS)
all: $(TARGETS)
clean:
clean:
$(RM) $(OUTPUT_DIRECTORY)
$(RM) $(OUTPUT_DIRECTORY)
# Create build directories
# Create build directories
$(OUTPUT_DIRECTORY):
$(OUTPUT_DIRECTORY):
$(MK) $@
$(MK) $@
# Create objects from C source files
# Create objects from C source files
$(OUTPUT_DIRECTORY)/%.c.o: | $(OUTPUT_DIRECTORY)
$(OUTPUT_DIRECTORY)/%.c.o: | $(OUTPUT_DIRECTORY)
@echo Compiling file: $(notdir $($@))
@echo Compiling file: $(notdir $($@))
Copia
Copiato
Copia
Copiato
$(NO_ECHO)$(CC) -MP -MD -std=c99 $(CFLAGS) $(INC_PATHS) -c -o $@
$($@)
$(NO_ECHO)$(CC) -MP -MD -std=c99 $(CFLAGS) $(INC_PATHS) -c -o $@
"
$($@)
"
# Create objects from C++ source files
# Create objects from C++ source files
$(OUTPUT_DIRECTORY)/%.cpp.o: | $(OUTPUT_DIRECTORY)
$(OUTPUT_DIRECTORY)/%.cpp.o: | $(OUTPUT_DIRECTORY)
@echo Compiling file: $(notdir $($@))
@echo Compiling file: $(notdir $($@))
Copia
Copiato
Copia
Copiato
$(NO_ECHO)$(CXX) -MP -MD $(CFLAGS) $(CXXFLAGS) $(INC_PATHS) -c -o $@
$($@)
$(NO_ECHO)$(CXX) -MP -MD $(CFLAGS) $(CXXFLAGS) $(INC_PATHS) -c -o $@
"
$($@)
"
# Create objects from assembly files
# Create objects from assembly files
$(OUTPUT_DIRECTORY)/%.S.o \
$(OUTPUT_DIRECTORY)/%.S.o \
$(OUTPUT_DIRECTORY)/%.s.o.o: | $(OUTPUT_DIRECTORY)
$(OUTPUT_DIRECTORY)/%.s.o.o: | $(OUTPUT_DIRECTORY)
@echo Assembling file: $(notdir $($@))
@echo Assembling file: $(notdir $($@))
Copia
Copiato
Copia
Copiato
$(NO_ECHO)$(CC) -MP -MD -std=c99 $(ASMFLAGS) $(INC_PATHS) -c -o $@
$($@)
$(NO_ECHO)$(CC) -MP -MD -std=c99 $(ASMFLAGS) $(INC_PATHS) -c -o $@
"
$($@)
"
export FILE_LIST
export FILE_LIST
DUMP_FILE_LIST := \
DUMP_FILE_LIST := \
"$(MAKE)" -s --no-print-directory -f $(TEMPLATE_PATH)/file_list.mk
"$(MAKE)" -s --no-print-directory -f $(TEMPLATE_PATH)/file_list.mk
# Link object files
# Link object files
%.out:
%.out:
$(eval FILE_LIST := $^ $(LIB_FILES))
$(eval FILE_LIST := $^ $(LIB_FILES))
$(NO_ECHO)$(DUMP_FILE_LIST) > $(@:.out=.in)
$(NO_ECHO)$(DUMP_FILE_LIST) > $(@:.out=.in)
@echo Linking target: $@
@echo Linking target: $@
$(NO_ECHO)$(CC) -Wl,-Map=$(@:.out=.map) $(LDFLAGS) @$(@:.out=.in) -lm -o $@
$(NO_ECHO)$(CC) -Wl,-Map=$(@:.out=.map) $(LDFLAGS) @$(@:.out=.in) -lm -o $@
-@echo ''
-@echo ''
$(NO_ECHO)$(SIZE) $@
$(NO_ECHO)$(SIZE) $@
-@echo ''
-@echo ''
# Create binary .bin file from the .out file
# Create binary .bin file from the .out file
%.bin: %.out
%.bin: %.out
@echo Preparing: $@
@echo Preparing: $@
$(NO_ECHO)$(OBJCOPY) -O binary $< $@
$(NO_ECHO)$(OBJCOPY) -O binary $< $@
# Create binary .hex file from the .out file
# Create binary .hex file from the .out file
%.hex: %.out
%.hex: %.out
@echo Preparing: $@
@echo Preparing: $@
$(NO_ECHO)$(OBJCOPY) -O ihex $< $@
$(NO_ECHO)$(OBJCOPY) -O ihex $< $@
Diff salvati
Testo originale
Apri file
FROM SDK 12.2 # Copyright (c) 2016 Nordic Semiconductor. All Rights Reserved. # # The information contained herein is property of Nordic Semiconductor ASA. # Terms and conditions of usage are described in detail in NORDIC # SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. # # Licensees are granted free, non-transferable use of the information. NO # WARRANTY of ANY KIND is provided. This heading must NOT be removed from # the file. PLATFORM_SUFFIX := $(if $(filter Windows%,$(OS)),windows,posix) TOOLCHAIN_CONFIG_FILE := $(TEMPLATE_PATH)/Makefile.$(PLATFORM_SUFFIX) include $(TOOLCHAIN_CONFIG_FILE) # Toolchain commands CC := '$(GNU_INSTALL_ROOT)/bin/$(GNU_PREFIX)-gcc' CXX := '$(GNU_INSTALL_ROOT)/bin/$(GNU_PREFIX)-c++' AS := '$(GNU_INSTALL_ROOT)/bin/$(GNU_PREFIX)-as' AR := '$(GNU_INSTALL_ROOT)/bin/$(GNU_PREFIX)-ar' -r LD := '$(GNU_INSTALL_ROOT)/bin/$(GNU_PREFIX)-ld' NM := '$(GNU_INSTALL_ROOT)/bin/$(GNU_PREFIX)-nm' OBJDUMP := '$(GNU_INSTALL_ROOT)/bin/$(GNU_PREFIX)-objdump' OBJCOPY := '$(GNU_INSTALL_ROOT)/bin/$(GNU_PREFIX)-objcopy' SIZE := '$(GNU_INSTALL_ROOT)/bin/$(GNU_PREFIX)-size' $(if $(shell $(CC) --version),,$(info Cannot find: $(CC).) \ $(info Please set values in: "$(abspath $(TOOLCHAIN_CONFIG_FILE))") \ $(info according to the actual configuration of your system.) \ $(error Cannot continue)) # Use ccache on linux if available CCACHE := $(if $(filter Windows%,$(OS)),, \ $(if $(wildcard /usr/bin/ccache),ccache)) CC := $(CCACHE) $(CC) MK := mkdir RM := rm -rf # echo suspend ifeq ($(VERBOSE),1) NO_ECHO := else NO_ECHO := @ endif # $1 type of item # $2 path to check define ensure_exists $(if $(wildcard $(2)),, $(warning Cannot find $(1): $(2))) endef # $1 object file # $2 source file define bind_obj_with_src $(eval $(1) := $(2)) endef # $1 object file # $2 target name define bind_obj_with_target $(eval $(1)T := $(2)) endef # $1 target name # $2 source file name # Note: this additional .o for .s-files is a workaround for issues with make 4.1 # from MinGW (it does nothing to remake .s.o files when a rule for .S.o # files is defined as well). define get_object_file_name $(OUTPUT_DIRECTORY)/$(strip $(1))_$(patsubst %.s,%.s.o,$(notdir $(2))).o endef # $1 target name # $2 list of source files define get_object_files $(foreach src_file, $(2), \ $(call ensure_exists,source file, $(src_file)) \ $(eval obj_file := $(call get_object_file_name, $(1), $(src_file))) \ $(eval DEPENDENCIES += $(obj_file:.o=.d)) \ $(call bind_obj_with_src, $(obj_file), $(src_file)) \ $(call bind_obj_with_target, $(obj_file), $(1)) \ $(eval $(obj_file): Makefile) \ $(obj_file)) endef # $1 variable name # $2 target name define target_specific $($(addsuffix _$(strip $(2)), $(1))) endef # $1 target name # $2 link target name define prepare_build $(eval DEPENDENCIES :=) \ $(eval $(2): \ $(call get_object_files, $(1), $(SRC_FILES) \ $(call target_specific, SRC_FILES, $(1)))) \ $(eval -include $(DEPENDENCIES)) \ $(eval INC_PATHS_$(strip $(1)) := \ $(foreach folder, $(INC_FOLDERS) $(call target_specific, INC_FOLDERS, $(1)), \ $(call ensure_exists,include folder, $(folder)) \ -I"$(folder)")) endef INC_PATHS = $(call target_specific, INC_PATHS, $($@T)) # $1 target name define define_target $(eval OUTPUT_FILE := $(OUTPUT_DIRECTORY)/$(strip $(1))) \ $(eval $(1): $(OUTPUT_FILE).out $(OUTPUT_FILE).hex $(OUTPUT_FILE).bin) \ $(call prepare_build, $(1), $(OUTPUT_FILE).out) endef # $1 target name # $2 library file name define define_library $(eval $(1) := $(2)) \ $(call prepare_build, $(1), $(1)) endef .PHONY: $(TARGETS) default all clean help flash all: $(TARGETS) clean: $(RM) $(OUTPUT_DIRECTORY) # Create build directories $(OUTPUT_DIRECTORY): $(MK) $@ # Create objects from C source files $(OUTPUT_DIRECTORY)/%.c.o: | $(OUTPUT_DIRECTORY) @echo Compiling file: $(notdir $($@)) $(NO_ECHO)$(CC) -MP -MD -std=c99 $(CFLAGS) $(INC_PATHS) -c -o $@ $($@) # Create objects from C++ source files $(OUTPUT_DIRECTORY)/%.cpp.o: | $(OUTPUT_DIRECTORY) @echo Compiling file: $(notdir $($@)) $(NO_ECHO)$(CXX) -MP -MD $(CFLAGS) $(CXXFLAGS) $(INC_PATHS) -c -o $@ $($@) # Create objects from assembly files $(OUTPUT_DIRECTORY)/%.S.o \ $(OUTPUT_DIRECTORY)/%.s.o.o: | $(OUTPUT_DIRECTORY) @echo Assembling file: $(notdir $($@)) $(NO_ECHO)$(CC) -MP -MD -std=c99 $(ASMFLAGS) $(INC_PATHS) -c -o $@ $($@) export FILE_LIST DUMP_FILE_LIST := \ "$(MAKE)" -s --no-print-directory -f $(TEMPLATE_PATH)/file_list.mk # Link object files %.out: $(eval FILE_LIST := $^ $(LIB_FILES)) $(NO_ECHO)$(DUMP_FILE_LIST) > $(@:.out=.in) @echo Linking target: $@ $(NO_ECHO)$(CC) -Wl,-Map=$(@:.out=.map) $(LDFLAGS) @$(@:.out=.in) -lm -o $@ -@echo '' $(NO_ECHO)$(SIZE) $@ -@echo '' # Create binary .bin file from the .out file %.bin: %.out @echo Preparing: $@ $(NO_ECHO)$(OBJCOPY) -O binary $< $@ # Create binary .hex file from the .out file %.hex: %.out @echo Preparing: $@ $(NO_ECHO)$(OBJCOPY) -O ihex $< $@
Testo modificato
Apri file
FROM SDK 13.0 # Copyright (c) 2016 Nordic Semiconductor. All Rights Reserved. # # The information contained herein is property of Nordic Semiconductor ASA. # Terms and conditions of usage are described in detail in NORDIC # SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. # # Licensees are granted free, non-transferable use of the information. NO # WARRANTY of ANY KIND is provided. This heading must NOT be removed from # the file. PLATFORM_SUFFIX := $(if $(filter Windows%,$(OS)),windows,posix) TOOLCHAIN_CONFIG_FILE := $(TEMPLATE_PATH)/Makefile.$(PLATFORM_SUFFIX) include $(TOOLCHAIN_CONFIG_FILE) # Toolchain commands CC := "$(GNU_INSTALL_ROOT)/bin/$(GNU_PREFIX)-gcc" CXX := "$(GNU_INSTALL_ROOT)/bin/$(GNU_PREFIX)-c++" AS := "$(GNU_INSTALL_ROOT)/bin/$(GNU_PREFIX)-as" AR := "$(GNU_INSTALL_ROOT)/bin/$(GNU_PREFIX)-ar" -r LD := "$(GNU_INSTALL_ROOT)/bin/$(GNU_PREFIX)-ld" NM := "$(GNU_INSTALL_ROOT)/bin/$(GNU_PREFIX)-nm" OBJDUMP := "$(GNU_INSTALL_ROOT)/bin/$(GNU_PREFIX)-objdump" OBJCOPY := "$(GNU_INSTALL_ROOT)/bin/$(GNU_PREFIX)-objcopy" SIZE := "$(GNU_INSTALL_ROOT)/bin/$(GNU_PREFIX)-size" $(if $(shell $(CC) --version),,$(info Cannot find: $(CC).) \ $(info Please set values in: "$(abspath $(TOOLCHAIN_CONFIG_FILE))") \ $(info according to the actual configuration of your system.) \ $(error Cannot continue)) # Use ccache on linux if available CCACHE := $(if $(filter Windows%,$(OS)),, \ $(if $(wildcard /usr/bin/ccache),ccache)) CC := $(CCACHE) $(CC) MK := mkdir RM := rm -rf # echo suspend ifeq ($(VERBOSE),1) NO_ECHO := else NO_ECHO := @ endif # $1 type of item # $2 path to check define ensure_exists $(if $(wildcard $(2)),, $(warning Cannot find $(1): $(2))) endef # $1 object file # $2 source file define bind_obj_with_src $(eval $(1) := $(2)) endef # $1 object file # $2 target name define bind_obj_with_target $(eval $(1)T := $(2)) endef # $1 target name # $2 source file name # Note: this additional .o for .s-files is a workaround for issues with make 4.1 # from MinGW (it does nothing to remake .s.o files when a rule for .S.o # files is defined as well). define get_object_file_name $(OUTPUT_DIRECTORY)/$(strip $(1))_$(patsubst %.s,%.s.o,$(notdir $(2))).o endef # $1 target name # $2 list of source files define get_object_files $(foreach src_file, $(2), \ $(call ensure_exists,source file, $(src_file)) \ $(eval obj_file := $(call get_object_file_name, $(1), $(src_file))) \ $(eval DEPENDENCIES += $(obj_file:.o=.d)) \ $(call bind_obj_with_src, $(obj_file), $(src_file)) \ $(call bind_obj_with_target, $(obj_file), $(1)) \ $(eval $(obj_file): Makefile) \ $(obj_file)) endef # $1 variable name # $2 target name define target_specific $($(addsuffix _$(strip $(2)), $(1))) endef # $1 target name # $2 link target name define prepare_build $(eval DEPENDENCIES :=) \ $(eval $(2): \ $(call get_object_files, $(1), $(SRC_FILES) \ $(call target_specific, SRC_FILES, $(1)))) \ $(eval -include $(DEPENDENCIES)) \ $(eval INC_PATHS_$(strip $(1)) := \ $(foreach folder, $(INC_FOLDERS) $(call target_specific, INC_FOLDERS, $(1)), \ $(call ensure_exists,include folder, $(folder)) \ -I"$(folder)")) endef INC_PATHS = $(call target_specific, INC_PATHS, $($@T)) # $1 target name define define_target $(eval OUTPUT_FILE := $(OUTPUT_DIRECTORY)/$(strip $(1))) \ $(eval $(1): $(OUTPUT_FILE).out $(OUTPUT_FILE).hex $(OUTPUT_FILE).bin) \ $(call prepare_build, $(1), $(OUTPUT_FILE).out) endef # $1 target name # $2 library file name define define_library $(eval $(1) := $(2)) \ $(call prepare_build, $(1), $(1)) endef .PHONY: $(TARGETS) default all clean help flash all: $(TARGETS) clean: $(RM) $(OUTPUT_DIRECTORY) # Create build directories $(OUTPUT_DIRECTORY): $(MK) $@ # Create objects from C source files $(OUTPUT_DIRECTORY)/%.c.o: | $(OUTPUT_DIRECTORY) @echo Compiling file: $(notdir $($@)) $(NO_ECHO)$(CC) -MP -MD -std=c99 $(CFLAGS) $(INC_PATHS) -c -o $@ "$($@)" # Create objects from C++ source files $(OUTPUT_DIRECTORY)/%.cpp.o: | $(OUTPUT_DIRECTORY) @echo Compiling file: $(notdir $($@)) $(NO_ECHO)$(CXX) -MP -MD $(CFLAGS) $(CXXFLAGS) $(INC_PATHS) -c -o $@ "$($@)" # Create objects from assembly files $(OUTPUT_DIRECTORY)/%.S.o \ $(OUTPUT_DIRECTORY)/%.s.o.o: | $(OUTPUT_DIRECTORY) @echo Assembling file: $(notdir $($@)) $(NO_ECHO)$(CC) -MP -MD -std=c99 $(ASMFLAGS) $(INC_PATHS) -c -o $@ "$($@)" export FILE_LIST DUMP_FILE_LIST := \ "$(MAKE)" -s --no-print-directory -f $(TEMPLATE_PATH)/file_list.mk # Link object files %.out: $(eval FILE_LIST := $^ $(LIB_FILES)) $(NO_ECHO)$(DUMP_FILE_LIST) > $(@:.out=.in) @echo Linking target: $@ $(NO_ECHO)$(CC) -Wl,-Map=$(@:.out=.map) $(LDFLAGS) @$(@:.out=.in) -lm -o $@ -@echo '' $(NO_ECHO)$(SIZE) $@ -@echo '' # Create binary .bin file from the .out file %.bin: %.out @echo Preparing: $@ $(NO_ECHO)$(OBJCOPY) -O binary $< $@ # Create binary .hex file from the .out file %.hex: %.out @echo Preparing: $@ $(NO_ECHO)$(OBJCOPY) -O ihex $< $@
Trovare la differenza