build: removed the need for 'make configure'

and make default build display help
This commit is contained in:
Andrew Tridgell 2015-05-21 10:11:20 +10:00
parent d6bf851783
commit 3fbd0a1db0
9 changed files with 16 additions and 86 deletions

View File

@ -17,11 +17,8 @@ include $(MK_DIR)/configure.mk
else
# short-circuit build for the help target
ifeq ($(MAKECMDGOALS),help)
include $(MK_DIR)/help.mk
else
# common makefile components
include $(MK_DIR)/targets.mk
include $(MK_DIR)/sketch_sources.mk
@ -59,5 +56,3 @@ endif
endif
endif
endif

View File

@ -8,7 +8,7 @@ include $(MK_DIR)/find_tools.mk
#
DEFINES = -DF_CPU=$(F_CPU)
DEFINES += -DSKETCH=\"$(SKETCH)\" -DAPM_BUILD_DIRECTORY=APM_BUILD_$(SKETCH)
DEFINES += $(EXTRAFLAGS) # from user config.mk
DEFINES += $(EXTRAFLAGS)
DEFINES += -DCONFIG_HAL_BOARD=$(HAL_BOARD)
WARNFLAGS = -Wformat -Wall -Wshadow -Wpointer-arith -Wcast-align
WARNFLAGS += -Wwrite-strings -Wformat=2 -Wno-unused-parameter -Wno-missing-field-initializers
@ -65,6 +65,9 @@ endif
# Library object files
LIBOBJS := $(SKETCHLIBOBJS)
HARDWARE ?= arduino
BOARD ?= mega2560
# Find the hardware directory to use
HARDWARE_DIR := $(firstword $(wildcard $(SKETCHBOOK)/hardware/$(HARDWARE) \
$(ARDUINO)/hardware/$(HARDWARE)))

View File

@ -14,7 +14,6 @@ endif
TOOLCHAIN = ARM
#include $(MK_DIR)/find_arduino.mk
include $(MK_DIR)/find_tools.mk
HARDWARE := leaflabs
@ -33,7 +32,7 @@ LD_MEM_DIR := sram_64k_flash_512k
#
DEFINES = -DF_CPU=$(F_CPU) -DMCU_$(MCU) -DBOARD_$(BOARD) -DERROR_LED_PORT=GPIOA -DERROR_LED_PIN=5 -DVECT_TAB_FLASH
DEFINES += -DSKETCH=\"$(SKETCH)\" -DAPM_BUILD_DIRECTORY=APM_BUILD_$(SKETCH)
DEFINES += $(EXTRAFLAGS) # from user config.mk
DEFINES += $(EXTRAFLAGS)
DEFINES += -DCONFIG_HAL_BOARD=$(HAL_BOARD)
WARNFLAGS = -Wformat -Wall -Wshadow -Wpointer-arith -Wcast-align -Wno-psabi
WARNFLAGS += -Wwrite-strings -Wformat=2

View File

@ -7,7 +7,7 @@ include $(MK_DIR)/find_tools.mk
#
DEFINES = -DF_CPU=$(F_CPU)
DEFINES += -DSKETCH=\"$(SKETCH)\" -DSKETCHNAME="\"$(SKETCH)\"" -DSKETCHBOOK="\"$(SKETCHBOOK)\"" -DAPM_BUILD_DIRECTORY=APM_BUILD_$(SKETCH)
DEFINES += $(EXTRAFLAGS) # from user config.mk
DEFINES += $(EXTRAFLAGS)
DEFINES += -DCONFIG_HAL_BOARD=$(HAL_BOARD) -DCONFIG_HAL_BOARD_SUBTYPE=$(HAL_BOARD_SUBTYPE)
WARNFLAGS = -Wformat -Wall -Wshadow -Wpointer-arith -Wcast-align -Wno-unused-parameter -Wno-missing-field-initializers
WARNFLAGS += -Wwrite-strings -Wformat=2

View File

