mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2024-11-29 07:24:13 +01:00
OP-1792 Makefile tidy: Create a rule for all directories in Makefile
This commit is contained in:
parent
68e6231ba1
commit
2c241da639
83
Makefile
83
Makefile
@ -49,6 +49,8 @@ export BUILD_DIR := $(ROOT_DIR)/build
|
|||||||
export PACKAGE_DIR := $(ROOT_DIR)/build/package
|
export PACKAGE_DIR := $(ROOT_DIR)/build/package
|
||||||
export DIST_DIR := $(ROOT_DIR)/build/dist
|
export DIST_DIR := $(ROOT_DIR)/build/dist
|
||||||
|
|
||||||
|
DIRS = $(DL_DIR) $(TOOLS_DIR) $(BUILD_DIR) $(PACKAGE_DIR) $(DIST_DIR)
|
||||||
|
|
||||||
# Set up default build configurations (debug | release)
|
# Set up default build configurations (debug | release)
|
||||||
GCS_BUILD_CONF := release
|
GCS_BUILD_CONF := release
|
||||||
UAVOGEN_BUILD_CONF := release
|
UAVOGEN_BUILD_CONF := release
|
||||||
@ -140,20 +142,6 @@ all_clean:
|
|||||||
.PONY: clean
|
.PONY: clean
|
||||||
clean: all_clean
|
clean: all_clean
|
||||||
|
|
||||||
$(DL_DIR):
|
|
||||||
$(MKDIR) -p $@
|
|
||||||
|
|
||||||
$(TOOLS_DIR):
|
|
||||||
$(MKDIR) -p $@
|
|
||||||
|
|
||||||
$(BUILD_DIR):
|
|
||||||
$(MKDIR) -p $@
|
|
||||||
|
|
||||||
$(PACKAGE_DIR):
|
|
||||||
$(MKDIR) -p $@
|
|
||||||
|
|
||||||
$(DIST_DIR):
|
|
||||||
$(MKDIR) -p $@
|
|
||||||
|
|
||||||
##############################
|
##############################
|
||||||
#
|
#
|
||||||
@ -167,10 +155,12 @@ else
|
|||||||
UAVOGEN_SILENT := silent
|
UAVOGEN_SILENT := silent
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
UAVOBJGENERATOR_DIR = $(BUILD_DIR)/uavobjgenerator
|
||||||
|
DIRS += $(UAVOBJGENERATOR_DIR)
|
||||||
|
|
||||||
.PHONY: uavobjgenerator
|
.PHONY: uavobjgenerator
|
||||||
uavobjgenerator:
|
uavobjgenerator: | $(UAVOBJGENERATOR_DIR)
|
||||||
$(V1) $(MKDIR) -p $(BUILD_DIR)/$@
|
$(V1) ( cd $(UAVOBJGENERATOR_DIR) && \
|
||||||
$(V1) ( cd $(BUILD_DIR)/$@ && \
|
|
||||||
$(QMAKE) $(ROOT_DIR)/ground/uavobjgenerator/uavobjgenerator.pro -spec $(QT_SPEC) -r CONFIG+="$(UAVOGEN_BUILD_CONF) $(UAVOGEN_SILENT)" && \
|
$(QMAKE) $(ROOT_DIR)/ground/uavobjgenerator/uavobjgenerator.pro -spec $(QT_SPEC) -r CONFIG+="$(UAVOGEN_BUILD_CONF) $(UAVOGEN_SILENT)" && \
|
||||||
$(MAKE) --no-print-directory -w ; \
|
$(MAKE) --no-print-directory -w ; \
|
||||||
)
|
)
|
||||||
@ -183,8 +173,7 @@ uavobjects: $(addprefix uavobjects_, $(UAVOBJ_TARGETS))
|
|||||||
UAVOBJ_XML_DIR := $(ROOT_DIR)/shared/uavobjectdefinition
|
UAVOBJ_XML_DIR := $(ROOT_DIR)/shared/uavobjectdefinition
|
||||||
UAVOBJ_OUT_DIR := $(BUILD_DIR)/uavobject-synthetics
|
UAVOBJ_OUT_DIR := $(BUILD_DIR)/uavobject-synthetics
|
||||||
|
|
||||||
$(UAVOBJ_OUT_DIR):
|
DIRS += $(UAVOBJ_OUT_DIR)
|
||||||
$(V1) $(MKDIR) -p $@
|
|
||||||
|
|
||||||
uavobjects_%: $(UAVOBJ_OUT_DIR) uavobjgenerator
|
uavobjects_%: $(UAVOBJ_OUT_DIR) uavobjgenerator
|
||||||
$(V1) ( cd $(UAVOBJ_OUT_DIR) && \
|
$(V1) ( cd $(UAVOBJ_OUT_DIR) && \
|
||||||
@ -214,6 +203,8 @@ export OPUAVTALK := $(ROOT_DIR)/flight/uavtalk
|
|||||||
export OPUAVSYNTHDIR := $(BUILD_DIR)/uavobject-synthetics/flight
|
export OPUAVSYNTHDIR := $(BUILD_DIR)/uavobject-synthetics/flight
|
||||||
export OPGCSSYNTHDIR := $(BUILD_DIR)/openpilotgcs-synthetics
|
export OPGCSSYNTHDIR := $(BUILD_DIR)/openpilotgcs-synthetics
|
||||||
|
|
||||||
|
DIRS += $(OPGCSSYNTHDIR)
|
||||||
|
|
||||||
# Define supported board lists
|
# Define supported board lists
|
||||||
ALL_BOARDS := coptercontrol oplinkmini revolution osd revoproto simposix discoveryf4bare gpsplatinum
|
ALL_BOARDS := coptercontrol oplinkmini revolution osd revoproto simposix discoveryf4bare gpsplatinum
|
||||||
|
|
||||||
@ -474,11 +465,13 @@ endif
|
|||||||
.PHONY: openpilotgcs
|
.PHONY: openpilotgcs
|
||||||
openpilotgcs: uavobjects_gcs openpilotgcs_qmake openpilotgcs_make
|
openpilotgcs: uavobjects_gcs openpilotgcs_qmake openpilotgcs_make
|
||||||
|
|
||||||
|
OPENPILOTGCS_DIR := $(BUILD_DIR)/openpilotgcs_$(GCS_BUILD_CONF)
|
||||||
|
DIRS += $(OPENPILOTGCS_DIR)
|
||||||
|
|
||||||
.PHONY: openpilotgcs_qmake
|
.PHONY: openpilotgcs_qmake
|
||||||
openpilotgcs_qmake:
|
openpilotgcs_qmake: | $(OPENPILOTGCS_DIR)
|
||||||
ifeq ($(QMAKE_SKIP),)
|
ifeq ($(QMAKE_SKIP),)
|
||||||
$(V1) $(MKDIR) -p $(BUILD_DIR)/openpilotgcs_$(GCS_BUILD_CONF)
|
$(V1) ( cd $(OPENPILOTGCS_DIR) && \
|
||||||
$(V1) ( cd $(BUILD_DIR)/openpilotgcs_$(GCS_BUILD_CONF) && \
|
|
||||||
$(QMAKE) $(ROOT_DIR)/ground/openpilotgcs/openpilotgcs.pro -spec $(QT_SPEC) -r CONFIG+="$(GCS_BUILD_CONF) $(GCS_SILENT)" $(GCS_QMAKE_OPTS) \
|
$(QMAKE) $(ROOT_DIR)/ground/openpilotgcs/openpilotgcs.pro -spec $(QT_SPEC) -r CONFIG+="$(GCS_BUILD_CONF) $(GCS_SILENT)" $(GCS_QMAKE_OPTS) \
|
||||||
)
|
)
|
||||||
else
|
else
|
||||||
@ -487,15 +480,12 @@ endif
|
|||||||
|
|
||||||
.PHONY: openpilotgcs_make
|
.PHONY: openpilotgcs_make
|
||||||
openpilotgcs_make:
|
openpilotgcs_make:
|
||||||
$(V1) $(MKDIR) -p $(BUILD_DIR)/openpilotgcs_$(GCS_BUILD_CONF)
|
$(V1) $(MAKE) -w -C $(OPENPILOTGCS_DIR)/$(MAKE_DIR);
|
||||||
$(V1) ( cd $(BUILD_DIR)/openpilotgcs_$(GCS_BUILD_CONF)/$(MAKE_DIR) && \
|
|
||||||
$(MAKE) -w ; \
|
|
||||||
)
|
|
||||||
|
|
||||||
.PHONY: openpilotgcs_clean
|
.PHONY: openpilotgcs_clean
|
||||||
openpilotgcs_clean:
|
openpilotgcs_clean:
|
||||||
@$(ECHO) " CLEAN $(call toprel, $(BUILD_DIR)/openpilotgcs_$(GCS_BUILD_CONF))"
|
@$(ECHO) " CLEAN $(call toprel, $(OPENPILOTGCS_DIR))"
|
||||||
$(V1) [ ! -d "$(BUILD_DIR)/openpilotgcs_$(GCS_BUILD_CONF)" ] || $(RM) -r "$(BUILD_DIR)/openpilotgcs_$(GCS_BUILD_CONF)"
|
$(V1) [ ! -d "$(OPENPILOTGCS_DIR)" ] || $(RM) -r "$(OPENPILOTGCS_DIR)"
|
||||||
|
|
||||||
################################
|
################################
|
||||||
#
|
#
|
||||||
@ -507,11 +497,13 @@ openpilotgcs_clean:
|
|||||||
.PHONY: uploader
|
.PHONY: uploader
|
||||||
uploader: uploader_qmake uploader_make
|
uploader: uploader_qmake uploader_make
|
||||||
|
|
||||||
|
UPLOADER_DIR := $(BUILD_DIR)/uploader_$(GCS_BUILD_CONF)
|
||||||
|
DIRS += $(UPLOADER_DIR)
|
||||||
|
|
||||||
.PHONY: uploader_qmake
|
.PHONY: uploader_qmake
|
||||||
uploader_qmake:
|
uploader_qmake: | $(UPLOADER_DIR)
|
||||||
ifeq ($(QMAKE_SKIP),)
|
ifeq ($(QMAKE_SKIP),)
|
||||||
$(V1) $(MKDIR) -p $(BUILD_DIR)/uploader_$(GCS_BUILD_CONF)
|
$(V1) ( cd $(UPLOADER_DIR) && \
|
||||||
$(V1) ( cd $(BUILD_DIR)/uploader_$(GCS_BUILD_CONF) && \
|
|
||||||
$(QMAKE) $(ROOT_DIR)/ground/openpilotgcs/src/experimental/USB_UPLOAD_TOOL/upload.pro -spec $(QT_SPEC) -r CONFIG+="$(GCS_BUILD_CONF) $(GCS_SILENT)" $(GCS_QMAKE_OPTS) \
|
$(QMAKE) $(ROOT_DIR)/ground/openpilotgcs/src/experimental/USB_UPLOAD_TOOL/upload.pro -spec $(QT_SPEC) -r CONFIG+="$(GCS_BUILD_CONF) $(GCS_SILENT)" $(GCS_QMAKE_OPTS) \
|
||||||
)
|
)
|
||||||
else
|
else
|
||||||
@ -520,15 +512,12 @@ endif
|
|||||||
|
|
||||||
.PHONY: uploader_make
|
.PHONY: uploader_make
|
||||||
uploader_make:
|
uploader_make:
|
||||||
$(V1) $(MKDIR) -p $(BUILD_DIR)/uploader_$(GCS_BUILD_CONF)
|
$(V1) $(MAKE) -w -C $(UPLOADER_DIR)
|
||||||
$(V1) ( cd $(BUILD_DIR)/uploader_$(GCS_BUILD_CONF)/$(MAKE_DIR) && \
|
|
||||||
$(MAKE) -w ; \
|
|
||||||
)
|
|
||||||
|
|
||||||
.PHONY: uploader_clean
|
.PHONY: uploader_clean
|
||||||
uploader_clean:
|
uploader_clean:
|
||||||
@$(ECHO) " CLEAN $(call toprel, $(BUILD_DIR)/uploader_$(GCS_BUILD_CONF))"
|
@$(ECHO) " CLEAN $(call toprel, $(UPLOADER_DIR))"
|
||||||
$(V1) [ ! -d "$(BUILD_DIR)/uploader_$(GCS_BUILD_CONF)" ] || $(RM) -r "$(BUILD_DIR)/uploader_$(GCS_BUILD_CONF)"
|
$(V1) [ ! -d "$(UPLOADER_DIR)" ] || $(RM) -r "$(UPLOADER_DIR)"
|
||||||
|
|
||||||
|
|
||||||
# We want to take snapshots of the UAVOs at each point that they change
|
# We want to take snapshots of the UAVOs at each point that they change
|
||||||
@ -652,8 +641,7 @@ ALL_UNITTESTS := logfs math lednotification
|
|||||||
|
|
||||||
# Build the directory for the unit tests
|
# Build the directory for the unit tests
|
||||||
UT_OUT_DIR := $(BUILD_DIR)/unit_tests
|
UT_OUT_DIR := $(BUILD_DIR)/unit_tests
|
||||||
$(UT_OUT_DIR):
|
DIRS += $(UT_OUT_DIR)
|
||||||
$(V1) $(MKDIR) -p $@
|
|
||||||
|
|
||||||
.PHONY: all_ut
|
.PHONY: all_ut
|
||||||
all_ut: $(addsuffix _elf, $(addprefix ut_, $(ALL_UNITTESTS)))
|
all_ut: $(addsuffix _elf, $(addprefix ut_, $(ALL_UNITTESTS)))
|
||||||
@ -728,9 +716,8 @@ OPFW_CONTENTS := \
|
|||||||
.PHONY: opfw_resource
|
.PHONY: opfw_resource
|
||||||
opfw_resource: $(OPFW_RESOURCE)
|
opfw_resource: $(OPFW_RESOURCE)
|
||||||
|
|
||||||
$(OPFW_RESOURCE): $(FW_TARGETS)
|
$(OPFW_RESOURCE): $(FW_TARGETS) | $(OPGCSSYNTHDIR)
|
||||||
@$(ECHO) Generating OPFW resource file $(call toprel, $@)
|
@$(ECHO) Generating OPFW resource file $(call toprel, $@)
|
||||||
$(V1) $(MKDIR) -p $(dir $@)
|
|
||||||
$(V1) $(ECHO) $(QUOTE)$(OPFW_CONTENTS)$(QUOTE) > $@
|
$(V1) $(ECHO) $(QUOTE)$(OPFW_CONTENTS)$(QUOTE) > $@
|
||||||
|
|
||||||
# If opfw_resource or all firmware are requested, GCS should depend on the resource
|
# If opfw_resource or all firmware are requested, GCS should depend on the resource
|
||||||
@ -821,9 +808,8 @@ docs_all_clean:
|
|||||||
##############################
|
##############################
|
||||||
|
|
||||||
.PHONY: build-info
|
.PHONY: build-info
|
||||||
build-info:
|
build-info: | $(BUILD_DIR)
|
||||||
@$(ECHO) " BUILD-INFO $(call toprel, $(BUILD_DIR)/$@.txt)"
|
@$(ECHO) " BUILD-INFO $(call toprel, $(BUILD_DIR)/$@.txt)"
|
||||||
$(V1) $(MKDIR) -p $(BUILD_DIR)
|
|
||||||
$(V1) $(VERSION_INFO) \
|
$(V1) $(VERSION_INFO) \
|
||||||
--uavodir=$(ROOT_DIR)/shared/uavobjectdefinition \
|
--uavodir=$(ROOT_DIR)/shared/uavobjectdefinition \
|
||||||
--template="make/templates/$@.txt" \
|
--template="make/templates/$@.txt" \
|
||||||
@ -852,6 +838,17 @@ $(DIST_NAME).gz: $(DIST_VER_INFO) .git/index | $(DIST_DIR)
|
|||||||
.PHONY: dist
|
.PHONY: dist
|
||||||
dist: $(DIST_NAME).gz
|
dist: $(DIST_NAME).gz
|
||||||
|
|
||||||
|
|
||||||
|
##############################
|
||||||
|
#
|
||||||
|
# Directories
|
||||||
|
#
|
||||||
|
##############################
|
||||||
|
|
||||||
|
$(DIRS):
|
||||||
|
$(V1) $(MKDIR) -p $@
|
||||||
|
|
||||||
|
|
||||||
##############################
|
##############################
|
||||||
#
|
#
|
||||||
# Help message, the default Makefile goal
|
# Help message, the default Makefile goal
|
||||||
|
Loading…
Reference in New Issue
Block a user