2015-04-09 22:32:04 +06:00
|
|
|
# Hey Emacs, this is a -*- makefile -*-
|
|
|
|
#----------------------------------------------------------------------------
|
2016-06-21 20:21:43 +06:00
|
|
|
|
2016-07-31 16:24:25 +06: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 12:16:08 +06:00
|
|
|
vpath %.cc $(VPATH_SRC)
|
2016-07-31 16:24:25 +06:00
|
|
|
vpath %.hpp $(VPATH_SRC)
|
|
|
|
vpath %.S $(VPATH_SRC)
|
|
|
|
VPATH :=
|
|
|
|
|
2016-08-15 11:20:16 +06:00
|
|
|
# Convert all SRC to OBJ
|
|
|
|
define OBJ_FROM_SRC
|
2018-12-15 11:31:56 +06: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 11:20:16 +06: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 11:31:56 +06:00
|
|
|
NO_LTO_OBJ := $(filter %.a,$(OBJ))
|
2016-08-15 11:20:16 +06:00
|
|
|
|
|
|
|
MASTER_OUTPUT := $(firstword $(OUTPUTS))
|
|
|
|
|
2015-04-09 22:32:04 +06:00
|
|
|
# Output format. (can be srec, ihex, binary)
|
|
|
|
FORMAT = ihex
|
|
|
|
|
2016-06-18 06:25:58 +06:00
|
|
|
# Optimization level, can be [0, 1, 2, 3, s].
|
2020-05-20 21:28:39 +06:00
|
|
|
OPT ?= s
|
2015-04-09 22:32:04 +06:00
|
|
|
|
2022-06-06 04:47:22 +06:00
|
|
|
# Compiler flag to set the C and C++ language standard level
|
|
|
|
CSTANDARD = -std=gnu11
|
|
|
|
CXXSTANDARD = -std=gnu++14
|
2016-08-15 11:20:16 +06:00
|
|
|
|
2021-10-21 19:39:13 +06:00
|
|
|
# Speed up recompilations by opt-in usage of ccache
|
2021-10-22 05:21:43 +06:00
|
|
|
USE_CCACHE ?= no
|
2021-10-21 19:39:13 +06:00
|
|
|
ifneq ($(USE_CCACHE),no)
|
|
|
|
CC_PREFIX ?= ccache
|
|
|
|
endif
|
2015-04-09 22:32:04 +06:00
|
|
|
|
2022-06-06 04:47:22 +06:00
|
|
|
#---------------- C Compiler Options ----------------
|
|
|
|
|
2021-10-29 02:02:22 +06:00
|
|
|
ifeq ($(strip $(LTO_ENABLE)), yes)
|
2022-05-16 11:29:55 +06:00
|
|
|
ifeq ($(PLATFORM),ARM_ATSAM)
|
|
|
|
$(info Enabling LTO on arm_atsam-targeting boards is known to have a high likelihood of failure.)
|
2021-10-29 02:02:22 +06:00
|
|
|
$(info If unsure, set LTO_ENABLE = no.)
|
|
|
|
endif
|
|
|
|
CDEFS += -flto
|
|
|
|
CDEFS += -DLTO_ENABLE
|
|
|
|
endif
|
|
|
|
|
2020-12-31 12:20:56 +06:00
|
|
|
DEBUG_ENABLE ?= yes
|
|
|
|
ifeq ($(strip $(SKIP_DEBUG_INFO)),yes)
|
|
|
|
DEBUG_ENABLE=no
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(strip $(DEBUG_ENABLE)),yes)
|
2018-12-15 11:31:56 +06:00
|
|
|
CFLAGS += -g$(DEBUG)
|
|
|
|
endif
|
2015-04-09 22:32:04 +06: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 23:31:31 +06:00
|
|
|
# add color
|
|
|
|
ifeq ($(COLOR),true)
|
2016-06-24 08:18:20 +06: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 23:31:31 +06:00
|
|
|
CFLAGS+= -fdiagnostics-color
|
|
|
|
endif
|
|
|
|
endif
|
2015-04-09 22:32:04 +06:00
|
|
|
CFLAGS += -Wall
|
|
|
|
CFLAGS += -Wstrict-prototypes
|
2017-04-13 19:12:55 +06:00
|
|
|
ifneq ($(strip $(ALLOW_WARNINGS)), yes)
|
|
|
|
CFLAGS += -Werror
|
|
|
|
endif
|
2015-04-09 22:32:04 +06:00
|
|
|
CFLAGS += $(CSTANDARD)
|
|
|
|
|
2021-02-28 22:01:16 +06:00
|
|
|
# This fixes lots of keyboards linking errors but SHOULDN'T BE A FINAL SOLUTION
|
|
|
|
# Fixing of multiple variable definitions must be made.
|
|
|
|
CFLAGS += -fcommon
|
|
|
|
|
2022-06-06 04:47:22 +06:00
|
|
|
#---------------- C++ Compiler Options ----------------
|
|
|
|
|
2020-12-31 12:20:56 +06:00
|
|
|
ifeq ($(strip $(DEBUG_ENABLE)),yes)
|
2020-01-04 07:21:08 +06:00
|
|
|
CXXFLAGS += -g$(DEBUG)
|
2018-12-15 11:31:56 +06:00
|
|
|
endif
|
2020-01-04 07:21:08 +06:00
|
|
|
CXXFLAGS += $(CXXDEFS)
|
|
|
|
CXXFLAGS += -O$(OPT)
|
2015-04-09 22:32:04 +06:00
|
|
|
# to supress "warning: only initialized variables can be placed into program memory area"
|
2020-01-04 07:21:08 +06:00
|
|
|
CXXFLAGS += -w
|
|
|
|
CXXFLAGS += -Wall
|
|
|
|
CXXFLAGS += -Wundef
|
2021-02-28 22:01:16 +06:00
|
|
|
|
2017-04-13 19:12:55 +06:00
|
|
|
ifneq ($(strip $(ALLOW_WARNINGS)), yes)
|
2020-01-04 07:21:08 +06:00
|
|
|
CXXFLAGS += -Werror
|
2017-04-13 19:12:55 +06:00
|
|
|
endif
|
2015-04-09 22:32:04 +06:00
|
|
|
|
|
|
|
#---------------- Assembler Options ----------------
|
2022-06-06 04:47:22 +06:00
|
|
|
|
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-13 06:46:04 +06:00
|
|
|
ASFLAGS += $(ADEFS)
|
2021-01-06 04:27:10 +06:00
|
|
|
ifeq ($(VERBOSE_AS_CMD),yes)
|
|
|
|
ASFLAGS += -v
|
|
|
|
endif
|
2015-04-09 22:32:04 +06:00
|
|
|
|
|
|
|
#---------------- Linker Options ----------------
|
2016-08-27 20:43:35 +06:00
|
|
|
|
2022-06-06 04:47:22 +06:00
|
|
|
CREATE_MAP ?= yes
|
2016-08-27 20:43:35 +06:00
|
|
|
ifeq ($(CREATE_MAP),yes)
|
|
|
|
LDFLAGS += -Wl,-Map=$(BUILD_DIR)/$(TARGET).map,--cref
|
|
|
|
endif
|
2021-01-06 04:27:10 +06:00
|
|
|
ifeq ($(VERBOSE_LD_CMD),yes)
|
|
|
|
LDFLAGS += -v
|
|
|
|
endif
|
2015-04-09 22:32:04 +06:00
|
|
|
#LDFLAGS += -Wl,--relax
|
|
|
|
LDFLAGS += $(EXTMEMOPTS)
|
|
|
|
LDFLAGS += $(patsubst %,-L%,$(EXTRALIBDIRS))
|
2022-06-06 04:47:22 +06:00
|
|
|
LDFLAGS += -lm
|
2015-04-09 22:32:04 +06:00
|
|
|
# You can give EXTRALDFLAGS at 'make' command line.
|
|
|
|
LDFLAGS += $(EXTRALDFLAGS)
|
|
|
|
|
2021-11-12 13:31:40 +06:00
|
|
|
#---------------- Assembler Listings ----------------
|
|
|
|
|
|
|
|
ADHLNS_ENABLE ?= no
|
|
|
|
ifeq ($(ADHLNS_ENABLE),yes)
|
|
|
|
# Avoid "Options to '-Xassembler' do not match" - only specify assembler options at LTO link time
|
|
|
|
ifeq ($(strip $(LTO_ENABLE)), yes)
|
|
|
|
LDFLAGS += -Wa,-adhlns=$(BUILD_DIR)/$(TARGET).lst
|
|
|
|
else
|
|
|
|
CFLAGS += -Wa,-adhlns=$(@:%.o=%.lst)
|
|
|
|
CXXFLAGS += -Wa,-adhlns=$(@:%.o=%.lst)
|
|
|
|
ifeq ($(strip $(DEBUG_ENABLE)),yes)
|
|
|
|
ASFLAGS = -Wa,-adhlns=$(@:%.o=%.lst),-gstabs,--listing-cont-lines=100
|
|
|
|
else
|
|
|
|
ASFLAGS = -Wa,-adhlns=$(@:%.o=%.lst),--listing-cont-lines=100
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2015-04-09 22:32:04 +06:00
|
|
|
# Define programs and commands.
|
|
|
|
SHELL = sh
|
2022-02-10 03:50:55 +06:00
|
|
|
SED = sed
|
2015-04-09 22:32:04 +06:00
|
|
|
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 23:31:31 +06:00
|
|
|
SECHO = $(SILENT) || echo
|
2020-12-31 12:20:56 +06:00
|
|
|
MD5SUM ?= md5sum
|
|
|
|
ifneq ($(filter Darwin FreeBSD,$(shell uname -s)),)
|
|
|
|
MD5SUM = md5
|
|
|
|
endif
|
2015-04-09 22:32:04 +06:00
|
|
|
|
2021-04-06 12:39:15 +06:00
|
|
|
# UF2 format settings
|
|
|
|
# To produce a UF2 file in your build, add to your keyboard's rules.mk:
|
|
|
|
# FIRMWARE_FORMAT = uf2
|
|
|
|
UF2CONV = $(TOP_DIR)/util/uf2conv.py
|
|
|
|
UF2_FAMILY ?= 0x0
|
|
|
|
|
2015-04-09 22:32:04 +06:00
|
|
|
# Compiler flags to generate dependency files.
|
|
|
|
#GENDEPFLAGS = -MMD -MP -MF .dep/$(@F).d
|
2016-07-30 21:16:34 +06:00
|
|
|
GENDEPFLAGS = -MMD -MP -MF $(patsubst %.o,%.td,$@)
|
2015-04-09 22:32:04 +06: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-31 01:07:01 +06:00
|
|
|
ALL_CFLAGS = $(MCUFLAGS) $(CFLAGS) $(EXTRAFLAGS)
|
2020-01-04 07:21:08 +06: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 20:04:53 +06:00
|
|
|
ALL_ASFLAGS = $(MCUFLAGS) -x assembler-with-cpp $(ASFLAGS) $(EXTRAFLAGS)
|
2015-04-09 22:32:04 +06:00
|
|
|
|
2018-12-15 11:31:56 +06: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 21:16:34 +06:00
|
|
|
MOVE_DEP = mv -f $(patsubst %.o,%.td,$@) $(patsubst %.o,%.d,$@)
|
|
|
|
|
2020-04-13 05:39:38 +06: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 22:08:49 +06:00
|
|
|
# Add QMK specific flags
|
|
|
|
DFU_SUFFIX ?= dfu-suffix
|
|
|
|
DFU_SUFFIX_ARGS ?=
|
|
|
|
|
2015-04-09 22:32:04 +06: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 23:31:31 +06:00
|
|
|
elf: $(BUILD_DIR)/$(TARGET).elf
|
|
|
|
hex: $(BUILD_DIR)/$(TARGET).hex
|
2021-04-06 12:39:15 +06:00
|
|
|
uf2: $(BUILD_DIR)/$(TARGET).uf2
|
2018-01-29 01:11:28 +06: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 23:31:31 +06:00
|
|
|
eep: $(BUILD_DIR)/$(TARGET).eep
|
|
|
|
lss: $(BUILD_DIR)/$(TARGET).lss
|
|
|
|
sym: $(BUILD_DIR)/$(TARGET).sym
|
2015-04-09 22:32:04 +06:00
|
|
|
LIBNAME=lib$(TARGET).a
|
|
|
|
lib: $(LIBNAME)
|
|
|
|
|
2022-02-10 03:50:55 +06:00
|
|
|
# Display size of file, modifying the output so people don't mistakenly grab the hex output
|
|
|
|
BINARY_SIZE = $(SIZE) --target=$(FORMAT) $(BUILD_DIR)/$(TARGET).hex | $(SED) -e 's/\.build\/.*$$/$(TARGET).$(FIRMWARE_FORMAT)/g'
|
2015-04-09 22:32:04 +06:00
|
|
|
|
|
|
|
sizebefore:
|
2022-02-10 03:50:55 +06:00
|
|
|
@if test -f $(BUILD_DIR)/$(TARGET).hex; then $(SECHO) $(MSG_SIZE_BEFORE); $(SILENT) || $(BINARY_SIZE); \
|
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 23:31:31 +06:00
|
|
|
2>/dev/null; $(SECHO); fi
|
2015-04-09 22:32:04 +06:00
|
|
|
|
2016-07-08 20:20:37 +06:00
|
|
|
sizeafter: $(BUILD_DIR)/$(TARGET).hex
|
2022-02-10 03:50:55 +06:00
|
|
|
@if test -f $(BUILD_DIR)/$(TARGET).hex; then $(SECHO); $(SECHO) $(MSG_SIZE_AFTER); $(SILENT) || $(BINARY_SIZE); \
|
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 23:31:31 +06:00
|
|
|
2>/dev/null; $(SECHO); fi
|
2015-04-09 22:32:04 +06:00
|
|
|
|
|
|
|
# Display compiler version information.
|
2016-06-18 06:25:58 +06: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 23:31:31 +06:00
|
|
|
@$(SILENT) || $(CC) --version
|
2015-04-09 22:32:04 +06:00
|
|
|
|
|
|
|
# Create final output files (.hex, .eep) from ELF output file.
|
|
|
|
%.hex: %.elf
|
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 20:04:53 +06:00
|
|
|
$(eval CMD=$(HEX) $< $@)
|
2021-04-06 12:39:15 +06:00
|
|
|
#@$(SILENT) || printf "$(MSG_EXECUTING) '$(CMD)':\n"
|
|
|
|
@$(SILENT) || printf "$(MSG_FLASH) $@" | $(AWK_CMD)
|
|
|
|
@$(BUILD_CMD)
|
|
|
|
|
|
|
|
%.uf2: %.hex
|
2022-03-07 16:04:22 +06:00
|
|
|
$(eval CMD=$(UF2CONV) $(BUILD_DIR)/$(TARGET).hex --output $(BUILD_DIR)/$(TARGET).uf2 --convert --family $(UF2_FAMILY) >/dev/null 2>&1)
|
2021-04-06 12:39:15 +06:00
|
|
|
#@$(SILENT) || printf "$(MSG_EXECUTING) '$(CMD)':\n"
|
|
|
|
@$(SILENT) || printf "$(MSG_UF2) $@" | $(AWK_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 23:31:31 +06:00
|
|
|
@$(BUILD_CMD)
|
2015-04-09 22:32:04 +06:00
|
|
|
|
|
|
|
%.eep: %.elf
|
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 20:04:53 +06:00
|
|
|
$(eval CMD=$(EEP) $< $@ || exit 0)
|
2021-04-06 12:39:15 +06:00
|
|
|
#@$(SILENT) || printf "$(MSG_EXECUTING) '$(CMD)':\n"
|
|
|
|
@$(SILENT) || printf "$(MSG_EEPROM) $@" | $(AWK_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 23:31:31 +06:00
|
|
|
@$(BUILD_CMD)
|
2015-04-09 22:32:04 +06: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 23:31:31 +06:00
|
|
|
$(eval CMD=$(OBJDUMP) -h -S -z $< > $@)
|
2021-04-06 12:39:15 +06:00
|
|
|
#@$(SILENT) || printf "$(MSG_EXECUTING) '$(CMD)':\n"
|
|
|
|
@$(SILENT) || printf "$(MSG_EXTENDED_LISTING) $@" | $(AWK_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 23:31:31 +06:00
|
|
|
@$(BUILD_CMD)
|
2015-04-09 22:32:04 +06: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 23:31:31 +06:00
|
|
|
$(eval CMD=$(NM) -n $< > $@ )
|
2021-04-06 12:39:15 +06:00
|
|
|
#@$(SILENT) || printf "$(MSG_EXECUTING) '$(CMD)':\n"
|
|
|
|
@$(SILENT) || printf "$(MSG_SYMBOL_TABLE) $@" | $(AWK_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 23:31:31 +06:00
|
|
|
@$(BUILD_CMD)
|
2015-04-09 22:32:04 +06:00
|
|
|
|
2016-07-05 22:28:17 +06:00
|
|
|
%.bin: %.elf
|
|
|
|
$(eval CMD=$(BIN) $< $@ || exit 0)
|
2021-04-06 12:39:15 +06:00
|
|
|
#@$(SILENT) || printf "$(MSG_EXECUTING) '$(CMD)':\n"
|
|
|
|
@$(SILENT) || printf "$(MSG_BIN) $@" | $(AWK_CMD)
|
2016-07-05 22:28:17 +06:00
|
|
|
@$(BUILD_CMD)
|
2019-07-07 22:08:49 +06:00
|
|
|
if [ ! -z "$(DFU_SUFFIX_ARGS)" ]; then \
|
|
|
|
$(DFU_SUFFIX) $(DFU_SUFFIX_ARGS) -a $(BUILD_DIR)/$(TARGET).bin 1>/dev/null ;\
|
|
|
|
fi
|
2021-05-11 21:17:28 +06:00
|
|
|
#$(SILENT) || printf "$(MSG_EXECUTING) '$(DFU_SUFFIX) $(DFU_SUFFIX_ARGS) -a $(BUILD_DIR)/$(TARGET).bin 1>/dev/null':\n" ;\
|
2019-07-07 22:08:49 +06:00
|
|
|
$(COPY) $(BUILD_DIR)/$(TARGET).bin $(TARGET).bin;
|
2016-07-05 22:28:17 +06:00
|
|
|
|
2017-08-09 01:26:19 +06:00
|
|
|
BEGIN = gccversion sizebefore
|
2016-07-09 02:19:48 +06:00
|
|
|
|
2015-04-09 22:32:04 +06: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 23:31:31 +06:00
|
|
|
.SECONDARY : $(BUILD_DIR)/$(TARGET).elf
|
2015-04-09 22:32:04 +06:00
|
|
|
.PRECIOUS : $(OBJ)
|
2016-07-31 01:07:01 +06:00
|
|
|
# Note the obj.txt depeendency is there to force linking if a source file is deleted
|
2016-08-15 11:20:16 +06: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 23:31:31 +06:00
|
|
|
@$(SILENT) || printf "$(MSG_LINKING) $@" | $(AWK_CMD)
|
2021-11-05 22:21:43 +06:00
|
|
|
$(eval CMD=MAKE=$(MAKE) $(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 23:31:31 +06: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-13 06:46:04 +06:00
|
|
|
|
2015-04-09 22:32:04 +06:00
|
|
|
|
2016-07-09 23:58:19 +06:00
|
|
|
define GEN_OBJRULE
|
2016-08-15 11:45:36 +06:00
|
|
|
$1_INCFLAGS := $$(patsubst %,-I%,$$($1_INC))
|
2016-08-15 11:58:05 +06:00
|
|
|
ifdef $1_CONFIG
|
2017-10-15 03:32:19 +06:00
|
|
|
$1_CONFIG_FLAGS += $$(patsubst %,-include %,$$($1_CONFIG))
|
2016-08-15 11:58:05 +06:00
|
|
|
endif
|
2018-12-15 11:31:56 +06:00
|
|
|
$1_CFLAGS = $$(ALL_CFLAGS) $$($1_DEFS) $$($1_INCFLAGS) $$($1_CONFIG_FLAGS) $$(NOLTO_CFLAGS)
|
2020-04-13 05:39:38 +06: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 11:20:16 +06:00
|
|
|
|
2015-04-09 22:32:04 +06:00
|
|
|
# Compile: create object files from C source files.
|
2016-07-31 16:49:04 +06:00
|
|
|
$1/%.o : %.c $1/%.d $1/cflags.txt $1/compiler.txt | $(BEGIN)
|
2016-07-09 23:58:19 +06:00
|
|
|
@mkdir -p $$(@D)
|
|
|
|
@$$(SILENT) || printf "$$(MSG_COMPILING) $$<" | $$(AWK_CMD)
|
2021-01-06 04:27:10 +06:00
|
|
|
$$(eval CC_EXEC := $$(CC))
|
|
|
|
ifneq ($$(VERBOSE_C_CMD),)
|
|
|
|
$$(if $$(filter $$(notdir $$(VERBOSE_C_CMD)),$$(notdir $$<)),$$(eval CC_EXEC += -v))
|
|
|
|
endif
|
|
|
|
ifneq ($$(VERBOSE_C_INCLUDE),)
|
|
|
|
$$(if $$(filter $$(notdir $$(VERBOSE_C_INCLUDE)),$$(notdir $$<)),$$(eval CC_EXEC += -H))
|
|
|
|
endif
|
|
|
|
$$(eval CMD := $$(CC_EXEC) -c $$($1_CFLAGS) $$(INIT_HOOK_CFLAGS) $$(GENDEPFLAGS) $$< -o $$@ && $$(MOVE_DEP))
|
2016-07-09 23:58:19 +06:00
|
|
|
@$$(BUILD_CMD)
|
2021-01-06 04:27:10 +06:00
|
|
|
ifneq ($$(DUMP_C_MACROS),)
|
|
|
|
$$(eval CMD := $$(CC) -E -dM $$($1_CFLAGS) $$(INIT_HOOK_CFLAGS) $$(GENDEPFLAGS) $$<)
|
|
|
|
@$$(if $$(filter $$(notdir $$(DUMP_C_MACROS)),$$(notdir $$<)),$$(BUILD_CMD))
|
|
|
|
endif
|
2015-04-09 22:32:04 +06:00
|
|
|
|
|
|
|
# Compile: create object files from C++ source files.
|
2020-01-04 07:21:08 +06:00
|
|
|
$1/%.o : %.cpp $1/%.d $1/cxxflags.txt $1/compiler.txt | $(BEGIN)
|
2016-07-09 23:58:19 +06:00
|
|
|
@mkdir -p $$(@D)
|
2020-01-04 07:21:08 +06:00
|
|
|
@$$(SILENT) || printf "$$(MSG_COMPILING_CXX) $$<" | $$(AWK_CMD)
|
2020-04-13 05:39:38 +06:00
|
|
|
$$(eval CMD=$$(CC) -c $$($1_CXXFLAGS) $$(INIT_HOOK_CFLAGS) $$(GENDEPFLAGS) $$< -o $$@ && $$(MOVE_DEP))
|
2016-08-22 12:16:08 +06:00
|
|
|
@$$(BUILD_CMD)
|
|
|
|
|
2020-01-04 07:21:08 +06:00
|
|
|
$1/%.o : %.cc $1/%.d $1/cxxflags.txt $1/compiler.txt | $(BEGIN)
|
2016-08-22 12:16:08 +06:00
|
|
|
@mkdir -p $$(@D)
|
2020-01-04 07:21:08 +06:00
|
|
|
@$$(SILENT) || printf "$$(MSG_COMPILING_CXX) $$<" | $$(AWK_CMD)
|
2020-04-13 05:39:38 +06:00
|
|
|
$$(eval CMD=$$(CC) -c $$($1_CXXFLAGS) $$(INIT_HOOK_CFLAGS) $$(GENDEPFLAGS) $$< -o $$@ && $$(MOVE_DEP))
|
2016-08-22 12:16:08 +06:00
|
|
|
@$$(BUILD_CMD)
|
2015-04-09 22:32:04 +06:00
|
|
|
|
2016-07-09 23:58:19 +06:00
|
|
|
# Assemble: create object files from assembler source files.
|
2016-07-31 16:49:04 +06:00
|
|
|
$1/%.o : %.S $1/asflags.txt $1/compiler.txt | $(BEGIN)
|
2016-07-09 23:58:19 +06:00
|
|
|
@mkdir -p $$(@D)
|
|
|
|
@$(SILENT) || printf "$$(MSG_ASSEMBLING) $$<" | $$(AWK_CMD)
|
2016-08-15 11:20:16 +06:00
|
|
|
$$(eval CMD=$$(CC) -c $$($1_ASFLAGS) $$< -o $$@)
|
2016-07-09 23:58:19 +06:00
|
|
|
@$$(BUILD_CMD)
|
2016-07-31 01:07:01 +06:00
|
|
|
|
2018-12-15 11:31:56 +06:00
|
|
|
$1/%.a : $1/%.o
|
|
|
|
@mkdir -p $$(@D)
|
|
|
|
@$(SILENT) || printf "Archiving: $$<" | $$(AWK_CMD)
|
2019-04-23 00:20:13 +06:00
|
|
|
$$(eval CMD=$$(AR) rcs $$@ $$<)
|
2018-12-15 11:31:56 +06:00
|
|
|
@$$(BUILD_CMD)
|
|
|
|
|
2016-07-31 01:07:01 +06:00
|
|
|
$1/force:
|
|
|
|
|
|
|
|
$1/cflags.txt: $1/force
|
2016-08-15 11:20:16 +06:00
|
|
|
echo '$$($1_CFLAGS)' | cmp -s - $$@ || echo '$$($1_CFLAGS)' > $$@
|
2016-07-31 01:07:01 +06:00
|
|
|
|
2020-01-04 07:21:08 +06:00
|
|
|
$1/cxxflags.txt: $1/force
|
|
|
|
echo '$$($1_CXXFLAGS)' | cmp -s - $$@ || echo '$$($1_CXXFLAGS)' > $$@
|
2016-07-31 01:07:01 +06:00
|
|
|
|
|
|
|
$1/asflags.txt: $1/force
|
2016-08-15 11:20:16 +06:00
|
|
|
echo '$$($1_ASFLAGS)' | cmp -s - $$@ || echo '$$($1_ASFLAGS)' > $$@
|
2016-07-31 01:07:01 +06:00
|
|
|
|
2016-07-31 16:49:04 +06:00
|
|
|
$1/compiler.txt: $1/force
|
|
|
|
$$(CC) --version | cmp -s - $$@ || $$(CC) --version > $$@
|
2016-07-09 23:58:19 +06:00
|
|
|
endef
|
|
|
|
|
2016-09-05 02:26:49 +06:00
|
|
|
.PRECIOUS: $(MASTER_OUTPUT)/obj.txt
|
2016-08-15 11:20:16 +06:00
|
|
|
$(MASTER_OUTPUT)/obj.txt: $(MASTER_OUTPUT)/force
|
2016-09-05 02:26:49 +06:00
|
|
|
echo '$(OBJ)' | cmp -s - $@ || echo '$(OBJ)' > $@
|
2016-08-15 11:20:16 +06:00
|
|
|
|
2016-09-05 02:26:49 +06:00
|
|
|
.PRECIOUS: $(MASTER_OUTPUT)/ldflags.txt
|
2016-08-15 11:20:16 +06:00
|
|
|
$(MASTER_OUTPUT)/ldflags.txt: $(MASTER_OUTPUT)/force
|
2016-09-05 02:26:49 +06:00
|
|
|
echo '$(LDFLAGS)' | cmp -s - $@ || echo '$(LDFLAGS)' > $@
|
2016-08-15 11:20:16 +06:00
|
|
|
|
|
|
|
|
2016-07-30 21:16:34 +06:00
|
|
|
# We have to use static rules for the .d files for some reason
|
2018-12-15 11:31:56 +06:00
|
|
|
DEPS = $(patsubst %.o,%.d,$(patsubst %.a,%.o,$(OBJ)))
|
2016-07-30 21:16:34 +06: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-13 06:46:04 +06:00
|
|
|
|
2016-07-30 21:16:34 +06:00
|
|
|
|
2016-08-15 11:20:16 +06:00
|
|
|
$(foreach OUTPUT,$(OUTPUTS),$(eval $(call GEN_OBJRULE,$(OUTPUT))))
|
2015-04-09 22:32:04 +06:00
|
|
|
|
|
|
|
# Create preprocessed source for use in sending a bug report.
|
2016-07-09 02:19:48 +06:00
|
|
|
%.i : %.c | $(BEGIN)
|
2016-06-18 06:25:58 +06:00
|
|
|
$(CC) -E -mmcu=$(MCU) $(CFLAGS) $< -o $@
|
2015-04-09 22:32:04 +06:00
|
|
|
|
|
|
|
# Target: clean project.
|
2016-07-30 21:16:34 +06:00
|
|
|
clean:
|
2016-08-20 15:44:04 +06:00
|
|
|
$(foreach OUTPUT,$(OUTPUTS), $(REMOVE) -r $(OUTPUT) 2>/dev/null)
|
2016-07-31 17:17:32 +06:00
|
|
|
$(REMOVE) $(BUILD_DIR)/$(TARGET).*
|
2015-04-09 22:32:04 +06:00
|
|
|
|
|
|
|
show_path:
|
|
|
|
@echo VPATH=$(VPATH)
|
|
|
|
@echo SRC=$(SRC)
|
2016-08-15 11:20:16 +06:00
|
|
|
@echo OBJ=$(OBJ)
|
2015-04-09 22:32:04 +06:00
|
|
|
|
2020-08-16 02:51:35 +06: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 11:45:31 +06:00
|
|
|
objs-size:
|
|
|
|
for i in $(OBJ); do echo $$i; done | sort | xargs $(SIZE)
|
|
|
|
|
2018-03-27 02:08:08 +06:00
|
|
|
ifeq ($(findstring avr-gcc,$(CC)),avr-gcc)
|
2019-03-27 21:51:56 +06:00
|
|
|
SIZE_MARGIN = 1024
|
|
|
|
|
2017-11-28 10:08:21 +06:00
|
|
|
check-size:
|
2022-02-10 03:50:55 +06:00
|
|
|
$(eval MAX_SIZE=$(shell n=`$(CC) -E -mmcu=$(MCU) -D__ASSEMBLER__ $(CFLAGS) $(OPT_DEFS) platforms/avr/bootloader_size.c 2> /dev/null | $(SED) -ne 's/\r//;/^#/n;/^AVR_SIZE:/,$${s/^AVR_SIZE: //;p;}'` && echo $$(($$n)) || echo 0))
|
2017-11-28 10:08:21 +06: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 18:35:24 +06:00
|
|
|
$(eval FREE_SIZE=$(shell expr $(MAX_SIZE) - $(CURRENT_SIZE)))
|
|
|
|
$(eval OVER_SIZE=$(shell expr $(CURRENT_SIZE) - $(MAX_SIZE)))
|
2019-07-12 01:05:13 +06:00
|
|
|
$(eval PERCENT_SIZE=$(shell expr $(CURRENT_SIZE) \* 100 / $(MAX_SIZE)))
|
2017-11-28 10:08:21 +06:00
|
|
|
if [ $(MAX_SIZE) -gt 0 ] && [ $(CURRENT_SIZE) -gt 0 ]; then \
|
|
|
|
$(SILENT) || printf "$(MSG_CHECK_FILESIZE)" | $(AWK_CMD); \
|
2019-03-27 21:51:56 +06: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)"; \
|
2021-10-06 07:58:40 +06:00
|
|
|
fi ; \
|
|
|
|
fi ; \
|
2017-11-28 10:08:21 +06:00
|
|
|
fi
|
2018-02-07 06:32:31 +06:00
|
|
|
else
|
|
|
|
check-size:
|
2021-09-29 02:08:46 +06:00
|
|
|
$(SILENT) || echo "$(MSG_CHECK_FILESIZE_SKIPPED)"
|
2018-02-07 06:32:31 +06:00
|
|
|
endif
|
2017-11-28 10:08:21 +06:00
|
|
|
|
2020-12-31 12:20:56 +06: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 23:31:31 +06:00
|
|
|
# Create build directory
|
2016-08-27 21:59:22 +06:00
|
|
|
$(shell mkdir -p $(BUILD_DIR) 2>/dev/null)
|
2015-04-09 22:32:04 +06:00
|
|
|
|
|
|
|
# Create object files directory
|
2016-08-27 21:59:22 +06:00
|
|
|
$(eval $(foreach OUTPUT,$(OUTPUTS),$(shell mkdir -p $(OUTPUT) 2>/dev/null)))
|
2015-04-09 22:32:04 +06:00
|
|
|
|
|
|
|
# Include the dependency files.
|
2018-12-15 11:31:56 +06:00
|
|
|
-include $(patsubst %.o,%.d,$(patsubst %.a,%.o,$(OBJ)))
|
2015-04-09 22:32:04 +06:00
|
|
|
|
|
|
|
|
|
|
|
# Listing of phony targets.
|
2020-08-16 02:51:35 +06:00
|
|
|
.PHONY : all dump_vars finish sizebefore sizeafter qmkversion \
|
2021-04-06 12:39:15 +06:00
|
|
|
gccversion build elf hex uf2 eep lss sym coff extcoff \
|
2015-04-09 22:32:04 +06:00
|
|
|
clean clean_list debug gdb-config show_path \
|
2020-04-17 13:50:58 +06:00
|
|
|
program teensy dfu dfu-ee dfu-start \
|
2019-08-21 04:39:24 +06:00
|
|
|
flash dfu-split-left dfu-split-right \
|
|
|
|
avrdude-split-left avrdude-split-right \
|
|
|
|
avrdude-loop usbasp
|