1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-01-31 16:52:10 +01:00

Merged in filnet/librepilot/LP-404_make_librepilot_vendor_neutral (pull request #324)

LP-404 make Makefile more vendor neutral
This commit is contained in:
Alessio Morale 2016-09-21 21:27:14 +02:00
commit a853d511c8
2 changed files with 24 additions and 22 deletions

View File

@ -50,9 +50,9 @@ export TOOLS_DIR
export BUILD_DIR := $(CURDIR)/build export BUILD_DIR := $(CURDIR)/build
export PACKAGE_DIR := $(BUILD_DIR)/package export PACKAGE_DIR := $(BUILD_DIR)/package
export DIST_DIR := $(BUILD_DIR)/dist export DIST_DIR := $(BUILD_DIR)/dist
export OPGCSSYNTHDIR := $(BUILD_DIR)/gcs-synthetics export GCS_SYNTH_DIR := $(BUILD_DIR)/gcs-synthetics
DIRS := $(DL_DIR) $(TOOLS_DIR) $(BUILD_DIR) $(PACKAGE_DIR) $(DIST_DIR) $(OPGCSSYNTHDIR) DIRS := $(DL_DIR) $(TOOLS_DIR) $(BUILD_DIR) $(PACKAGE_DIR) $(DIST_DIR) $(GCS_SYNTH_DIR)
# Naming for binaries and packaging etc,. # Naming for binaries and packaging etc,.
export ORG_BIG_NAME := LibrePilot export ORG_BIG_NAME := LibrePilot
@ -225,9 +225,9 @@ uavobjects_clean:
# When building any of the "all_*" targets, tell all sub makefiles to display # When building any of the "all_*" targets, tell all sub makefiles to display
# additional details on each line of output to describe which build and target # additional details on each line of output to describe which build and target
# that each line applies to. The same applies also to all, opfw_resource, # that each line applies to. The same applies also to all, fw_resource,
# package targets # package targets
ifneq ($(strip $(filter all_% all opfw_resource package,$(MAKECMDGOALS))),) ifneq ($(strip $(filter all_% all fw_resource package,$(MAKECMDGOALS))),)
export ENABLE_MSG_EXTRA := yes export ENABLE_MSG_EXTRA := yes
endif endif
@ -323,38 +323,39 @@ PACKAGE_FW_TARGETS := fw_coptercontrol fw_oplinkmini fw_revolution fw_osd fw_rev
# Rules to generate GCS resources used to embed firmware binaries into the GCS. # Rules to generate GCS resources used to embed firmware binaries into the GCS.
# They are used later by the vehicle setup wizard to update board firmware. # They are used later by the vehicle setup wizard to update board firmware.
# To open a firmware image use ":/firmware/fw_coptercontrol.opfw" # To open a firmware image use ":/firmware/fw_coptercontrol.opfw"
OPFW_RESOURCE := $(OPGCSSYNTHDIR)/opfw_resource.qrc FW_RESOURCE := $(GCS_SYNTH_DIR)/fw_resource.qrc
ifeq ($(WITH_PREBUILT_FW),) ifeq ($(WITH_PREBUILT_FW),)
FIRMWARE_DIR := $(FLIGHT_OUT_DIR) FIRMWARE_DIR := $(FLIGHT_OUT_DIR)
# We need to build the FW targets # We need to build the FW targets
$(OPFW_RESOURCE): $(PACKAGE_FW_TARGETS) $(FW_RESOURCE): $(PACKAGE_FW_TARGETS)
else else
FIRMWARE_DIR := $(WITH_PREBUILT_FW) FIRMWARE_DIR := $(WITH_PREBUILT_FW)
endif endif
OPFW_FILES := $(foreach fw_targ, $(PACKAGE_FW_TARGETS), $(FIRMWARE_DIR)/$(fw_targ)/$(fw_targ).opfw) FW_FILES := $(foreach fw_targ, $(PACKAGE_FW_TARGETS), $(FIRMWARE_DIR)/$(fw_targ)/$(fw_targ).opfw)
OPFW_CONTENTS := \ FW_CONTENTS := \
<!DOCTYPE RCC><RCC version="1.0"> \ <!DOCTYPE RCC><RCC version="1.0"> \
<qresource prefix="/firmware"> \ <qresource prefix="/firmware"> \
$(foreach fw_file, $(OPFW_FILES), <file alias="$(notdir $(fw_file))">$(call system_path,$(fw_file))</file>) \ $(foreach fw_file, $(FW_FILES), <file alias="$(notdir $(fw_file))">$(call system_path,$(fw_file))</file>) \
</qresource> \ </qresource> \
</RCC> </RCC>
.PHONY: opfw_resource .PHONY: fw_resource
opfw_resource: $(OPFW_RESOURCE) fw_resource: $(FW_RESOURCE)
fw_resource: $(FW_RESOURCE)
$(OPFW_RESOURCE): | $(OPGCSSYNTHDIR) $(FW_RESOURCE): | $(GCS_SYNTH_DIR)
@$(ECHO) Generating OPFW resource file $(call toprel, $@) @$(ECHO) Generating FW resource file $(call toprel, $@)
$(V1) $(ECHO) $(QUOTE)$(OPFW_CONTENTS)$(QUOTE) > $@ $(V1) $(ECHO) $(QUOTE)$(FW_CONTENTS)$(QUOTE) > $@
# If opfw_resource or all firmware are requested, GCS should depend on the resource # If fw_resource or all firmware are requested, GCS should depend on the resource
ifneq ($(strip $(filter opfw_resource all all_fw all_flight package,$(MAKECMDGOALS))),) ifneq ($(strip $(filter fw_resource all all_fw all_flight package,$(MAKECMDGOALS))),)
$(GCS_MAKEFILE): $(OPFW_RESOURCE) $(GCS_MAKEFILE): $(FW_RESOURCE)
endif endif
# Packaging targets: package # Packaging targets: package
# - builds all firmware, opfw_resource, gcs # - builds all firmware, fw_resource, gcs
# - copies firmware into a package directory # - copies firmware into a package directory
# - calls paltform-specific packaging script # - calls paltform-specific packaging script
@ -712,7 +713,7 @@ help:
@$(ECHO) @$(ECHO)
@$(ECHO) " [Packaging]" @$(ECHO) " [Packaging]"
@$(ECHO) " package - Build and package the platform-dependent package (no clean)" @$(ECHO) " package - Build and package the platform-dependent package (no clean)"
@$(ECHO) " opfw_resource - Generate resources to embed firmware binaries into the GCS" @$(ECHO) " fw_resource - Generate resources to embed firmware binaries into the GCS"
@$(ECHO) " dist - Generate source archive for distribution" @$(ECHO) " dist - Generate source archive for distribution"
@$(ECHO) " fw_dist - Generate archive of firmware" @$(ECHO) " fw_dist - Generate archive of firmware"
@$(ECHO) " install - Install GCS to \"DESTDIR\" with prefix \"prefix\" (Linux only)" @$(ECHO) " install - Install GCS to \"DESTDIR\" with prefix \"prefix\" (Linux only)"

View File

@ -63,8 +63,9 @@ FORMS += \
RESOURCES += uploader.qrc RESOURCES += uploader.qrc
exists( ../../../../../build/gcs-synthetics/opfw_resource.qrc ) { # TODO should use GCS_SYNTH_DIR... but that will break QtCreator
RESOURCES += ../../../../../build/gcs-synthetics/opfw_resource.qrc exists( ../../../../../build/gcs-synthetics/fw_resource.qrc ) {
RESOURCES += ../../../../../build/gcs-synthetics/fw_resource.qrc
} else { } else {
message("opfw_resource.qrc is not available, automatic firmware upgrades are disabled") message("fw_resource.qrc is not available, automatic firmware upgrades are disabled")
} }