mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-31 05:21:35 +08:00
Makefile cleanup and travis-ci s3 deploy (#6329)
- pulls more of the travis-ci s3 deploy into the repo so we can potentially migrate to another CI system - fixed the sizes output and added verbose compiler version to cmake (#6322) - fixed filenames for firmware uploaded to s3 (was broken by the changes yesterday) - fixed some broken git version display in cmake - Makefile organization - simplified .travis.yml - added a print to know which config the nuttx patch was being applied to - docker_run.sh now respects PX4_DOCKER_REPO for setting the docker image, but defaults to the good production nuttx image
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
############################################################################
|
||||
#
|
||||
# Copyright (c) 2015 - 2016 PX4 Development Team. All rights reserved.
|
||||
# Copyright (c) 2015 - 2017 PX4 Development Team. All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
@@ -116,8 +116,7 @@ define cmake-build
|
||||
+@$(eval BUILD_DIR = $(SRC_DIR)/build_$@$(BUILD_DIR_SUFFIX))
|
||||
+@if [ $(PX4_CMAKE_GENERATOR) = "Ninja" ] && [ -e $(BUILD_DIR)/Makefile ]; then rm -rf $(BUILD_DIR); fi
|
||||
+@if [ ! -e $(BUILD_DIR)/CMakeCache.txt ]; then mkdir -p $(BUILD_DIR) && cd $(BUILD_DIR) && cmake $(2) -G"$(PX4_CMAKE_GENERATOR)" -DCONFIG=$(1) $(CMAKE_ARGS) || (rm -rf $(BUILD_DIR)); fi
|
||||
+@echo "PX4 CONFIG: $(BUILD_DIR)"
|
||||
+@$(PX4_MAKE) -C "$(BUILD_DIR)" $(PX4_MAKE_ARGS) $(ARGS)
|
||||
+@(cd $(BUILD_DIR) && $(PX4_MAKE) $(PX4_MAKE_ARGS) $(ARGS))
|
||||
endef
|
||||
|
||||
define colorecho
|
||||
@@ -151,56 +150,20 @@ posix: posix_sitl_default
|
||||
broadcast: posix_sitl_broadcast
|
||||
|
||||
# Multi- config targets.
|
||||
|
||||
eagle_default: posix_eagle_default qurt_eagle_default
|
||||
eagle_legacy_default: posix_eagle_legacy qurt_eagle_legacy
|
||||
excelsior_default: posix_excelsior_default qurt_excelsior_default
|
||||
|
||||
# Deprecated config targets.
|
||||
|
||||
ros_sitl_default:
|
||||
@echo "This target is deprecated. Use make 'posix_sitl_default gazebo' instead."
|
||||
|
||||
_sitl_deprecation:
|
||||
@echo "Deprecated. Use 'make posix_sitl_default jmavsim' or"
|
||||
@echo "'make posix_sitl_default gazebo' if Gazebo is preferred."
|
||||
|
||||
run_sitl_quad: _sitl_deprecation
|
||||
run_sitl_plane: _sitl_deprecation
|
||||
run_sitl_ros: _sitl_deprecation
|
||||
|
||||
# All targets with just dependencies but no recipe must either be marked as phony (or have the special @: as recipe).
|
||||
.PHONY: all posix broadcast eagle_default eagle_legacy_default excelsior_default run_sitl_quad run_sitl_plane run_sitl_ros all_nuttx_targets
|
||||
.PHONY: all posix broadcast eagle_default eagle_legacy_default excelsior_default all_nuttx_targets
|
||||
|
||||
# Other targets
|
||||
# --------------------------------------------------------------------
|
||||
|
||||
.PHONY: uavcan_firmware compiler_version check check_format format unittest tests qgc_firmware alt_firmware package_firmware clean submodulesclean distclean
|
||||
.NOTPARALLEL:
|
||||
.PHONY: qgc_firmware alt_firmware checks_bootloaders uavcan_firmware sizes check quick_check
|
||||
|
||||
# All targets with just dependencies but no recipe must either be marked as phony (or have the special @: as recipe).
|
||||
.PHONY: checks_defaults checks_bootloaders checks_tests checks_uavcan checks_sitls checks_last quick_check tests extra_firmware
|
||||
|
||||
uavcan_firmware:
|
||||
ifeq ($(VECTORCONTROL),1)
|
||||
$(call colorecho,"Downloading and building Vector control (FOC) firmware for the S2740VC and PX4ESC 1.6")
|
||||
@(rm -rf vectorcontrol && git clone --quiet --depth 1 https://github.com/thiemar/vectorcontrol.git && cd vectorcontrol && BOARD=s2740vc_1_0 make --silent --no-print-directory && BOARD=px4esc_1_6 make --silent --no-print-directory && ../Tools/uavcan_copy.sh)
|
||||
endif
|
||||
|
||||
check_px4fmu-v4_default: uavcan_firmware
|
||||
|
||||
check_px4fmu-v4_default_and_uavcan: check_px4fmu-v4_default
|
||||
@echo VECTORCONTROL=$VECTORCONTROL
|
||||
ifeq ($(VECTORCONTROL),1)
|
||||
@echo "Cleaning up vectorcontrol firmware"
|
||||
@rm -rf vectorcontrol
|
||||
@rm -rf ROMFS/px4fmu_common/uavcan
|
||||
endif
|
||||
|
||||
sizes:
|
||||
@-find build_* -name firmware_nuttx -type f | xargs size 2> /dev/null || :
|
||||
|
||||
# QGroundControl flashable firmware (currently built by travis-ci)
|
||||
# QGroundControl flashable NuttX firmware
|
||||
qgc_firmware: \
|
||||
check_aerofc-v1_default \
|
||||
check_crazyflie_default \
|
||||
@@ -211,7 +174,9 @@ qgc_firmware: \
|
||||
check_px4fmu-v3_default \
|
||||
check_px4fmu-v4_default \
|
||||
check_tap-v1_default \
|
||||
check_sizes
|
||||
|
||||
# Other NuttX firmware
|
||||
alt_firmware: \
|
||||
check_auav-x21_default \
|
||||
check_px4-stm32f4discovery_default \
|
||||
@@ -221,8 +186,7 @@ alt_firmware: \
|
||||
check_px4fmu-v5_default \
|
||||
check_px4nucleoF767ZI-v1_default \
|
||||
check_s2740vc-v1_default \
|
||||
|
||||
checks_defaults: qgc_firmware alt_firmware
|
||||
check_sizes
|
||||
|
||||
checks_bootloaders: \
|
||||
check_esc35-v1_bootloader \
|
||||
@@ -231,41 +195,68 @@ checks_bootloaders: \
|
||||
check_px4flow-v2_bootloader \
|
||||
check_s2740vc-v1_bootloader \
|
||||
check_zubaxgnss-v1_bootloader \
|
||||
check_sizes
|
||||
|
||||
checks_uavcan: \
|
||||
check_px4fmu-v4_default_and_uavcan
|
||||
uavcan_firmware:
|
||||
$(call colorecho,"Downloading and building Vector control (FOC) firmware for the S2740VC and PX4ESC 1.6")
|
||||
@rm -rf vectorcontrol
|
||||
@git clone --quiet --depth 1 https://github.com/thiemar/vectorcontrol.git && cd vectorcontrol
|
||||
@BOARD=s2740vc_1_0 make --silent --no-print-directory
|
||||
@BOARD=px4esc_1_6 make --silent --no-print-directory && $(SRC_DIR)/Tools/uavcan_copy.sh)
|
||||
|
||||
checks_last: \
|
||||
tests \
|
||||
check_format \
|
||||
|
||||
compiler_version:
|
||||
-arm-none-eabi-gcc --version
|
||||
sizes:
|
||||
@-find build_* -name firmware_nuttx -type f | xargs size 2> /dev/null || :
|
||||
|
||||
# All default targets that don't require a special build environment (currently built on semaphore-ci)
|
||||
check: compiler_version checks_defaults checks_bootloaders checks_tests checks_uavcan checks_last sizes
|
||||
# All default targets that don't require a special build environment
|
||||
check: check_posix_sitl_default qgc_firmware alt_firmware checks_bootloaders tests check_format
|
||||
|
||||
# quick_check builds a single nuttx and posix target, runs testing, and checks the style
|
||||
quick_check: compiler_version check_posix_sitl_default check_px4fmu-v3_default tests check_format sizes
|
||||
|
||||
check_format:
|
||||
$(call colorecho,"Checking formatting with astyle")
|
||||
@./Tools/check_code_style_all.sh
|
||||
@git diff --check
|
||||
|
||||
format:
|
||||
$(call colorecho,"Formatting with astyle")
|
||||
@./Tools/check_code_style_all.sh --fix
|
||||
quick_check: check_posix_sitl_default check_px4fmu-v3_default tests check_format
|
||||
|
||||
check_%:
|
||||
@echo
|
||||
$(call colorecho,"Building" $(subst check_,,$@))
|
||||
@$(MAKE) --no-print-directory $(subst check_,,$@) package
|
||||
@mkdir -p Packages
|
||||
@cp build_$(subst check_,,$@)/*.zip Packages
|
||||
@rm -rf build_$(subst check_,,$@)
|
||||
@$(MAKE) --no-print-directory $(subst check_,,$@)
|
||||
@echo
|
||||
|
||||
# S3 upload helpers
|
||||
# --------------------------------------------------------------------
|
||||
# s3cmd uses these ENV variables
|
||||
# AWS_ACCESS_KEY_ID
|
||||
# AWS_SECRET_ACCESS_KEY
|
||||
# AWS_S3_BUCKET
|
||||
.PHONY: s3put_firmware s3put_qgc_firmware
|
||||
|
||||
Firmware.zip:
|
||||
@rm -rf Firmware.zip
|
||||
@zip --junk-paths Firmware.zip `find . -name nuttx-\*.px4`
|
||||
|
||||
s3put_firmware: Firmware.zip
|
||||
$(SRC_DIR)/Tools/s3put.sh Firmware.zip
|
||||
|
||||
s3put_qgc_firmware: qgc_firmware
|
||||
@$(SRC_DIR)/Tools/s3put.sh $(SRC_DIR)/build_px4fmu-v3_default/airframes.xml
|
||||
@$(SRC_DIR)/Tools/s3put.sh $(SRC_DIR)/build_px4fmu-v3_default/parameters.xml
|
||||
@find $(SRC_DIR)/build_* -name "*.px4" -exec $(SRC_DIR)/Tools/s3put.sh "{}" \;
|
||||
|
||||
# Astyle
|
||||
# --------------------------------------------------------------------
|
||||
.PHONY: check_format format
|
||||
|
||||
check_format:
|
||||
$(call colorecho,"Checking formatting with astyle")
|
||||
@$(SRC_DIR)/Tools/check_code_style_all.sh
|
||||
@git diff --check
|
||||
|
||||
format:
|
||||
$(call colorecho,"Formatting with astyle")
|
||||
@$(SRC_DIR)/Tools/check_code_style_all.sh --fix
|
||||
|
||||
# Testing
|
||||
# --------------------------------------------------------------------
|
||||
.PHONY: unittest run_tests_posix tests tests_coverage
|
||||
|
||||
unittest: posix_sitl_default
|
||||
$(call cmake-build,unittest,$(SRC_DIR)/unittests)
|
||||
@(cd build_unittest && ctest -j2 --output-on-failure)
|
||||
@@ -285,6 +276,12 @@ tests_coverage:
|
||||
@genhtml --legend --show-details --function-coverage --quiet --output-directory coverage-html coverage.info
|
||||
@$(MAKE) --no-print-directory posix_sitl_default test_results_junit
|
||||
|
||||
|
||||
|
||||
# Clang analyzers
|
||||
# --------------------------------------------------------------------
|
||||
.PHONY: scan-build clang-check clang-tidy
|
||||
|
||||
scan-build:
|
||||
@export CCACHE_DISABLE=1
|
||||
@mkdir -p $(SRC_DIR)/build_posix_sitl_default_scan-build
|
||||
@@ -299,12 +296,13 @@ clang-tidy:
|
||||
@CC=clang CXX=clang++ $(MAKE) --no-print-directory posix_sitl_default
|
||||
@$(SRC_DIR)/Tools/clang-tool.sh -b build_posix_sitl_default -t clang-tidy
|
||||
|
||||
package_firmware:
|
||||
@./Tools/package_firmware.py
|
||||
# Cleanup
|
||||
# --------------------------------------------------------------------
|
||||
.PHONY: clean submodulesclean distclean
|
||||
|
||||
clean:
|
||||
@rm -rf build_*/
|
||||
-@$(MAKE) -C NuttX/nuttx clean
|
||||
@rm -rf $(SRC_DIR)/build_*/
|
||||
-@$(MAKE) --no-print-directory -C NuttX/nuttx clean
|
||||
|
||||
submodulesclean:
|
||||
@git submodule sync --recursive
|
||||
@@ -314,13 +312,13 @@ submodulesclean:
|
||||
distclean: submodulesclean
|
||||
@git clean -ff -x -d -e ".project" -e ".cproject" -e ".idea"
|
||||
|
||||
# --------------------------------------------------------------------
|
||||
|
||||
# All other targets are handled by PX4_MAKE. Add a rule here to avoid printing an error.
|
||||
%:
|
||||
$(if $(filter $(FIRST_ARG),$@), \
|
||||
$(error "$@ cannot be the first argument. Use '$(MAKE) help|list_config_targets' to get a list of all possible [configuration] targets."),@#)
|
||||
|
||||
.PHONY: clean
|
||||
|
||||
CONFIGS:=$(shell ls cmake/configs | sed -e "s~.*/~~" | sed -e "s~\..*~~")
|
||||
|
||||
#help:
|
||||
|
||||
Reference in New Issue
Block a user