2015-04-10 01:32:04 +09:00
|
|
|
# Hey Emacs, this is a -*- makefile -*-
|
|
|
|
#----------------------------------------------------------------------------
|
|
|
|
# WinAVR Makefile Template written by Eric B. Weddington, Jg Wunsch, et al.
|
|
|
|
#
|
|
|
|
# Released to the Public Domain
|
|
|
|
#
|
|
|
|
# Additional material for this makefile was written by:
|
|
|
|
# Peter Fleury
|
|
|
|
# Tim Henigan
|
|
|
|
# Colin O'Flynn
|
|
|
|
# Reiner Patommel
|
|
|
|
# Markus Pfaff
|
|
|
|
# Sander Pool
|
|
|
|
# Frederik Rouleau
|
|
|
|
# Carlos Lamas
|
|
|
|
#
|
2016-06-21 10:21:43 -04:00
|
|
|
|
2016-07-31 13:24:25 +03:00
|
|
|
# Enable vpath seraching for source files only
|
|
|
|
# Without this, output files, could be read from the wrong .build directories
|
|
|
|
VPATH_SRC := $(VPATH)
|
|
|
|
vpath %.c $(VPATH_SRC)
|
|
|
|
vpath %.h $(VPATH_SRC)
|
|
|
|
vpath %.cpp $(VPATH_SRC)
|
2016-08-22 09:16:08 +03:00
|
|
|
vpath %.cc $(VPATH_SRC)
|
2016-07-31 13:24:25 +03:00
|
|
|
vpath %.hpp $(VPATH_SRC)
|
|
|
|
vpath %.S $(VPATH_SRC)
|
|
|
|
VPATH :=
|
|
|
|
|
2016-08-15 08:20:16 +03:00
|
|
|
# Convert all SRC to OBJ
|
|
|
|
define OBJ_FROM_SRC
|
2018-12-15 14:31:56 +09:00
|
|
|
$(patsubst %.c,$1/%.o,$(patsubst %.cpp,$1/%.o,$(patsubst %.cc,$1/%.o,$(patsubst %.S,$1/%.o,$(patsubst %.clib,$1/%.a,$($1_SRC))))))
|
2016-08-15 08:20:16 +03:00
|
|
|
endef
|
|
|
|
$(foreach OUTPUT,$(OUTPUTS),$(eval $(OUTPUT)_OBJ +=$(call OBJ_FROM_SRC,$(OUTPUT))))
|
|
|
|
|
|
|
|
# Define a list of all objects
|
|
|
|
OBJ := $(foreach OUTPUT,$(OUTPUTS),$($(OUTPUT)_OBJ))
|
2018-12-15 14:31:56 +09:00
|
|
|
NO_LTO_OBJ := $(filter %.a,$(OBJ))
|
2016-08-15 08:20:16 +03:00
|
|
|
|
|
|
|
MASTER_OUTPUT := $(firstword $(OUTPUTS))
|
|
|
|
|
|
|
|
|
2015-04-10 01:32:04 +09:00
|
|
|
|
|
|
|
# Output format. (can be srec, ihex, binary)
|
|
|
|
FORMAT = ihex
|
|
|
|
|
2016-06-17 17:25:58 -07:00
|
|
|
# Optimization level, can be [0, 1, 2, 3, s].
|
2015-04-10 01:32:04 +09:00
|
|
|
# 0 = turn off optimization. s = optimize for size.
|
|
|
|
# (Note: 3 is not always the best optimization level. See avr-libc FAQ.)
|
2020-05-20 16:28:39 +01:00
|
|
|
OPT ?= s
|
2015-04-10 01:32:04 +09:00
|
|
|
|
|
|
|
# Compiler flag to set the C Standard level.
|
|
|
|
# c89 = "ANSI" C
|
|
|
|
# gnu89 = c89 plus GCC extensions
|
|
|
|
# c99 = ISO C99 standard (not yet fully implemented)
|
|
|
|
# gnu99 = c99 plus GCC extensions
|
|
|
|
CSTANDARD = -std=gnu99
|
|
|
|
|
|
|
|
|
|
|
|
# Place -D or -U options here for C sources
|
2016-08-15 08:20:16 +03:00
|
|
|
#CDEFS +=
|
2015-04-10 01:32:04 +09:00
|
|
|
|
|
|
|
|
|
|
|
# Place -D or -U options here for ASM sources
|
2016-08-15 08:20:16 +03:00
|
|
|
#ADEFS +=
|
2015-04-10 01:32:04 +09:00
|
|
|
|
|
|
|
|
|
|
|
# Place -D or -U options here for C++ sources
|
2020-01-04 12:21:08 +11:00
|
|
|
#CXXDEFS += -D__STDC_LIMIT_MACROS
|
|
|
|
#CXXDEFS += -D__STDC_CONSTANT_MACROS
|
|
|
|
#CXXDEFS +=
|
2016-08-15 08:20:16 +03:00
|
|
|
|
2015-04-10 01:32:04 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#---------------- Compiler Options C ----------------
|
|
|
|
# -g*: generate debugging information
|
|
|
|
# -O*: optimization level
|
|
|
|
# -f...: tuning, see GCC manual and avr-libc documentation
|
|
|
|
# -Wall...: warning level
|
|
|
|
# -Wa,...: tell GCC to pass this to the assembler.
|
|
|
|
# -adhlns...: create assembler listing
|
2020-12-31 15:20:56 +09:00
|
|
|
DEBUG_ENABLE ?= yes
|
|
|
|
ifeq ($(strip $(SKIP_DEBUG_INFO)),yes)
|
|
|
|
DEBUG_ENABLE=no
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(strip $(DEBUG_ENABLE)),yes)
|
2018-12-15 14:31:56 +09:00
|
|
|
CFLAGS += -g$(DEBUG)
|
|
|
|
endif
|
2015-04-10 01:32:04 +09:00
|
|
|
CFLAGS += $(CDEFS)
|
|
|
|
CFLAGS += -O$(OPT)
|
Makefile redo & other features (#395)
* .build containment implemented
* no destructive variable setting - builds in either folder
* make from 3 places
* cleans before each build
* make from root with keyboard=keyboard, keymap=keymap
* make from keyboard/keyboard with keymap=keymap
* make from keymaps/keymap
* only implemented on planck
* adds color diag to avr-gcc
* makefiles for all plancks, clean-up
* quick build-all makefile for plancks
* reformatting of make output (colors)
* color toggle, tmk path corrections
* correct if statement for color
* move config.h to main makefile, updates preonic, atomic
* format update, all keyboards targets
* makefile optional for build all target, alps and arrow_pad updated
* alps updated
* make planck default, trying out travis recipe for all-keyboards
* all-keymaps target, different travis recipe
* updates alps64
* updates keyboards to new format
* updates clue* projects
* all projects updated, specialise EZ .hex, let .hex through
* updates travis
* automatically find root, keyboard, keymap
* silent echo, cleaned-up mass make output
* updates all keyboards' .hex files except EZ
* Rename Bantam44.c to bantam44.c
* Rename Bantam44.h to bantam44.h
* nananana
* adds six key keyboard
* does same to ez as rest
* updates send_string example
* brings ergodox_ez up to date
* updates template/new project script
* adds sixkeyboard
* adds readme for sixkeyboard
* adds sixkeyboard to travis
* filenames, gitignore mess
* define clock prescaler stuff manually
* make quick, size test example
* documentation and dfu-no-build
2016-06-11 13:31:31 -04:00
|
|
|
# add color
|
|
|
|
ifeq ($(COLOR),true)
|
2016-06-23 22:18:20 -04:00
|
|
|
ifeq ("$(shell echo "int main(){}" | $(CC) -fdiagnostics-color -x c - -o /dev/null 2>&1)", "")
|
Makefile redo & other features (#395)
* .build containment implemented
* no destructive variable setting - builds in either folder
* make from 3 places
* cleans before each build
* make from root with keyboard=keyboard, keymap=keymap
* make from keyboard/keyboard with keymap=keymap
* make from keymaps/keymap
* only implemented on planck
* adds color diag to avr-gcc
* makefiles for all plancks, clean-up
* quick build-all makefile for plancks
* reformatting of make output (colors)
* color toggle, tmk path corrections
* correct if statement for color
* move config.h to main makefile, updates preonic, atomic
* format update, all keyboards targets
* makefile optional for build all target, alps and arrow_pad updated
* alps updated
* make planck default, trying out travis recipe for all-keyboards
* all-keymaps target, different travis recipe
* updates alps64
* updates keyboards to new format
* updates clue* projects
* all projects updated, specialise EZ .hex, let .hex through
* updates travis
* automatically find root, keyboard, keymap
* silent echo, cleaned-up mass make output
* updates all keyboards' .hex files except EZ
* Rename Bantam44.c to bantam44.c
* Rename Bantam44.h to bantam44.h
* nananana
* adds six key keyboard
* does same to ez as rest
* updates send_string example
* brings ergodox_ez up to date
* updates template/new project script
* adds sixkeyboard
* adds readme for sixkeyboard
* adds sixkeyboard to travis
* filenames, gitignore mess
* define clock prescaler stuff manually
* make quick, size test example
* documentation and dfu-no-build
2016-06-11 13:31:31 -04:00
|
|
|
CFLAGS+= -fdiagnostics-color
|
|
|
|
endif
|
|
|
|
endif
|
2015-04-10 01:32:04 +09:00
|
|
|
CFLAGS += -Wall
|
|
|
|
CFLAGS += -Wstrict-prototypes
|
2017-04-13 16:12:55 +03:00
|
|
|
ifneq ($(strip $(ALLOW_WARNINGS)), yes)
|
|
|
|
CFLAGS += -Werror
|
|
|
|
endif
|
2015-04-10 01:32:04 +09:00
|
|
|
#CFLAGS += -mshort-calls
|
|
|
|
#CFLAGS += -fno-unit-at-a-time
|
|
|
|
#CFLAGS += -Wundef
|
|
|
|
#CFLAGS += -Wunreachable-code
|
|
|
|
#CFLAGS += -Wsign-compare
|
|
|
|
CFLAGS += -Wa,-adhlns=$(@:%.o=%.lst)
|
|
|
|
CFLAGS += $(CSTANDARD)
|
|
|
|
|
|
|
|
#---------------- Compiler Options C++ ----------------
|
|
|
|
# -g*: generate debugging information
|
|
|
|
# -O*: optimization level
|
|
|
|
# -f...: tuning, see GCC manual and avr-libc documentation
|
|
|
|
# -Wall...: warning level
|
|
|
|
# -Wa,...: tell GCC to pass this to the assembler.
|
|
|
|
# -adhlns...: create assembler listing
|
2020-12-31 15:20:56 +09:00
|
|
|
ifeq ($(strip $(DEBUG_ENABLE)),yes)
|
2020-01-04 12:21:08 +11:00
|
|
|
CXXFLAGS += -g$(DEBUG)
|
2018-12-15 14:31:56 +09:00
|
|
|
endif
|
2020-01-04 12:21:08 +11:00
|
|
|
CXXFLAGS += $(CXXDEFS)
|
|
|
|
CXXFLAGS += -O$(OPT)
|
2015-04-10 01:32:04 +09:00
|
|
|
# to supress "warning: only initialized variables can be placed into program memory area"
|
2020-01-04 12:21:08 +11:00
|
|
|
CXXFLAGS += -w
|
|
|
|
CXXFLAGS += -Wall
|
|
|
|
CXXFLAGS += -Wundef
|
2017-04-13 16:12:55 +03:00
|
|
|
ifneq ($(strip $(ALLOW_WARNINGS)), yes)
|
2020-01-04 12:21:08 +11:00
|
|
|
CXXFLAGS += -Werror
|
2017-04-13 16:12:55 +03:00
|
|
|
endif
|
2020-01-04 12:21:08 +11:00
|
|
|
#CXXFLAGS += -mshort-calls
|
|
|
|
#CXXFLAGS += -fno-unit-at-a-time
|
|
|
|
#CXXFLAGS += -Wstrict-prototypes
|
|
|
|
#CXXFLAGS += -Wunreachable-code
|
|
|
|
#CXXFLAGS += -Wsign-compare
|
|
|
|
CXXFLAGS += -Wa,-adhlns=$(@:%.o=%.lst)
|
|
|
|
#CXXFLAGS += $(CSTANDARD)
|
2015-04-10 01:32:04 +09:00
|
|
|
|
|
|
|
#---------------- Assembler Options ----------------
|
|
|
|
# -Wa,...: tell GCC to pass this to the assembler.
|
|
|
|
# -adhlns: create listing
|
|
|
|
# -gstabs: have the assembler create line number information; note that
|
|
|
|
# for use in COFF files, additional information about filenames
|
|
|
|
# and function names needs to be present in the assembler source
|
|
|
|
# files -- see avr-libc docs [FIXME: not yet described there]
|
2016-06-17 17:25:58 -07:00
|
|
|
# -listing-cont-lines: Sets the maximum number of continuation lines of hex
|
2015-04-10 01:32:04 +09:00
|
|
|
# dump that will be displayed for a given single line of source input.
|
Remove AUTOGEN and fix Travis Compiled Push scripts (#5077)
* Grab HEX and BIN files from autogen
And push them to qmk.fm/compiled
* Make autogen copy extension agnostic
This way, when travis cl scrpit looks for hex files, it will actually grab bin files, and not hex files for ARM boards
* Handle the AUTOGEN in :bin target to properly handle edge cases
Both the TADA68 and ATSAM boards generate the hex file and then convert it to a bin file. The changes I made does not handle this well, at all. This removes the hex and replaces it with a bin, if a bin is normally generated.
* Revert hex target to original copy command
* Check hex and bin separately in compile push script
Since I don't know how to script this, well
* Simplify push to compiled folder
* Further simplify compiled push script
* Move AUTOGEN parsing to a more sane location to prevent tech debt
Thanks to skully!
* Remove AUTOGEN completely, as it's not needed
This has the benefit of making everything super simple, since we can pull every hex and bin from the root of the qmk_firmware folder, and move that to th compiled folder. This also removes old and unneeded code, and removes some tech debt that has been accrued, without adding more, in theory.
2019-02-12 16:46:04 -08:00
|
|
|
ASFLAGS += $(ADEFS)
|
2020-12-31 15:20:56 +09:00
|
|
|
ifeq ($(strip $(DEBUG_ENABLE)),yes)
|
2018-12-15 14:31:56 +09:00
|
|
|
ASFLAGS += -Wa,-adhlns=$(@:%.o=%.lst),-gstabs,--listing-cont-lines=100
|
|
|
|
else
|
|
|
|
ASFLAGS += -Wa,-adhlns=$(@:%.o=%.lst),--listing-cont-lines=100
|
|
|
|
endif
|
2015-04-10 01:32:04 +09:00
|
|
|
|
|
|
|
#---------------- Library Options ----------------
|
|
|
|
# Minimalistic printf version
|
|
|
|
PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min
|
|
|
|
|
|
|
|
# Floating point printf version (requires MATH_LIB = -lm below)
|
|
|
|
PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt
|
|
|
|
|
|
|
|
# If this is left blank, then it will use the Standard printf version.
|
2016-06-17 17:25:58 -07:00
|
|
|
PRINTF_LIB =
|
2015-04-10 01:32:04 +09:00
|
|
|
#PRINTF_LIB = $(PRINTF_LIB_MIN)
|
|
|
|
#PRINTF_LIB = $(PRINTF_LIB_FLOAT)
|
|
|
|
|
|
|
|
|
|
|
|
# Minimalistic scanf version
|
|
|
|
SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min
|
|
|
|
|
|
|
|
# Floating point + %[ scanf version (requires MATH_LIB = -lm below)
|
|
|
|
SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt
|
|
|
|
|
|
|
|
# If this is left blank, then it will use the Standard scanf version.
|
2016-06-17 17:25:58 -07:00
|
|
|
SCANF_LIB =
|
2015-04-10 01:32:04 +09:00
|
|
|
#SCANF_LIB = $(SCANF_LIB_MIN)
|
|
|
|
#SCANF_LIB = $(SCANF_LIB_FLOAT)
|
|
|
|
|
|
|
|
|
|
|
|
MATH_LIB = -lm
|
2016-08-27 17:43:35 +03:00
|
|
|
CREATE_MAP ?= yes
|
2015-04-10 01:32:04 +09:00
|
|
|
|
|
|
|
|
|
|
|
#---------------- Linker Options ----------------
|
|
|
|
# -Wl,...: tell GCC to pass this to linker.
|
|
|
|
# -Map: create map file
|
|
|
|
# --cref: add cross reference to map file
|
|
|
|
#
|
|
|
|
# Comennt out "--relax" option to avoid a error such:
|
|
|
|
# (.vectors+0x30): relocation truncated to fit: R_AVR_13_PCREL against symbol `__vector_12'
|
|
|
|
#
|
2016-08-27 17:43:35 +03:00
|
|
|
|
|
|
|
ifeq ($(CREATE_MAP),yes)
|
|
|
|
LDFLAGS += -Wl,-Map=$(BUILD_DIR)/$(TARGET).map,--cref
|
|
|
|
endif
|
2015-04-10 01:32:04 +09:00
|
|
|
#LDFLAGS += -Wl,--relax
|
|
|
|
LDFLAGS += $(EXTMEMOPTS)
|
|
|
|
LDFLAGS += $(patsubst %,-L%,$(EXTRALIBDIRS))
|
|
|
|
LDFLAGS += $(PRINTF_LIB) $(SCANF_LIB) $(MATH_LIB)
|
|
|
|
#LDFLAGS += -T linker_script.x
|
|
|
|
# You can give EXTRALDFLAGS at 'make' command line.
|
|
|
|
LDFLAGS += $(EXTRALDFLAGS)
|
|
|
|
|
|
|
|
# Define programs and commands.
|
|
|
|
SHELL = sh
|
|
|
|
REMOVE = rm -f
|
|
|
|
REMOVEDIR = rmdir
|
|
|
|
COPY = cp
|
|
|
|
WINSHELL = cmd
|
Makefile redo & other features (#395)
* .build containment implemented
* no destructive variable setting - builds in either folder
* make from 3 places
* cleans before each build
* make from root with keyboard=keyboard, keymap=keymap
* make from keyboard/keyboard with keymap=keymap
* make from keymaps/keymap
* only implemented on planck
* adds color diag to avr-gcc
* makefiles for all plancks, clean-up
* quick build-all makefile for plancks
* reformatting of make output (colors)
* color toggle, tmk path corrections
* correct if statement for color
* move config.h to main makefile, updates preonic, atomic
* format update, all keyboards targets
* makefile optional for build all target, alps and arrow_pad updated
* alps updated
* make planck default, trying out travis recipe for all-keyboards
* all-keymaps target, different travis recipe
* updates alps64
* updates keyboards to new format
* updates clue* projects
* all projects updated, specialise EZ .hex, let .hex through
* updates travis
* automatically find root, keyboard, keymap
* silent echo, cleaned-up mass make output
* updates all keyboards' .hex files except EZ
* Rename Bantam44.c to bantam44.c
* Rename Bantam44.h to bantam44.h
* nananana
* adds six key keyboard
* does same to ez as rest
* updates send_string example
* brings ergodox_ez up to date
* updates template/new project script
* adds sixkeyboard
* adds readme for sixkeyboard
* adds sixkeyboard to travis
* filenames, gitignore mess
* define clock prescaler stuff manually
* make quick, size test example
* documentation and dfu-no-build
2016-06-11 13:31:31 -04:00
|
|
|
SECHO = $(SILENT) || echo
|
2020-12-31 15:20:56 +09:00
|
|
|
MD5SUM ?= md5sum
|
|
|
|
ifneq ($(filter Darwin FreeBSD,$(shell uname -s)),)
|
|
|
|
MD5SUM = md5
|
|
|
|
endif
|
2015-04-10 01:32:04 +09:00
|
|
|
|
|
|
|
# Compiler flags to generate dependency files.
|
|
|
|
#GENDEPFLAGS = -MMD -MP -MF .dep/$(@F).d
|
2016-07-30 18:16:34 +03:00
|
|
|
GENDEPFLAGS = -MMD -MP -MF $(patsubst %.o,%.td,$@)
|
2015-04-10 01:32:04 +09:00
|
|
|
|
|
|
|
|
|
|
|
# Combine all necessary flags and optional flags.
|
|
|
|
# Add target processor to flags.
|
|
|
|
# You can give extra flags at 'make' command line like: make EXTRAFLAGS=-DFOO=bar
|
2016-07-30 22:07:01 +03:00
|
|
|
ALL_CFLAGS = $(MCUFLAGS) $(CFLAGS) $(EXTRAFLAGS)
|
2020-01-04 12:21:08 +11:00
|
|
|
ALL_CXXFLAGS = $(MCUFLAGS) -x c++ $(CXXFLAGS) $(EXTRAFLAGS)
|
Add ChibiOS support for QMK (#465)
* Modularity and gcc warnings fixes.
* Add ChibiOS support (USB stack + support files).
* Make usb_main more USB_DRIVER #define independent.
* Move chibios to tool.
* Implement jump-to-bootloader.
* Small updates.
* Fix bootloader-jump compiling.
* Move AVR specific sleep_led.c into avr.
* Add basic sleep_led for chibios.
* Update chibios README.
* NKRO fixes.
* Rename some Makefile defines.
* Move STM32 bootloader address config to separate .h file.
* Add ARM Teensies bootloader code.
* Fix chibios/usb_main GET_REPORT handing.
* Add missing #include to keymap.c.
* Make bootmagic.c code portable (_delay_ms -> wait_ms).
* Move declaration of keymap_config.
Should really not declare variables in .h files - since it's included
in different .c files, a proper linker then complains that the same
variable is declared more than once (once for each .c file that the
offending .h is included in).
* Add eeprom support for chibios/kinetis.
* Rename chibios example keyboard.
* Move chibios/cortex selection to local Makefiles.
* Chibios: use WFI in idle. WIP suspend stuff.
* ChibiOS/kinetis: sending remote wakeup.
* ChibiOS/STM32: send remote wakeup.
* Fix report size of boot protocol.
* Fix drop key stroke
Keyboard report should be checked if its transfer finishs successfully.
Otherwise key stroke can be missing when other key event occurs
before the last report transfer is done.
Boot protocol 10ms interval probably causes this problem in case
it receives key events in a row within the period. NKRO protocol
suffers less or nothing due to its interval 1ms.
* Chibios/usb_main: rename a variable for clarity.
* Add correct chibios/bootloader_jump for infinity KB.
* ChibiOS: make reset request more CMSISy.
* Chibios: Add breathing sleep LED on Kinetis MCUs.
* ChibiOS: Update infinity bootloader code to match updated ChibiOS.
* ChibiOS: prettify/document sleep_led code.
* Chibios: Remove the wait in the main loop.
* Add maple mini code.
* Do timeout when writing to CONSOLE EP queue.
Fixes TMK bug #266.
* Chibios: add 'core/protocol' to the makefiles' search path.
* Chibios: Update to new USB API.
* Chibios: add more guards for transmitting (fix a deadlock bug).
* Add update for chibios in README
* Chibios: Fix a HardFault bug (wait after start).
* Chibios: cleanup usb_main code.
* Chibios: Revert common.mk change (fix AVR linking problem).
* core: Fix chibios user compile options
Compile options can be defined in project Makefile such as UDEFS, UADEFS, UINCDIR, ULIBDIR and ULIBS.
* Sysv format for ChibiOS arm-none-eabi-size
Some new patches to ChibiOS puts heap as it's own section. So the
berkeley format is now useless, as the heap will be included in the
BSS report. The sysv format displays the bss size correctly.
* Fix hard-coded path of CHIBIOS
* Add support for new version of ChibiOS and Contrib
The Kinetis support has moved to a separate Contrib repository in
the newest version of Chibios. There has also been some structure
changes. So this adds support for those, while maintaining back-
wards compability.
* Update ChibiOS instructions
* Chibios: implement sleep LED for STM32.
* Chibios: Update the main chibios README.
* Chibios: fix STM32_BOOTLOADER_ADDRESS name.
* Chibios: make the default bootloader_jump redefinable (weak).
* Chibios: disable LTO (link-time optimisation).
With LTO enabled, sometimes things fail for mysterious reasons
(e.g. bootloader jump on WF with LEDs enabled), just because the
linker optimisation is too aggressive.
* Chibios: add default location for chibios-contrib.
* ChibiOS: update mk to match chibios/master.
* ChibiOS: update instructions.md.
* Add chibi_onekey example.
* Add comments to chibi_onekey Makefile.
* Rename some Makefile defines.
* Move STM32 bootloader address config to separate .h file.
* Rename chibios example keyboard.
* Move chibios/cortex selection to local Makefiles.
* Add Teensy LC onekey example.
* Chibios: use WFI in idle. WIP suspend stuff.
* Update chibi/teensy instructions.
* Update chibios/Teensy instructions.
* Add infinity_chibios
* Add keymap_hasu.c
* Infinity_chibios: select correct bootloader_jump.
* Infinity_chibios: improve comments.
* Add generic STM32F103C8T6 example.
* Add maple mini code.
* STM32F103x fixes.
* Add maple mini pinout pic.
* Chibios: updates for 3.0.4 git.
* Chibios: rename example stm32_onekey -> stm32_f072_onekey.
* Chibios: add makefiles for Teensy 3.x examples.
* Chibios: update Teensy 3.x instructions.
* Chibios: Tsy LC is cortex-m0plus.
* Chibios: add more guards for transmitting (fix a deadlock bug).
* Change README for chibios
* Chibios: update examples to current chibios git.
Match the changes in mainline chibios:
- update chconf.h
- update supplied ld scripts structure
- update Teensy instructions (switch to official
chibios and introduce contrib)
* Add ChibiOS and ChibiOS-Contrib submodules
Also fix the makefile path for them.
* Moves chibios keyboards to keyboards folder
* First version of ChibiOS compilation
Only the stm32_f072_onkey keyboard is ported at the moment. It
compiles, but still doesn't link.
* More chibios fixes
It now compiles without warnings and links
* Move the teensy_lc_onekey to the keyboards folder
* Clean up the make file rule structure
* Remove keymap_fn_to_action
* Update more ChibiOS keyboards to QMK
Most of them does not compile at the moment though.
* Use older version of Chibios libraries
The newest ones have problems with compilation
* Remove USB_UNCONFIGURED event
It isn't present in the older version of ChibiOS
* Fix the infinity_chibios compilation
* Fix potentially uninitialized variable
* Add missing include
* Fix the ChibiOS makefile
* Fix some Chibios keyboard compilation
* Revert the rules.mk file back to master version
* Combine the chibios and AVR makefiles
With just the required overrides in the respective platform
specific one.
* Slight makefile restrucuring
Platform specific compiler options
* Move avr specific targets out of the main rules
* Fix ChibiOS objcopy
The ChibiOS objcopy needs different parameters, so the parameters
are moved to the corresponding platform rule file
* Fix the objcopy for real this time
The comands were moved around, so chibios used avr and the ohter
way around.
Also change the objsize output format
* Fix the thumb flags
* Fix the infinity hasu keymap
* Per platform cpp flags
* Add gcc-arm-none-eabi package to travis
* Add arm-none-eabi-newlib to travis
* Fix the name of the libnewlib-arm-none-eabi lib
* Fix the ChibiOS paths
So that they are properly relative, and builds don't generate
extra folders
* Fix the board path of stm32_f103_onekey
* Only consider folders with Makefiles as subproject
2016-07-01 17:04:53 +03:00
|
|
|
ALL_ASFLAGS = $(MCUFLAGS) -x assembler-with-cpp $(ASFLAGS) $(EXTRAFLAGS)
|
2015-04-10 01:32:04 +09:00
|
|
|
|
2018-12-15 14:31:56 +09:00
|
|
|
define NO_LTO
|
|
|
|
$(patsubst %.a,%.o,$1): NOLTO_CFLAGS += -fno-lto
|
|
|
|
endef
|
|
|
|
$(foreach LOBJ, $(NO_LTO_OBJ), $(eval $(call NO_LTO,$(LOBJ))))
|
|
|
|
|
2016-07-30 18:16:34 +03:00
|
|
|
MOVE_DEP = mv -f $(patsubst %.o,%.td,$@) $(patsubst %.o,%.d,$@)
|
|
|
|
|
2020-04-13 09:39:38 +10:00
|
|
|
# For a ChibiOS build, ensure that the board files have the hook overrides injected
|
|
|
|
define BOARDSRC_INJECT_HOOKS
|
|
|
|
$(KEYBOARD_OUTPUT)/$(patsubst %.c,%.o,$(patsubst ./%,%,$1)): INIT_HOOK_CFLAGS += -include $(TOP_DIR)/tmk_core/protocol/chibios/init_hooks.h
|
|
|
|
endef
|
|
|
|
$(foreach LOBJ, $(BOARDSRC), $(eval $(call BOARDSRC_INJECT_HOOKS,$(LOBJ))))
|
|
|
|
|
2019-07-07 09:08:49 -07:00
|
|
|
# Add QMK specific flags
|
|
|
|
DFU_SUFFIX ?= dfu-suffix
|
|
|
|
DFU_SUFFIX_ARGS ?=
|
|
|
|
|
2015-04-10 01:32:04 +09:00
|
|
|
|
Makefile redo & other features (#395)
* .build containment implemented
* no destructive variable setting - builds in either folder
* make from 3 places
* cleans before each build
* make from root with keyboard=keyboard, keymap=keymap
* make from keyboard/keyboard with keymap=keymap
* make from keymaps/keymap
* only implemented on planck
* adds color diag to avr-gcc
* makefiles for all plancks, clean-up
* quick build-all makefile for plancks
* reformatting of make output (colors)
* color toggle, tmk path corrections
* correct if statement for color
* move config.h to main makefile, updates preonic, atomic
* format update, all keyboards targets
* makefile optional for build all target, alps and arrow_pad updated
* alps updated
* make planck default, trying out travis recipe for all-keyboards
* all-keymaps target, different travis recipe
* updates alps64
* updates keyboards to new format
* updates clue* projects
* all projects updated, specialise EZ .hex, let .hex through
* updates travis
* automatically find root, keyboard, keymap
* silent echo, cleaned-up mass make output
* updates all keyboards' .hex files except EZ
* Rename Bantam44.c to bantam44.c
* Rename Bantam44.h to bantam44.h
* nananana
* adds six key keyboard
* does same to ez as rest
* updates send_string example
* brings ergodox_ez up to date
* updates template/new project script
* adds sixkeyboard
* adds readme for sixkeyboard
* adds sixkeyboard to travis
* filenames, gitignore mess
* define clock prescaler stuff manually
* make quick, size test example
* documentation and dfu-no-build
2016-06-11 13:31:31 -04:00
|
|
|
elf: $(BUILD_DIR)/$(TARGET).elf
|
|
|
|
hex: $(BUILD_DIR)/$(TARGET).hex
|
2018-01-28 11:11:28 -08:00
|
|
|
cpfirmware: $(FIRMWARE_FORMAT)
|
|
|
|
$(SILENT) || printf "Copying $(TARGET).$(FIRMWARE_FORMAT) to qmk_firmware folder" | $(AWK_CMD)
|
|
|
|
$(COPY) $(BUILD_DIR)/$(TARGET).$(FIRMWARE_FORMAT) $(TARGET).$(FIRMWARE_FORMAT) && $(PRINT_OK)
|
Makefile redo & other features (#395)
* .build containment implemented
* no destructive variable setting - builds in either folder
* make from 3 places
* cleans before each build
* make from root with keyboard=keyboard, keymap=keymap
* make from keyboard/keyboard with keymap=keymap
* make from keymaps/keymap
* only implemented on planck
* adds color diag to avr-gcc
* makefiles for all plancks, clean-up
* quick build-all makefile for plancks
* reformatting of make output (colors)
* color toggle, tmk path corrections
* correct if statement for color
* move config.h to main makefile, updates preonic, atomic
* format update, all keyboards targets
* makefile optional for build all target, alps and arrow_pad updated
* alps updated
* make planck default, trying out travis recipe for all-keyboards
* all-keymaps target, different travis recipe
* updates alps64
* updates keyboards to new format
* updates clue* projects
* all projects updated, specialise EZ .hex, let .hex through
* updates travis
* automatically find root, keyboard, keymap
* silent echo, cleaned-up mass make output
* updates all keyboards' .hex files except EZ
* Rename Bantam44.c to bantam44.c
* Rename Bantam44.h to bantam44.h
* nananana
* adds six key keyboard
* does same to ez as rest
* updates send_string example
* brings ergodox_ez up to date
* updates template/new project script
* adds sixkeyboard
* adds readme for sixkeyboard
* adds sixkeyboard to travis
* filenames, gitignore mess
* define clock prescaler stuff manually
* make quick, size test example
* documentation and dfu-no-build
2016-06-11 13:31:31 -04:00
|
|
|
eep: $(BUILD_DIR)/$(TARGET).eep
|
|
|
|
lss: $(BUILD_DIR)/$(TARGET).lss
|
|
|
|
sym: $(BUILD_DIR)/$(TARGET).sym
|
2015-04-10 01:32:04 +09:00
|
|
|
LIBNAME=lib$(TARGET).a
|
|
|
|
lib: $(LIBNAME)
|
|
|
|
|
|
|
|
# Display size of file.
|
2017-11-27 23:08:21 -05:00
|
|
|
HEXSIZE = $(SIZE) --target=$(FORMAT) $(BUILD_DIR)/$(TARGET).hex
|
2015-04-10 01:32:04 +09:00
|
|
|
#ELFSIZE = $(SIZE) --mcu=$(MCU) --format=avr $(TARGET).elf
|
Makefile redo & other features (#395)
* .build containment implemented
* no destructive variable setting - builds in either folder
* make from 3 places
* cleans before each build
* make from root with keyboard=keyboard, keymap=keymap
* make from keyboard/keyboard with keymap=keymap
* make from keymaps/keymap
* only implemented on planck
* adds color diag to avr-gcc
* makefiles for all plancks, clean-up
* quick build-all makefile for plancks
* reformatting of make output (colors)
* color toggle, tmk path corrections
* correct if statement for color
* move config.h to main makefile, updates preonic, atomic
* format update, all keyboards targets
* makefile optional for build all target, alps and arrow_pad updated
* alps updated
* make planck default, trying out travis recipe for all-keyboards
* all-keymaps target, different travis recipe
* updates alps64
* updates keyboards to new format
* updates clue* projects
* all projects updated, specialise EZ .hex, let .hex through
* updates travis
* automatically find root, keyboard, keymap
* silent echo, cleaned-up mass make output
* updates all keyboards' .hex files except EZ
* Rename Bantam44.c to bantam44.c
* Rename Bantam44.h to bantam44.h
* nananana
* adds six key keyboard
* does same to ez as rest
* updates send_string example
* brings ergodox_ez up to date
* updates template/new project script
* adds sixkeyboard
* adds readme for sixkeyboard
* adds sixkeyboard to travis
* filenames, gitignore mess
* define clock prescaler stuff manually
* make quick, size test example
* documentation and dfu-no-build
2016-06-11 13:31:31 -04:00
|
|
|
ELFSIZE = $(SIZE) $(BUILD_DIR)/$(TARGET).elf
|
2015-04-10 01:32:04 +09:00
|
|
|
|
|
|
|
sizebefore:
|
2017-11-27 23:08:21 -05:00
|
|
|
@if test -f $(BUILD_DIR)/$(TARGET).hex; then $(SECHO) $(MSG_SIZE_BEFORE); $(SILENT) || $(HEXSIZE); \
|
Makefile redo & other features (#395)
* .build containment implemented
* no destructive variable setting - builds in either folder
* make from 3 places
* cleans before each build
* make from root with keyboard=keyboard, keymap=keymap
* make from keyboard/keyboard with keymap=keymap
* make from keymaps/keymap
* only implemented on planck
* adds color diag to avr-gcc
* makefiles for all plancks, clean-up
* quick build-all makefile for plancks
* reformatting of make output (colors)
* color toggle, tmk path corrections
* correct if statement for color
* move config.h to main makefile, updates preonic, atomic
* format update, all keyboards targets
* makefile optional for build all target, alps and arrow_pad updated
* alps updated
* make planck default, trying out travis recipe for all-keyboards
* all-keymaps target, different travis recipe
* updates alps64
* updates keyboards to new format
* updates clue* projects
* all projects updated, specialise EZ .hex, let .hex through
* updates travis
* automatically find root, keyboard, keymap
* silent echo, cleaned-up mass make output
* updates all keyboards' .hex files except EZ
* Rename Bantam44.c to bantam44.c
* Rename Bantam44.h to bantam44.h
* nananana
* adds six key keyboard
* does same to ez as rest
* updates send_string example
* brings ergodox_ez up to date
* updates template/new project script
* adds sixkeyboard
* adds readme for sixkeyboard
* adds sixkeyboard to travis
* filenames, gitignore mess
* define clock prescaler stuff manually
* make quick, size test example
* documentation and dfu-no-build
2016-06-11 13:31:31 -04:00
|
|
|
2>/dev/null; $(SECHO); fi
|
2015-04-10 01:32:04 +09:00
|
|
|
|
2016-07-08 17:20:37 +03:00
|
|
|
sizeafter: $(BUILD_DIR)/$(TARGET).hex
|
2017-11-27 23:08:21 -05:00
|
|
|
@if test -f $(BUILD_DIR)/$(TARGET).hex; then $(SECHO); $(SECHO) $(MSG_SIZE_AFTER); $(SILENT) || $(HEXSIZE); \
|
Makefile redo & other features (#395)
* .build containment implemented
* no destructive variable setting - builds in either folder
* make from 3 places
* cleans before each build
* make from root with keyboard=keyboard, keymap=keymap
* make from keyboard/keyboard with keymap=keymap
* make from keymaps/keymap
* only implemented on planck
* adds color diag to avr-gcc
* makefiles for all plancks, clean-up
* quick build-all makefile for plancks
* reformatting of make output (colors)
* color toggle, tmk path corrections
* correct if statement for color
* move config.h to main makefile, updates preonic, atomic
* format update, all keyboards targets
* makefile optional for build all target, alps and arrow_pad updated
* alps updated
* make planck default, trying out travis recipe for all-keyboards
* all-keymaps target, different travis recipe
* updates alps64
* updates keyboards to new format
* updates clue* projects
* all projects updated, specialise EZ .hex, let .hex through
* updates travis
* automatically find root, keyboard, keymap
* silent echo, cleaned-up mass make output
* updates all keyboards' .hex files except EZ
* Rename Bantam44.c to bantam44.c
* Rename Bantam44.h to bantam44.h
* nananana
* adds six key keyboard
* does same to ez as rest
* updates send_string example
* brings ergodox_ez up to date
* updates template/new project script
* adds sixkeyboard
* adds readme for sixkeyboard
* adds sixkeyboard to travis
* filenames, gitignore mess
* define clock prescaler stuff manually
* make quick, size test example
* documentation and dfu-no-build
2016-06-11 13:31:31 -04:00
|
|
|
2>/dev/null; $(SECHO); fi
|
2015-04-10 01:32:04 +09:00
|
|
|
|
|
|
|
# Display compiler version information.
|
2016-06-17 17:25:58 -07:00
|
|
|
gccversion :
|
Makefile redo & other features (#395)
* .build containment implemented
* no destructive variable setting - builds in either folder
* make from 3 places
* cleans before each build
* make from root with keyboard=keyboard, keymap=keymap
* make from keyboard/keyboard with keymap=keymap
* make from keymaps/keymap
* only implemented on planck
* adds color diag to avr-gcc
* makefiles for all plancks, clean-up
* quick build-all makefile for plancks
* reformatting of make output (colors)
* color toggle, tmk path corrections
* correct if statement for color
* move config.h to main makefile, updates preonic, atomic
* format update, all keyboards targets
* makefile optional for build all target, alps and arrow_pad updated
* alps updated
* make planck default, trying out travis recipe for all-keyboards
* all-keymaps target, different travis recipe
* updates alps64
* updates keyboards to new format
* updates clue* projects
* all projects updated, specialise EZ .hex, let .hex through
* updates travis
* automatically find root, keyboard, keymap
* silent echo, cleaned-up mass make output
* updates all keyboards' .hex files except EZ
* Rename Bantam44.c to bantam44.c
* Rename Bantam44.h to bantam44.h
* nananana
* adds six key keyboard
* does same to ez as rest
* updates send_string example
* brings ergodox_ez up to date
* updates template/new project script
* adds sixkeyboard
* adds readme for sixkeyboard
* adds sixkeyboard to travis
* filenames, gitignore mess
* define clock prescaler stuff manually
* make quick, size test example
* documentation and dfu-no-build
2016-06-11 13:31:31 -04:00
|
|
|
@$(SILENT) || $(CC) --version
|
2015-04-10 01:32:04 +09:00
|
|
|
|
|
|
|
# Create final output files (.hex, .eep) from ELF output file.
|
|
|
|
%.hex: %.elf
|
Makefile redo & other features (#395)
* .build containment implemented
* no destructive variable setting - builds in either folder
* make from 3 places
* cleans before each build
* make from root with keyboard=keyboard, keymap=keymap
* make from keyboard/keyboard with keymap=keymap
* make from keymaps/keymap
* only implemented on planck
* adds color diag to avr-gcc
* makefiles for all plancks, clean-up
* quick build-all makefile for plancks
* reformatting of make output (colors)
* color toggle, tmk path corrections
* correct if statement for color
* move config.h to main makefile, updates preonic, atomic
* format update, all keyboards targets
* makefile optional for build all target, alps and arrow_pad updated
* alps updated
* make planck default, trying out travis recipe for all-keyboards
* all-keymaps target, different travis recipe
* updates alps64
* updates keyboards to new format
* updates clue* projects
* all projects updated, specialise EZ .hex, let .hex through
* updates travis
* automatically find root, keyboard, keymap
* silent echo, cleaned-up mass make output
* updates all keyboards' .hex files except EZ
* Rename Bantam44.c to bantam44.c
* Rename Bantam44.h to bantam44.h
* nananana
* adds six key keyboard
* does same to ez as rest
* updates send_string example
* brings ergodox_ez up to date
* updates template/new project script
* adds sixkeyboard
* adds readme for sixkeyboard
* adds sixkeyboard to travis
* filenames, gitignore mess
* define clock prescaler stuff manually
* make quick, size test example
* documentation and dfu-no-build
2016-06-11 13:31:31 -04:00
|
|
|
@$(SILENT) || printf "$(MSG_FLASH) $@" | $(AWK_CMD)
|
Add ChibiOS support for QMK (#465)
* Modularity and gcc warnings fixes.
* Add ChibiOS support (USB stack + support files).
* Make usb_main more USB_DRIVER #define independent.
* Move chibios to tool.
* Implement jump-to-bootloader.
* Small updates.
* Fix bootloader-jump compiling.
* Move AVR specific sleep_led.c into avr.
* Add basic sleep_led for chibios.
* Update chibios README.
* NKRO fixes.
* Rename some Makefile defines.
* Move STM32 bootloader address config to separate .h file.
* Add ARM Teensies bootloader code.
* Fix chibios/usb_main GET_REPORT handing.
* Add missing #include to keymap.c.
* Make bootmagic.c code portable (_delay_ms -> wait_ms).
* Move declaration of keymap_config.
Should really not declare variables in .h files - since it's included
in different .c files, a proper linker then complains that the same
variable is declared more than once (once for each .c file that the
offending .h is included in).
* Add eeprom support for chibios/kinetis.
* Rename chibios example keyboard.
* Move chibios/cortex selection to local Makefiles.
* Chibios: use WFI in idle. WIP suspend stuff.
* ChibiOS/kinetis: sending remote wakeup.
* ChibiOS/STM32: send remote wakeup.
* Fix report size of boot protocol.
* Fix drop key stroke
Keyboard report should be checked if its transfer finishs successfully.
Otherwise key stroke can be missing when other key event occurs
before the last report transfer is done.
Boot protocol 10ms interval probably causes this problem in case
it receives key events in a row within the period. NKRO protocol
suffers less or nothing due to its interval 1ms.
* Chibios/usb_main: rename a variable for clarity.
* Add correct chibios/bootloader_jump for infinity KB.
* ChibiOS: make reset request more CMSISy.
* Chibios: Add breathing sleep LED on Kinetis MCUs.
* ChibiOS: Update infinity bootloader code to match updated ChibiOS.
* ChibiOS: prettify/document sleep_led code.
* Chibios: Remove the wait in the main loop.
* Add maple mini code.
* Do timeout when writing to CONSOLE EP queue.
Fixes TMK bug #266.
* Chibios: add 'core/protocol' to the makefiles' search path.
* Chibios: Update to new USB API.
* Chibios: add more guards for transmitting (fix a deadlock bug).
* Add update for chibios in README
* Chibios: Fix a HardFault bug (wait after start).
* Chibios: cleanup usb_main code.
* Chibios: Revert common.mk change (fix AVR linking problem).
* core: Fix chibios user compile options
Compile options can be defined in project Makefile such as UDEFS, UADEFS, UINCDIR, ULIBDIR and ULIBS.
* Sysv format for ChibiOS arm-none-eabi-size
Some new patches to ChibiOS puts heap as it's own section. So the
berkeley format is now useless, as the heap will be included in the
BSS report. The sysv format displays the bss size correctly.
* Fix hard-coded path of CHIBIOS
* Add support for new version of ChibiOS and Contrib
The Kinetis support has moved to a separate Contrib repository in
the newest version of Chibios. There has also been some structure
changes. So this adds support for those, while maintaining back-
wards compability.
* Update ChibiOS instructions
* Chibios: implement sleep LED for STM32.
* Chibios: Update the main chibios README.
* Chibios: fix STM32_BOOTLOADER_ADDRESS name.
* Chibios: make the default bootloader_jump redefinable (weak).
* Chibios: disable LTO (link-time optimisation).
With LTO enabled, sometimes things fail for mysterious reasons
(e.g. bootloader jump on WF with LEDs enabled), just because the
linker optimisation is too aggressive.
* Chibios: add default location for chibios-contrib.
* ChibiOS: update mk to match chibios/master.
* ChibiOS: update instructions.md.
* Add chibi_onekey example.
* Add comments to chibi_onekey Makefile.
* Rename some Makefile defines.
* Move STM32 bootloader address config to separate .h file.
* Rename chibios example keyboard.
* Move chibios/cortex selection to local Makefiles.
* Add Teensy LC onekey example.
* Chibios: use WFI in idle. WIP suspend stuff.
* Update chibi/teensy instructions.
* Update chibios/Teensy instructions.
* Add infinity_chibios
* Add keymap_hasu.c
* Infinity_chibios: select correct bootloader_jump.
* Infinity_chibios: improve comments.
* Add generic STM32F103C8T6 example.
* Add maple mini code.
* STM32F103x fixes.
* Add maple mini pinout pic.
* Chibios: updates for 3.0.4 git.
* Chibios: rename example stm32_onekey -> stm32_f072_onekey.
* Chibios: add makefiles for Teensy 3.x examples.
* Chibios: update Teensy 3.x instructions.
* Chibios: Tsy LC is cortex-m0plus.
* Chibios: add more guards for transmitting (fix a deadlock bug).
* Change README for chibios
* Chibios: update examples to current chibios git.
Match the changes in mainline chibios:
- update chconf.h
- update supplied ld scripts structure
- update Teensy instructions (switch to official
chibios and introduce contrib)
* Add ChibiOS and ChibiOS-Contrib submodules
Also fix the makefile path for them.
* Moves chibios keyboards to keyboards folder
* First version of ChibiOS compilation
Only the stm32_f072_onkey keyboard is ported at the moment. It
compiles, but still doesn't link.
* More chibios fixes
It now compiles without warnings and links
* Move the teensy_lc_onekey to the keyboards folder
* Clean up the make file rule structure
* Remove keymap_fn_to_action
* Update more ChibiOS keyboards to QMK
Most of them does not compile at the moment though.
* Use older version of Chibios libraries
The newest ones have problems with compilation
* Remove USB_UNCONFIGURED event
It isn't present in the older version of ChibiOS
* Fix the infinity_chibios compilation
* Fix potentially uninitialized variable
* Add missing include
* Fix the ChibiOS makefile
* Fix some Chibios keyboard compilation
* Revert the rules.mk file back to master version
* Combine the chibios and AVR makefiles
With just the required overrides in the respective platform
specific one.
* Slight makefile restrucuring
Platform specific compiler options
* Move avr specific targets out of the main rules
* Fix ChibiOS objcopy
The ChibiOS objcopy needs different parameters, so the parameters
are moved to the corresponding platform rule file
* Fix the objcopy for real this time
The comands were moved around, so chibios used avr and the ohter
way around.
Also change the objsize output format
* Fix the thumb flags
* Fix the infinity hasu keymap
* Per platform cpp flags
* Add gcc-arm-none-eabi package to travis
* Add arm-none-eabi-newlib to travis
* Fix the name of the libnewlib-arm-none-eabi lib
* Fix the ChibiOS paths
So that they are properly relative, and builds don't generate
extra folders
* Fix the board path of stm32_f103_onekey
* Only consider folders with Makefiles as subproject
2016-07-01 17:04:53 +03:00
|
|
|
$(eval CMD=$(HEX) $< $@)
|
Makefile redo & other features (#395)
* .build containment implemented
* no destructive variable setting - builds in either folder
* make from 3 places
* cleans before each build
* make from root with keyboard=keyboard, keymap=keymap
* make from keyboard/keyboard with keymap=keymap
* make from keymaps/keymap
* only implemented on planck
* adds color diag to avr-gcc
* makefiles for all plancks, clean-up
* quick build-all makefile for plancks
* reformatting of make output (colors)
* color toggle, tmk path corrections
* correct if statement for color
* move config.h to main makefile, updates preonic, atomic
* format update, all keyboards targets
* makefile optional for build all target, alps and arrow_pad updated
* alps updated
* make planck default, trying out travis recipe for all-keyboards
* all-keymaps target, different travis recipe
* updates alps64
* updates keyboards to new format
* updates clue* projects
* all projects updated, specialise EZ .hex, let .hex through
* updates travis
* automatically find root, keyboard, keymap
* silent echo, cleaned-up mass make output
* updates all keyboards' .hex files except EZ
* Rename Bantam44.c to bantam44.c
* Rename Bantam44.h to bantam44.h
* nananana
* adds six key keyboard
* does same to ez as rest
* updates send_string example
* brings ergodox_ez up to date
* updates template/new project script
* adds sixkeyboard
* adds readme for sixkeyboard
* adds sixkeyboard to travis
* filenames, gitignore mess
* define clock prescaler stuff manually
* make quick, size test example
* documentation and dfu-no-build
2016-06-11 13:31:31 -04:00
|
|
|
@$(BUILD_CMD)
|
2015-04-10 01:32:04 +09:00
|
|
|
|
|
|
|
%.eep: %.elf
|
Makefile redo & other features (#395)
* .build containment implemented
* no destructive variable setting - builds in either folder
* make from 3 places
* cleans before each build
* make from root with keyboard=keyboard, keymap=keymap
* make from keyboard/keyboard with keymap=keymap
* make from keymaps/keymap
* only implemented on planck
* adds color diag to avr-gcc
* makefiles for all plancks, clean-up
* quick build-all makefile for plancks
* reformatting of make output (colors)
* color toggle, tmk path corrections
* correct if statement for color
* move config.h to main makefile, updates preonic, atomic
* format update, all keyboards targets
* makefile optional for build all target, alps and arrow_pad updated
* alps updated
* make planck default, trying out travis recipe for all-keyboards
* all-keymaps target, different travis recipe
* updates alps64
* updates keyboards to new format
* updates clue* projects
* all projects updated, specialise EZ .hex, let .hex through
* updates travis
* automatically find root, keyboard, keymap
* silent echo, cleaned-up mass make output
* updates all keyboards' .hex files except EZ
* Rename Bantam44.c to bantam44.c
* Rename Bantam44.h to bantam44.h
* nananana
* adds six key keyboard
* does same to ez as rest
* updates send_string example
* brings ergodox_ez up to date
* updates template/new project script
* adds sixkeyboard
* adds readme for sixkeyboard
* adds sixkeyboard to travis
* filenames, gitignore mess
* define clock prescaler stuff manually
* make quick, size test example
* documentation and dfu-no-build
2016-06-11 13:31:31 -04:00
|
|
|
@$(SILENT) || printf "$(MSG_EEPROM) $@" | $(AWK_CMD)
|
Add ChibiOS support for QMK (#465)
* Modularity and gcc warnings fixes.
* Add ChibiOS support (USB stack + support files).
* Make usb_main more USB_DRIVER #define independent.
* Move chibios to tool.
* Implement jump-to-bootloader.
* Small updates.
* Fix bootloader-jump compiling.
* Move AVR specific sleep_led.c into avr.
* Add basic sleep_led for chibios.
* Update chibios README.
* NKRO fixes.
* Rename some Makefile defines.
* Move STM32 bootloader address config to separate .h file.
* Add ARM Teensies bootloader code.
* Fix chibios/usb_main GET_REPORT handing.
* Add missing #include to keymap.c.
* Make bootmagic.c code portable (_delay_ms -> wait_ms).
* Move declaration of keymap_config.
Should really not declare variables in .h files - since it's included
in different .c files, a proper linker then complains that the same
variable is declared more than once (once for each .c file that the
offending .h is included in).
* Add eeprom support for chibios/kinetis.
* Rename chibios example keyboard.
* Move chibios/cortex selection to local Makefiles.
* Chibios: use WFI in idle. WIP suspend stuff.
* ChibiOS/kinetis: sending remote wakeup.
* ChibiOS/STM32: send remote wakeup.
* Fix report size of boot protocol.
* Fix drop key stroke
Keyboard report should be checked if its transfer finishs successfully.
Otherwise key stroke can be missing when other key event occurs
before the last report transfer is done.
Boot protocol 10ms interval probably causes this problem in case
it receives key events in a row within the period. NKRO protocol
suffers less or nothing due to its interval 1ms.
* Chibios/usb_main: rename a variable for clarity.
* Add correct chibios/bootloader_jump for infinity KB.
* ChibiOS: make reset request more CMSISy.
* Chibios: Add breathing sleep LED on Kinetis MCUs.
* ChibiOS: Update infinity bootloader code to match updated ChibiOS.
* ChibiOS: prettify/document sleep_led code.
* Chibios: Remove the wait in the main loop.
* Add maple mini code.
* Do timeout when writing to CONSOLE EP queue.
Fixes TMK bug #266.
* Chibios: add 'core/protocol' to the makefiles' search path.
* Chibios: Update to new USB API.
* Chibios: add more guards for transmitting (fix a deadlock bug).
* Add update for chibios in README
* Chibios: Fix a HardFault bug (wait after start).
* Chibios: cleanup usb_main code.
* Chibios: Revert common.mk change (fix AVR linking problem).
* core: Fix chibios user compile options
Compile options can be defined in project Makefile such as UDEFS, UADEFS, UINCDIR, ULIBDIR and ULIBS.
* Sysv format for ChibiOS arm-none-eabi-size
Some new patches to ChibiOS puts heap as it's own section. So the
berkeley format is now useless, as the heap will be included in the
BSS report. The sysv format displays the bss size correctly.
* Fix hard-coded path of CHIBIOS
* Add support for new version of ChibiOS and Contrib
The Kinetis support has moved to a separate Contrib repository in
the newest version of Chibios. There has also been some structure
changes. So this adds support for those, while maintaining back-
wards compability.
* Update ChibiOS instructions
* Chibios: implement sleep LED for STM32.
* Chibios: Update the main chibios README.
* Chibios: fix STM32_BOOTLOADER_ADDRESS name.
* Chibios: make the default bootloader_jump redefinable (weak).
* Chibios: disable LTO (link-time optimisation).
With LTO enabled, sometimes things fail for mysterious reasons
(e.g. bootloader jump on WF with LEDs enabled), just because the
linker optimisation is too aggressive.
* Chibios: add default location for chibios-contrib.
* ChibiOS: update mk to match chibios/master.
* ChibiOS: update instructions.md.
* Add chibi_onekey example.
* Add comments to chibi_onekey Makefile.
* Rename some Makefile defines.
* Move STM32 bootloader address config to separate .h file.
* Rename chibios example keyboard.
* Move chibios/cortex selection to local Makefiles.
* Add Teensy LC onekey example.
* Chibios: use WFI in idle. WIP suspend stuff.
* Update chibi/teensy instructions.
* Update chibios/Teensy instructions.
* Add infinity_chibios
* Add keymap_hasu.c
* Infinity_chibios: select correct bootloader_jump.
* Infinity_chibios: improve comments.
* Add generic STM32F103C8T6 example.
* Add maple mini code.
* STM32F103x fixes.
* Add maple mini pinout pic.
* Chibios: updates for 3.0.4 git.
* Chibios: rename example stm32_onekey -> stm32_f072_onekey.
* Chibios: add makefiles for Teensy 3.x examples.
* Chibios: update Teensy 3.x instructions.
* Chibios: Tsy LC is cortex-m0plus.
* Chibios: add more guards for transmitting (fix a deadlock bug).
* Change README for chibios
* Chibios: update examples to current chibios git.
Match the changes in mainline chibios:
- update chconf.h
- update supplied ld scripts structure
- update Teensy instructions (switch to official
chibios and introduce contrib)
* Add ChibiOS and ChibiOS-Contrib submodules
Also fix the makefile path for them.
* Moves chibios keyboards to keyboards folder
* First version of ChibiOS compilation
Only the stm32_f072_onkey keyboard is ported at the moment. It
compiles, but still doesn't link.
* More chibios fixes
It now compiles without warnings and links
* Move the teensy_lc_onekey to the keyboards folder
* Clean up the make file rule structure
* Remove keymap_fn_to_action
* Update more ChibiOS keyboards to QMK
Most of them does not compile at the moment though.
* Use older version of Chibios libraries
The newest ones have problems with compilation
* Remove USB_UNCONFIGURED event
It isn't present in the older version of ChibiOS
* Fix the infinity_chibios compilation
* Fix potentially uninitialized variable
* Add missing include
* Fix the ChibiOS makefile
* Fix some Chibios keyboard compilation
* Revert the rules.mk file back to master version
* Combine the chibios and AVR makefiles
With just the required overrides in the respective platform
specific one.
* Slight makefile restrucuring
Platform specific compiler options
* Move avr specific targets out of the main rules
* Fix ChibiOS objcopy
The ChibiOS objcopy needs different parameters, so the parameters
are moved to the corresponding platform rule file
* Fix the objcopy for real this time
The comands were moved around, so chibios used avr and the ohter
way around.
Also change the objsize output format
* Fix the thumb flags
* Fix the infinity hasu keymap
* Per platform cpp flags
* Add gcc-arm-none-eabi package to travis
* Add arm-none-eabi-newlib to travis
* Fix the name of the libnewlib-arm-none-eabi lib
* Fix the ChibiOS paths
So that they are properly relative, and builds don't generate
extra folders
* Fix the board path of stm32_f103_onekey
* Only consider folders with Makefiles as subproject
2016-07-01 17:04:53 +03:00
|
|
|
$(eval CMD=$(EEP) $< $@ || exit 0)
|
Makefile redo & other features (#395)
* .build containment implemented
* no destructive variable setting - builds in either folder
* make from 3 places
* cleans before each build
* make from root with keyboard=keyboard, keymap=keymap
* make from keyboard/keyboard with keymap=keymap
* make from keymaps/keymap
* only implemented on planck
* adds color diag to avr-gcc
* makefiles for all plancks, clean-up
* quick build-all makefile for plancks
* reformatting of make output (colors)
* color toggle, tmk path corrections
* correct if statement for color
* move config.h to main makefile, updates preonic, atomic
* format update, all keyboards targets
* makefile optional for build all target, alps and arrow_pad updated
* alps updated
* make planck default, trying out travis recipe for all-keyboards
* all-keymaps target, different travis recipe
* updates alps64
* updates keyboards to new format
* updates clue* projects
* all projects updated, specialise EZ .hex, let .hex through
* updates travis
* automatically find root, keyboard, keymap
* silent echo, cleaned-up mass make output
* updates all keyboards' .hex files except EZ
* Rename Bantam44.c to bantam44.c
* Rename Bantam44.h to bantam44.h
* nananana
* adds six key keyboard
* does same to ez as rest
* updates send_string example
* brings ergodox_ez up to date
* updates template/new project script
* adds sixkeyboard
* adds readme for sixkeyboard
* adds sixkeyboard to travis
* filenames, gitignore mess
* define clock prescaler stuff manually
* make quick, size test example
* documentation and dfu-no-build
2016-06-11 13:31:31 -04:00
|
|
|
@$(BUILD_CMD)
|
2015-04-10 01:32:04 +09:00
|
|
|
|
|
|
|
# Create extended listing file from ELF output file.
|
|
|
|
%.lss: %.elf
|
Makefile redo & other features (#395)
* .build containment implemented
* no destructive variable setting - builds in either folder
* make from 3 places
* cleans before each build
* make from root with keyboard=keyboard, keymap=keymap
* make from keyboard/keyboard with keymap=keymap
* make from keymaps/keymap
* only implemented on planck
* adds color diag to avr-gcc
* makefiles for all plancks, clean-up
* quick build-all makefile for plancks
* reformatting of make output (colors)
* color toggle, tmk path corrections
* correct if statement for color
* move config.h to main makefile, updates preonic, atomic
* format update, all keyboards targets
* makefile optional for build all target, alps and arrow_pad updated
* alps updated
* make planck default, trying out travis recipe for all-keyboards
* all-keymaps target, different travis recipe
* updates alps64
* updates keyboards to new format
* updates clue* projects
* all projects updated, specialise EZ .hex, let .hex through
* updates travis
* automatically find root, keyboard, keymap
* silent echo, cleaned-up mass make output
* updates all keyboards' .hex files except EZ
* Rename Bantam44.c to bantam44.c
* Rename Bantam44.h to bantam44.h
* nananana
* adds six key keyboard
* does same to ez as rest
* updates send_string example
* brings ergodox_ez up to date
* updates template/new project script
* adds sixkeyboard
* adds readme for sixkeyboard
* adds sixkeyboard to travis
* filenames, gitignore mess
* define clock prescaler stuff manually
* make quick, size test example
* documentation and dfu-no-build
2016-06-11 13:31:31 -04:00
|
|
|
@$(SILENT) || printf "$(MSG_EXTENDED_LISTING) $@" | $(AWK_CMD)
|
|
|
|
$(eval CMD=$(OBJDUMP) -h -S -z $< > $@)
|
|
|
|
@$(BUILD_CMD)
|
2015-04-10 01:32:04 +09:00
|
|
|
|
|
|
|
# Create a symbol table from ELF output file.
|
|
|
|
%.sym: %.elf
|
Makefile redo & other features (#395)
* .build containment implemented
* no destructive variable setting - builds in either folder
* make from 3 places
* cleans before each build
* make from root with keyboard=keyboard, keymap=keymap
* make from keyboard/keyboard with keymap=keymap
* make from keymaps/keymap
* only implemented on planck
* adds color diag to avr-gcc
* makefiles for all plancks, clean-up
* quick build-all makefile for plancks
* reformatting of make output (colors)
* color toggle, tmk path corrections
* correct if statement for color
* move config.h to main makefile, updates preonic, atomic
* format update, all keyboards targets
* makefile optional for build all target, alps and arrow_pad updated
* alps updated
* make planck default, trying out travis recipe for all-keyboards
* all-keymaps target, different travis recipe
* updates alps64
* updates keyboards to new format
* updates clue* projects
* all projects updated, specialise EZ .hex, let .hex through
* updates travis
* automatically find root, keyboard, keymap
* silent echo, cleaned-up mass make output
* updates all keyboards' .hex files except EZ
* Rename Bantam44.c to bantam44.c
* Rename Bantam44.h to bantam44.h
* nananana
* adds six key keyboard
* does same to ez as rest
* updates send_string example
* brings ergodox_ez up to date
* updates template/new project script
* adds sixkeyboard
* adds readme for sixkeyboard
* adds sixkeyboard to travis
* filenames, gitignore mess
* define clock prescaler stuff manually
* make quick, size test example
* documentation and dfu-no-build
2016-06-11 13:31:31 -04:00
|
|
|
@$(SILENT) || printf "$(MSG_SYMBOL_TABLE) $@" | $(AWK_CMD)
|
|
|
|
$(eval CMD=$(NM) -n $< > $@ )
|
|
|
|
@$(BUILD_CMD)
|
2015-04-10 01:32:04 +09:00
|
|
|
|
2016-07-05 19:28:17 +03:00
|
|
|
%.bin: %.elf
|
|
|
|
@$(SILENT) || printf "$(MSG_BIN) $@" | $(AWK_CMD)
|
|
|
|
$(eval CMD=$(BIN) $< $@ || exit 0)
|
|
|
|
@$(BUILD_CMD)
|
2019-07-07 09:08:49 -07:00
|
|
|
if [ ! -z "$(DFU_SUFFIX_ARGS)" ]; then \
|
|
|
|
$(DFU_SUFFIX) $(DFU_SUFFIX_ARGS) -a $(BUILD_DIR)/$(TARGET).bin 1>/dev/null ;\
|
|
|
|
fi
|
|
|
|
$(COPY) $(BUILD_DIR)/$(TARGET).bin $(TARGET).bin;
|
2016-07-05 19:28:17 +03:00
|
|
|
|
2017-08-08 15:26:19 -04:00
|
|
|
BEGIN = gccversion sizebefore
|
2016-07-08 23:19:48 +03:00
|
|
|
|
2015-04-10 01:32:04 +09:00
|
|
|
# Link: create ELF output file from object files.
|
Makefile redo & other features (#395)
* .build containment implemented
* no destructive variable setting - builds in either folder
* make from 3 places
* cleans before each build
* make from root with keyboard=keyboard, keymap=keymap
* make from keyboard/keyboard with keymap=keymap
* make from keymaps/keymap
* only implemented on planck
* adds color diag to avr-gcc
* makefiles for all plancks, clean-up
* quick build-all makefile for plancks
* reformatting of make output (colors)
* color toggle, tmk path corrections
* correct if statement for color
* move config.h to main makefile, updates preonic, atomic
* format update, all keyboards targets
* makefile optional for build all target, alps and arrow_pad updated
* alps updated
* make planck default, trying out travis recipe for all-keyboards
* all-keymaps target, different travis recipe
* updates alps64
* updates keyboards to new format
* updates clue* projects
* all projects updated, specialise EZ .hex, let .hex through
* updates travis
* automatically find root, keyboard, keymap
* silent echo, cleaned-up mass make output
* updates all keyboards' .hex files except EZ
* Rename Bantam44.c to bantam44.c
* Rename Bantam44.h to bantam44.h
* nananana
* adds six key keyboard
* does same to ez as rest
* updates send_string example
* brings ergodox_ez up to date
* updates template/new project script
* adds sixkeyboard
* adds readme for sixkeyboard
* adds sixkeyboard to travis
* filenames, gitignore mess
* define clock prescaler stuff manually
* make quick, size test example
* documentation and dfu-no-build
2016-06-11 13:31:31 -04:00
|
|
|
.SECONDARY : $(BUILD_DIR)/$(TARGET).elf
|
2015-04-10 01:32:04 +09:00
|
|
|
.PRECIOUS : $(OBJ)
|
2016-07-30 22:07:01 +03:00
|
|
|
# Note the obj.txt depeendency is there to force linking if a source file is deleted
|
2016-08-15 08:20:16 +03:00
|
|
|
%.elf: $(OBJ) $(MASTER_OUTPUT)/cflags.txt $(MASTER_OUTPUT)/ldflags.txt $(MASTER_OUTPUT)/obj.txt | $(BEGIN)
|
Makefile redo & other features (#395)
* .build containment implemented
* no destructive variable setting - builds in either folder
* make from 3 places
* cleans before each build
* make from root with keyboard=keyboard, keymap=keymap
* make from keyboard/keyboard with keymap=keymap
* make from keymaps/keymap
* only implemented on planck
* adds color diag to avr-gcc
* makefiles for all plancks, clean-up
* quick build-all makefile for plancks
* reformatting of make output (colors)
* color toggle, tmk path corrections
* correct if statement for color
* move config.h to main makefile, updates preonic, atomic
* format update, all keyboards targets
* makefile optional for build all target, alps and arrow_pad updated
* alps updated
* make planck default, trying out travis recipe for all-keyboards
* all-keymaps target, different travis recipe
* updates alps64
* updates keyboards to new format
* updates clue* projects
* all projects updated, specialise EZ .hex, let .hex through
* updates travis
* automatically find root, keyboard, keymap
* silent echo, cleaned-up mass make output
* updates all keyboards' .hex files except EZ
* Rename Bantam44.c to bantam44.c
* Rename Bantam44.h to bantam44.h
* nananana
* adds six key keyboard
* does same to ez as rest
* updates send_string example
* brings ergodox_ez up to date
* updates template/new project script
* adds sixkeyboard
* adds readme for sixkeyboard
* adds sixkeyboard to travis
* filenames, gitignore mess
* define clock prescaler stuff manually
* make quick, size test example
* documentation and dfu-no-build
2016-06-11 13:31:31 -04:00
|
|
|
@$(SILENT) || printf "$(MSG_LINKING) $@" | $(AWK_CMD)
|
2016-07-30 22:07:01 +03:00
|
|
|
$(eval CMD=$(CC) $(ALL_CFLAGS) $(filter-out %.txt,$^) --output $@ $(LDFLAGS))
|
Makefile redo & other features (#395)
* .build containment implemented
* no destructive variable setting - builds in either folder
* make from 3 places
* cleans before each build
* make from root with keyboard=keyboard, keymap=keymap
* make from keyboard/keyboard with keymap=keymap
* make from keymaps/keymap
* only implemented on planck
* adds color diag to avr-gcc
* makefiles for all plancks, clean-up
* quick build-all makefile for plancks
* reformatting of make output (colors)
* color toggle, tmk path corrections
* correct if statement for color
* move config.h to main makefile, updates preonic, atomic
* format update, all keyboards targets
* makefile optional for build all target, alps and arrow_pad updated
* alps updated
* make planck default, trying out travis recipe for all-keyboards
* all-keymaps target, different travis recipe
* updates alps64
* updates keyboards to new format
* updates clue* projects
* all projects updated, specialise EZ .hex, let .hex through
* updates travis
* automatically find root, keyboard, keymap
* silent echo, cleaned-up mass make output
* updates all keyboards' .hex files except EZ
* Rename Bantam44.c to bantam44.c
* Rename Bantam44.h to bantam44.h
* nananana
* adds six key keyboard
* does same to ez as rest
* updates send_string example
* brings ergodox_ez up to date
* updates template/new project script
* adds sixkeyboard
* adds readme for sixkeyboard
* adds sixkeyboard to travis
* filenames, gitignore mess
* define clock prescaler stuff manually
* make quick, size test example
* documentation and dfu-no-build
2016-06-11 13:31:31 -04:00
|
|
|
@$(BUILD_CMD)
|
Remove AUTOGEN and fix Travis Compiled Push scripts (#5077)
* Grab HEX and BIN files from autogen
And push them to qmk.fm/compiled
* Make autogen copy extension agnostic
This way, when travis cl scrpit looks for hex files, it will actually grab bin files, and not hex files for ARM boards
* Handle the AUTOGEN in :bin target to properly handle edge cases
Both the TADA68 and ATSAM boards generate the hex file and then convert it to a bin file. The changes I made does not handle this well, at all. This removes the hex and replaces it with a bin, if a bin is normally generated.
* Revert hex target to original copy command
* Check hex and bin separately in compile push script
Since I don't know how to script this, well
* Simplify push to compiled folder
* Further simplify compiled push script
* Move AUTOGEN parsing to a more sane location to prevent tech debt
Thanks to skully!
* Remove AUTOGEN completely, as it's not needed
This has the benefit of making everything super simple, since we can pull every hex and bin from the root of the qmk_firmware folder, and move that to th compiled folder. This also removes old and unneeded code, and removes some tech debt that has been accrued, without adding more, in theory.
2019-02-12 16:46:04 -08:00
|
|
|
|
2015-04-10 01:32:04 +09:00
|
|
|
|
2016-07-09 20:58:19 +03:00
|
|
|
define GEN_OBJRULE
|
2016-08-15 08:45:36 +03:00
|
|
|
$1_INCFLAGS := $$(patsubst %,-I%,$$($1_INC))
|
2016-08-15 08:58:05 +03:00
|
|
|
ifdef $1_CONFIG
|
2017-10-14 11:32:19 -10:00
|
|
|
$1_CONFIG_FLAGS += $$(patsubst %,-include %,$$($1_CONFIG))
|
2016-08-15 08:58:05 +03:00
|
|
|
endif
|
2018-12-15 14:31:56 +09:00
|
|
|
$1_CFLAGS = $$(ALL_CFLAGS) $$($1_DEFS) $$($1_INCFLAGS) $$($1_CONFIG_FLAGS) $$(NOLTO_CFLAGS)
|
2020-04-13 09:39:38 +10:00
|
|
|
$1_CXXFLAGS = $$(ALL_CXXFLAGS) $$($1_DEFS) $$($1_INCFLAGS) $$($1_CONFIG_FLAGS) $$(NOLTO_CFLAGS)
|
|
|
|
$1_ASFLAGS = $$(ALL_ASFLAGS) $$($1_DEFS) $$($1_INCFLAGS) $$($1_CONFIG_FLAGS)
|
2016-08-15 08:20:16 +03:00
|
|
|
|
2015-04-10 01:32:04 +09:00
|
|
|
# Compile: create object files from C source files.
|
2016-07-31 13:49:04 +03:00
|
|
|
$1/%.o : %.c $1/%.d $1/cflags.txt $1/compiler.txt | $(BEGIN)
|
2016-07-09 20:58:19 +03:00
|
|
|
@mkdir -p $$(@D)
|
|
|
|
@$$(SILENT) || printf "$$(MSG_COMPILING) $$<" | $$(AWK_CMD)
|
2020-04-13 09:39:38 +10:00
|
|
|
$$(eval CMD := $$(CC) -c $$($1_CFLAGS) $$(INIT_HOOK_CFLAGS) $$(GENDEPFLAGS) $$< -o $$@ && $$(MOVE_DEP))
|
2016-07-09 20:58:19 +03:00
|
|
|
@$$(BUILD_CMD)
|
2015-04-10 01:32:04 +09:00
|
|
|
|
|
|
|
# Compile: create object files from C++ source files.
|
2020-01-04 12:21:08 +11:00
|
|
|
$1/%.o : %.cpp $1/%.d $1/cxxflags.txt $1/compiler.txt | $(BEGIN)
|
2016-07-09 20:58:19 +03:00
|
|
|
@mkdir -p $$(@D)
|
2020-01-04 12:21:08 +11:00
|
|
|
@$$(SILENT) || printf "$$(MSG_COMPILING_CXX) $$<" | $$(AWK_CMD)
|
2020-04-13 09:39:38 +10:00
|
|
|
$$(eval CMD=$$(CC) -c $$($1_CXXFLAGS) $$(INIT_HOOK_CFLAGS) $$(GENDEPFLAGS) $$< -o $$@ && $$(MOVE_DEP))
|
2016-08-22 09:16:08 +03:00
|
|
|
@$$(BUILD_CMD)
|
|
|
|
|
2020-01-04 12:21:08 +11:00
|
|
|
$1/%.o : %.cc $1/%.d $1/cxxflags.txt $1/compiler.txt | $(BEGIN)
|
2016-08-22 09:16:08 +03:00
|
|
|
@mkdir -p $$(@D)
|
2020-01-04 12:21:08 +11:00
|
|
|
@$$(SILENT) || printf "$$(MSG_COMPILING_CXX) $$<" | $$(AWK_CMD)
|
2020-04-13 09:39:38 +10:00
|
|
|
$$(eval CMD=$$(CC) -c $$($1_CXXFLAGS) $$(INIT_HOOK_CFLAGS) $$(GENDEPFLAGS) $$< -o $$@ && $$(MOVE_DEP))
|
2016-08-22 09:16:08 +03:00
|
|
|
@$$(BUILD_CMD)
|
2015-04-10 01:32:04 +09:00
|
|
|
|
2016-07-09 20:58:19 +03:00
|
|
|
# Assemble: create object files from assembler source files.
|
2016-07-31 13:49:04 +03:00
|
|
|
$1/%.o : %.S $1/asflags.txt $1/compiler.txt | $(BEGIN)
|
2016-07-09 20:58:19 +03:00
|
|
|
@mkdir -p $$(@D)
|
|
|
|
@$(SILENT) || printf "$$(MSG_ASSEMBLING) $$<" | $$(AWK_CMD)
|
2016-08-15 08:20:16 +03:00
|
|
|
$$(eval CMD=$$(CC) -c $$($1_ASFLAGS) $$< -o $$@)
|
2016-07-09 20:58:19 +03:00
|
|
|
@$$(BUILD_CMD)
|
2016-07-30 22:07:01 +03:00
|
|
|
|
2018-12-15 14:31:56 +09:00
|
|
|
$1/%.a : $1/%.o
|
|
|
|
@mkdir -p $$(@D)
|
|
|
|
@$(SILENT) || printf "Archiving: $$<" | $$(AWK_CMD)
|
2019-04-23 03:20:13 +09:00
|
|
|
$$(eval CMD=$$(AR) rcs $$@ $$<)
|
2018-12-15 14:31:56 +09:00
|
|
|
@$$(BUILD_CMD)
|
|
|
|
|
2016-07-30 22:07:01 +03:00
|
|
|
$1/force:
|
|
|
|
|
|
|
|
$1/cflags.txt: $1/force
|
2016-08-15 08:20:16 +03:00
|
|
|
echo '$$($1_CFLAGS)' | cmp -s - $$@ || echo '$$($1_CFLAGS)' > $$@
|
2016-07-30 22:07:01 +03:00
|
|
|
|
2020-01-04 12:21:08 +11:00
|
|
|
$1/cxxflags.txt: $1/force
|
|
|
|
echo '$$($1_CXXFLAGS)' | cmp -s - $$@ || echo '$$($1_CXXFLAGS)' > $$@
|
2016-07-30 22:07:01 +03:00
|
|
|
|
|
|
|
$1/asflags.txt: $1/force
|
2016-08-15 08:20:16 +03:00
|
|
|
echo '$$($1_ASFLAGS)' | cmp -s - $$@ || echo '$$($1_ASFLAGS)' > $$@
|
2016-07-30 22:07:01 +03:00
|
|
|
|
2016-07-31 13:49:04 +03:00
|
|
|
$1/compiler.txt: $1/force
|
|
|
|
$$(CC) --version | cmp -s - $$@ || $$(CC) --version > $$@
|
2016-07-09 20:58:19 +03:00
|
|
|
endef
|
|
|
|
|
2016-09-04 23:26:49 +03:00
|
|
|
.PRECIOUS: $(MASTER_OUTPUT)/obj.txt
|
2016-08-15 08:20:16 +03:00
|
|
|
$(MASTER_OUTPUT)/obj.txt: $(MASTER_OUTPUT)/force
|
2016-09-04 23:26:49 +03:00
|
|
|
echo '$(OBJ)' | cmp -s - $@ || echo '$(OBJ)' > $@
|
2016-08-15 08:20:16 +03:00
|
|
|
|
2016-09-04 23:26:49 +03:00
|
|
|
.PRECIOUS: $(MASTER_OUTPUT)/ldflags.txt
|
2016-08-15 08:20:16 +03:00
|
|
|
$(MASTER_OUTPUT)/ldflags.txt: $(MASTER_OUTPUT)/force
|
2016-09-04 23:26:49 +03:00
|
|
|
echo '$(LDFLAGS)' | cmp -s - $@ || echo '$(LDFLAGS)' > $@
|
2016-08-15 08:20:16 +03:00
|
|
|
|
|
|
|
|
2016-07-30 18:16:34 +03:00
|
|
|
# We have to use static rules for the .d files for some reason
|
2018-12-15 14:31:56 +09:00
|
|
|
DEPS = $(patsubst %.o,%.d,$(patsubst %.a,%.o,$(OBJ)))
|
2016-07-30 18:16:34 +03:00
|
|
|
# Keep the .d files
|
|
|
|
.PRECIOUS: $(DEPS)
|
|
|
|
# Empty rule to force recompilation if the .d file is missing
|
|
|
|
$(DEPS):
|
Remove AUTOGEN and fix Travis Compiled Push scripts (#5077)
* Grab HEX and BIN files from autogen
And push them to qmk.fm/compiled
* Make autogen copy extension agnostic
This way, when travis cl scrpit looks for hex files, it will actually grab bin files, and not hex files for ARM boards
* Handle the AUTOGEN in :bin target to properly handle edge cases
Both the TADA68 and ATSAM boards generate the hex file and then convert it to a bin file. The changes I made does not handle this well, at all. This removes the hex and replaces it with a bin, if a bin is normally generated.
* Revert hex target to original copy command
* Check hex and bin separately in compile push script
Since I don't know how to script this, well
* Simplify push to compiled folder
* Further simplify compiled push script
* Move AUTOGEN parsing to a more sane location to prevent tech debt
Thanks to skully!
* Remove AUTOGEN completely, as it's not needed
This has the benefit of making everything super simple, since we can pull every hex and bin from the root of the qmk_firmware folder, and move that to th compiled folder. This also removes old and unneeded code, and removes some tech debt that has been accrued, without adding more, in theory.
2019-02-12 16:46:04 -08:00
|
|
|
|
2016-07-30 18:16:34 +03:00
|
|
|
|
2016-08-15 08:20:16 +03:00
|
|
|
$(foreach OUTPUT,$(OUTPUTS),$(eval $(call GEN_OBJRULE,$(OUTPUT))))
|
2015-04-10 01:32:04 +09:00
|
|
|
|
|
|
|
# Create preprocessed source for use in sending a bug report.
|
2016-07-08 23:19:48 +03:00
|
|
|
%.i : %.c | $(BEGIN)
|
2016-06-17 17:25:58 -07:00
|
|
|
$(CC) -E -mmcu=$(MCU) $(CFLAGS) $< -o $@
|
2015-04-10 01:32:04 +09:00
|
|
|
|
|
|
|
# Target: clean project.
|
2016-07-30 18:16:34 +03:00
|
|
|
clean:
|
2016-08-20 12:44:04 +03:00
|
|
|
$(foreach OUTPUT,$(OUTPUTS), $(REMOVE) -r $(OUTPUT) 2>/dev/null)
|
2016-07-31 14:17:32 +03:00
|
|
|
$(REMOVE) $(BUILD_DIR)/$(TARGET).*
|
2015-04-10 01:32:04 +09:00
|
|
|
|
|
|
|
show_path:
|
|
|
|
@echo VPATH=$(VPATH)
|
|
|
|
@echo SRC=$(SRC)
|
2016-08-15 08:20:16 +03:00
|
|
|
@echo OBJ=$(OBJ)
|
2015-04-10 01:32:04 +09:00
|
|
|
|
2020-08-16 06:51:35 +10:00
|
|
|
dump_vars: ERROR_IF_EMPTY=""
|
|
|
|
dump_vars: ERROR_IF_NONBOOL=""
|
|
|
|
dump_vars: ERROR_IF_UNSET=""
|
|
|
|
dump_vars:
|
|
|
|
@$(foreach V,$(sort $(.VARIABLES)),$(if $(filter-out environment% default automatic,$(origin $V)),$(info $V=$($V))))
|
|
|
|
|
2019-07-16 14:45:31 +09:00
|
|
|
objs-size:
|
|
|
|
for i in $(OBJ); do echo $$i; done | sort | xargs $(SIZE)
|
|
|
|
|
2018-03-26 14:08:08 -06:00
|
|
|
ifeq ($(findstring avr-gcc,$(CC)),avr-gcc)
|
2019-03-28 00:51:56 +09:00
|
|
|
SIZE_MARGIN = 1024
|
|
|
|
|
2017-11-27 23:08:21 -05:00
|
|
|
check-size:
|
2019-11-24 01:01:03 +09:00
|
|
|
$(eval MAX_SIZE=$(shell n=`$(CC) -E -mmcu=$(MCU) $(CFLAGS) $(OPT_DEFS) tmk_core/common/avr/bootloader_size.c 2> /dev/null | sed -ne 's/\r//;/^#/n;/^AVR_SIZE:/,$${s/^AVR_SIZE: //;p;}'` && echo $$(($$n)) || echo 0))
|
2017-11-27 23:08:21 -05:00
|
|
|
$(eval CURRENT_SIZE=$(shell if [ -f $(BUILD_DIR)/$(TARGET).hex ]; then $(SIZE) --target=$(FORMAT) $(BUILD_DIR)/$(TARGET).hex | $(AWK) 'NR==2 {print $$4}'; else printf 0; fi))
|
2018-08-16 21:35:24 +09:00
|
|
|
$(eval FREE_SIZE=$(shell expr $(MAX_SIZE) - $(CURRENT_SIZE)))
|
|
|
|
$(eval OVER_SIZE=$(shell expr $(CURRENT_SIZE) - $(MAX_SIZE)))
|
2019-07-12 05:05:13 +10:00
|
|
|
$(eval PERCENT_SIZE=$(shell expr $(CURRENT_SIZE) \* 100 / $(MAX_SIZE)))
|
2017-11-27 23:08:21 -05:00
|
|
|
if [ $(MAX_SIZE) -gt 0 ] && [ $(CURRENT_SIZE) -gt 0 ]; then \
|
|
|
|
$(SILENT) || printf "$(MSG_CHECK_FILESIZE)" | $(AWK_CMD); \
|
2019-03-28 00:51:56 +09:00
|
|
|
if [ $(CURRENT_SIZE) -gt $(MAX_SIZE) ]; then \
|
|
|
|
printf "\n * $(MSG_FILE_TOO_BIG)"; $(PRINT_ERROR_PLAIN); \
|
|
|
|
else \
|
|
|
|
if [ $(FREE_SIZE) -lt $(SIZE_MARGIN) ]; then \
|
|
|
|
$(PRINT_WARNING_PLAIN); printf " * $(MSG_FILE_NEAR_LIMIT)"; \
|
|
|
|
else \
|
|
|
|
$(PRINT_OK); $(SILENT) || printf " * $(MSG_FILE_JUST_RIGHT)"; \
|
|
|
|
fi \
|
|
|
|
fi \
|
2017-11-27 23:08:21 -05:00
|
|
|
fi
|
2018-02-06 16:32:31 -08:00
|
|
|
else
|
|
|
|
check-size:
|
2019-07-15 23:21:00 -07:00
|
|
|
$(SILENT) || echo "(Firmware size check does not yet support $(MCU) microprocessors; skipping.)"
|
2018-02-06 16:32:31 -08:00
|
|
|
endif
|
2017-11-27 23:08:21 -05:00
|
|
|
|
2020-12-31 15:20:56 +09:00
|
|
|
check-md5:
|
|
|
|
$(MD5SUM) $(BUILD_DIR)/$(TARGET).$(FIRMWARE_FORMAT)
|
|
|
|
|
Makefile redo & other features (#395)
* .build containment implemented
* no destructive variable setting - builds in either folder
* make from 3 places
* cleans before each build
* make from root with keyboard=keyboard, keymap=keymap
* make from keyboard/keyboard with keymap=keymap
* make from keymaps/keymap
* only implemented on planck
* adds color diag to avr-gcc
* makefiles for all plancks, clean-up
* quick build-all makefile for plancks
* reformatting of make output (colors)
* color toggle, tmk path corrections
* correct if statement for color
* move config.h to main makefile, updates preonic, atomic
* format update, all keyboards targets
* makefile optional for build all target, alps and arrow_pad updated
* alps updated
* make planck default, trying out travis recipe for all-keyboards
* all-keymaps target, different travis recipe
* updates alps64
* updates keyboards to new format
* updates clue* projects
* all projects updated, specialise EZ .hex, let .hex through
* updates travis
* automatically find root, keyboard, keymap
* silent echo, cleaned-up mass make output
* updates all keyboards' .hex files except EZ
* Rename Bantam44.c to bantam44.c
* Rename Bantam44.h to bantam44.h
* nananana
* adds six key keyboard
* does same to ez as rest
* updates send_string example
* brings ergodox_ez up to date
* updates template/new project script
* adds sixkeyboard
* adds readme for sixkeyboard
* adds sixkeyboard to travis
* filenames, gitignore mess
* define clock prescaler stuff manually
* make quick, size test example
* documentation and dfu-no-build
2016-06-11 13:31:31 -04:00
|
|
|
# Create build directory
|
2016-08-27 18:59:22 +03:00
|
|
|
$(shell mkdir -p $(BUILD_DIR) 2>/dev/null)
|
2015-04-10 01:32:04 +09:00
|
|
|
|
|
|
|
# Create object files directory
|
2016-08-27 18:59:22 +03:00
|
|
|
$(eval $(foreach OUTPUT,$(OUTPUTS),$(shell mkdir -p $(OUTPUT) 2>/dev/null)))
|
2015-04-10 01:32:04 +09:00
|
|
|
|
|
|
|
# Include the dependency files.
|
2018-12-15 14:31:56 +09:00
|
|
|
-include $(patsubst %.o,%.d,$(patsubst %.a,%.o,$(OBJ)))
|
2015-04-10 01:32:04 +09:00
|
|
|
|
|
|
|
|
|
|
|
# Listing of phony targets.
|
2020-08-16 06:51:35 +10:00
|
|
|
.PHONY : all dump_vars finish sizebefore sizeafter qmkversion \
|
2017-08-07 10:36:23 -04:00
|
|
|
gccversion build elf hex eep lss sym coff extcoff \
|
2015-04-10 01:32:04 +09:00
|
|
|
clean clean_list debug gdb-config show_path \
|
2020-04-17 17:50:58 +10:00
|
|
|
program teensy dfu dfu-ee dfu-start \
|
2019-08-20 15:39:24 -07:00
|
|
|
flash dfu-split-left dfu-split-right \
|
|
|
|
avrdude-split-left avrdude-split-right \
|
|
|
|
avrdude-loop usbasp
|