@ -1,34 +1,2 @@
configure:
$(warning WARNING - A $(SKETCHBOOK)/config.mk file has been written)
$(warning Please edit the file to match your system configuration, if you use a different board or port)
@echo > $(SKETCHBOOK)/config.mk
@echo \# Select \'mega\' for the 1280 APM1, \'mega2560\' otherwise >> $(SKETCHBOOK)/config.mk
@echo BOARD = mega2560 >> $(SKETCHBOOK)/config.mk
@echo >> $(SKETCHBOOK)/config.mk
@echo \# HAL_BOARD determines default HAL target. >> $(SKETCHBOOK)/config.mk
@echo HAL_BOARD ?= HAL_BOARD_APM2 >> $(SKETCHBOOK)/config.mk
@echo >> $(SKETCHBOOK)/config.mk
@echo \# The communication port used to communicate with the APM. >> $(SKETCHBOOK)/config.mk
ifneq ($(findstring CYGWIN, $(SYSTYPE)),)
@echo PORT = COM3 >> $(SKETCHBOOK)/config.mk
else
@echo PORT = /dev/ttyACM0 >> $(SKETCHBOOK)/config.mk
endif
@echo >> $(SKETCHBOOK)/config.mk
@echo \# uncomment and fill in the path to Arduino if installed in an exotic location >> $(SKETCHBOOK)/config.mk
@echo \# ARDUINO = /path/to/Arduino >> $(SKETCHBOOK)/config.mk
@echo >> $(SKETCHBOOK)/config.mk
######################## PX4 ####################################
@echo \# PX4Firmware tree: fill in the path to PX4Firmware repository from github.com/diydrones: >> $(SKETCHBOOK)/config.mk
@echo PX4_ROOT=../PX4Firmware >> $(SKETCHBOOK)/config.mk
@echo >> $(SKETCHBOOK)/config.mk
@echo \# PX4NuttX tree: fill in the path to PX4NuttX repository from github.com/diydrones: >> $(SKETCHBOOK)/config.mk
@echo NUTTX_SRC=../PX4NuttX/nuttx >> $(SKETCHBOOK)/config.mk
###################### VRBRAIN ##################################
@echo \# VRBRAIN Firmware tree: >> $(SKETCHBOOK)/config.mk
@echo VRBRAIN_ROOT=../VRNuttX >> $(SKETCHBOOK)/config.mk
@echo >> $(SKETCHBOOK)/config.mk
@echo \# VRBRAIN NuttX tree: >> $(SKETCHBOOK)/config.mk
@echo VRBRAIN_NUTTX_SRC=../VRNuttX/NuttX/nuttx >> $(SKETCHBOOK)/config.mk
@echo >> $(SKETCHBOOK)/config.mk
@echo "make configure is no longer required"

View File

@ -107,19 +107,6 @@ ifneq ($(findstring CYGWIN, $(SYSTYPE)),)
endif
endif
# Jump over the next makefile sections when runing a "make configure"
ifneq ($(MAKECMDGOALS),configure)
################################################################################
# Config options
#
# The Makefile calling us must specify BOARD
#
include $(SKETCHBOOK)/config.mk
ifeq ($(PORT),)
$(error ERROR: could not locate $(SKETCHBOOK)/config.mk, please run 'make configure' first and edit config.mk)
endif
ifneq ($(APPDIR),)
# this is a recusive PX4 build
HAL_BOARD = HAL_BOARD_PX4
@ -194,20 +181,9 @@ ifneq ($(findstring flymaple, $(MAKECMDGOALS)),)
HAL_BOARD = HAL_BOARD_FLYMAPLE
endif
# default to APM2
# default to SITL
ifeq ($(HAL_BOARD),)
#$(warning No HAL_BOARD in config.mk - defaulting to HAL_BOARD_APM2)
HAL_BOARD = HAL_BOARD_APM2
HAL_BOARD_SUBTYPE = HAL_BOARD_SUBTYPE_AVR_APM2
HAL_BOARD = HAL_BOARD_SITL
HAL_BOARD_SUBTYPE = HAL_BOARD_SUBTYPE_NONE
endif
HARDWARE ?= arduino
ifeq ($(BOARD),)
BOARD = mega2560
endif
ifneq ($(findstring apm1-1280, $(MAKECMDGOALS)),)
BOARD = mega
endif
endif

View File

@ -8,20 +8,18 @@ help:
@echo ""
@echo " Before building a target you need to be in the target vehicle type directory"
@echo " e.g. ArduPlane, ArduCopter, APMrover2, AntennaTracker"
@echo " and run \"make configure\""
@echo ""
@echo " Most targets support a \"-upload\" extension to upload the firmware"
@echo " to a connected board. e.g. \"make px4-v2-upload\""
@echo ""
@echo " Some targets support a \"-debug\" extension to enable a debug build"
@echo " (with debug symbols, and without optimisation)"
@echo ""
@echo " Note that the px4 builds are NOT parallel safe, NO -j flag"
@echo ""
@echo " Targets"
@echo " -------"
@echo ""
@echo " configure - Set up build for vehicle type"
@echo ""
@echo " all - Build all targets"
@echo ""
@echo " apm1 - the APM1 board"
@echo " apm2 - the APM2 board"
@echo " px4-v1 - the PX4v1 board"

View File

@ -1,6 +1,6 @@
# PX4 build is via external build system
ifneq ($(PX4_ROOT),)
PX4_ROOT=../PX4Firmware
# cope with relative paths
ifeq ($(wildcard $(PX4_ROOT)/nuttx-configs),)
@ -171,13 +171,3 @@ $(PX4_ROOT)/Archives/px4io-v2.export:
px4-archives:
$(v) $(PX4_MAKE_ARCHIVES)
else
px4:
$(error ERROR: You need to add PX4_ROOT to your config.mk)
px4-clean: px4
px4-upload: px4
endif

View File

@ -1,4 +1,4 @@
default: all
default: help
# convenient targets for our supported boards
sitl: HAL_BOARD = HAL_BOARD_SITL
@ -16,6 +16,7 @@ apm1: all
apm1-1280: HAL_BOARD = HAL_BOARD_APM1
apm1-1280: TOOLCHAIN = AVR
apm1-1280: all
apm1-1280: BOARD = mega
apm2: HAL_BOARD = HAL_BOARD_APM2
apm2: TOOLCHAIN = AVR