2015-04-09 16:32:04 +00:00
|
|
|
# Hey Emacs, this is a -*- makefile -*-
|
|
|
|
#----------------------------------------------------------------------------
|
2016-06-21 14:21:43 +00:00
|
|
|
|
2022-10-05 16:32:07 +00:00
|
|
|
# Enable vpath searching for source files only
|
2016-07-31 10:24:25 +00:00
|
|
|
# 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 06:16:08 +00:00
|
|
|
vpath %.cc $(VPATH_SRC)
|
2016-07-31 10:24:25 +00:00
|
|
|
vpath %.hpp $(VPATH_SRC)
|
|
|
|
vpath %.S $(VPATH_SRC)
|
|
|
|
VPATH :=
|
|
|
|
|
2023-09-17 04:25:46 +00:00
|
|
|
# Helper to return the distinct elements of a list
|
|
|
|
uniq = $(if $1,$(firstword $1) $(call uniq,$(filter-out $(firstword $1),$1)))
|
|
|
|
|
2016-08-15 05:20:16 +00:00
|
|
|
# Convert all SRC to OBJ
|
|
|
|
define OBJ_FROM_SRC
|
2018-12-15 05:31:56 +00: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 05:20:16 +00: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 05:31:56 +00:00
|
|
|
NO_LTO_OBJ := $(filter %.a,$(OBJ))
|
2016-08-15 05:20:16 +00:00
|
|
|
|
|
|
|
MASTER_OUTPUT := $(firstword $(OUTPUTS))
|
|
|
|
|
2015-04-09 16:32:04 +00:00
|
|
|
# Output format. (can be srec, ihex, binary)
|
|
|
|
FORMAT = ihex
|
|
|
|
|
2016-06-18 00:25:58 +00:00
|
|
|
# Optimization level, can be [0, 1, 2, 3, s].
|
2020-05-20 15:28:39 +00:00
|
|
|
OPT ?= s
|
2015-04-09 16:32:04 +00:00
|
|
|
|
2022-06-05 22:47:22 +00:00
|
|
|
# Compiler flag to set the C and C++ language standard level
|
|
|
|
CSTANDARD = -std=gnu11
|
|
|
|
CXXSTANDARD = -std=gnu++14
|
2016-08-15 05:20:16 +00:00
|
|
|
|
2021-10-21 13:39:13 +00:00
|
|
|
# Speed up recompilations by opt-in usage of ccache
|
2021-10-21 23:21:43 +00:00
|
|
|
USE_CCACHE ?= no
|
2021-10-21 13:39:13 +00:00
|
|
|
ifneq ($(USE_CCACHE),no)
|
|
|
|
CC_PREFIX ?= ccache
|
|
|
|
endif
|
2015-04-09 16:32:04 +00:00
|
|
|
|
2024-09-01 17:54:53 +00:00
|
|
|
#---------------- Debug Options ----------------
|
|
|
|
|
|
|
|
DEBUG_ENABLE ?= no
|
|
|
|
ifeq ($(strip $(DEBUG_ENABLE)),yes)
|
|
|
|
CFLAGS += -ggdb3
|
|
|
|
CXXFLAGS += -ggdb3
|
|
|
|
ASFLAGS += -ggdb3
|
|
|
|
# Create a map file when debugging
|
|
|
|
LDFLAGS += -Wl,-Map=$(BUILD_DIR)/$(TARGET).map,--cref
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
2022-06-05 22:47:22 +00:00
|
|
|
#---------------- C Compiler Options ----------------
|
|
|
|
|
2021-10-28 20:02:22 +00:00
|
|
|
ifeq ($(strip $(LTO_ENABLE)), yes)
|
|
|
|
CDEFS += -flto
|
|
|
|
CDEFS += -DLTO_ENABLE
|
|
|
|
endif
|
|
|
|
|
2015-04-09 16:32:04 +00: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 17:31:31 +00:00
|
|
|
# add color
|
|
|
|
ifeq ($(COLOR),true)
|
2023-11-13 22:41:12 +00:00
|
|
|
ifeq ("$(shell echo "int main(){}" | $(CC) -fdiagnostics-color -x c - -o /dev/null 2>&1)", "")
|
|
|
|
CFLAGS+= -fdiagnostics-color
|
|
|
|
endif
|
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 17:31:31 +00:00
|
|
|
endif
|
2015-04-09 16:32:04 +00:00
|
|
|
CFLAGS += -Wall
|
|
|
|
CFLAGS += -Wstrict-prototypes
|
2017-04-13 13:12:55 +00:00
|
|
|
ifneq ($(strip $(ALLOW_WARNINGS)), yes)
|
|
|
|
CFLAGS += -Werror
|
|
|
|
endif
|
2015-04-09 16:32:04 +00:00
|
|
|
CFLAGS += $(CSTANDARD)
|
|
|
|
|
2021-02-28 16:01:16 +00: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-05 22:47:22 +00:00
|
|
|
#---------------- C++ Compiler Options ----------------
|
|
|
|
|
2020-01-04 01:21:08 +00:00
|
|
|
CXXFLAGS += $(CXXDEFS)
|
|
|
|
CXXFLAGS += -O$(OPT)
|
2022-10-05 16:32:07 +00:00
|
|
|
# to suppress "warning: only initialized variables can be placed into program memory area"
|
2020-01-04 01:21:08 +00:00
|
|
|
CXXFLAGS += -w
|
|
|
|
CXXFLAGS += -Wall
|
|
|
|
CXXFLAGS += -Wundef
|
2021-02-28 16:01:16 +00:00
|
|
|
|
2017-04-13 13:12:55 +00:00
|
|
|
ifneq ($(strip $(ALLOW_WARNINGS)), yes)
|
2020-01-04 01:21:08 +00:00
|
|
|
CXXFLAGS += -Werror
|
2017-04-13 13:12:55 +00:00
|
|
|
endif
|
2015-04-09 16:32:04 +00:00
|
|
|
|
|
|
|
#---------------- Assembler Options ----------------
|
2022-06-05 22:47:22 +00: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 00:46:04 +00:00
|
|
|
ASFLAGS += $(ADEFS)
|
2021-01-05 22:27:10 +00:00
|
|
|
ifeq ($(VERBOSE_AS_CMD),yes)
|
|
|
|
ASFLAGS += -v
|
|
|
|
endif
|
2015-04-09 16:32:04 +00:00
|
|
|
|
|
|
|
#---------------- Linker Options ----------------
|
2016-08-27 14:43:35 +00:00
|
|
|
|
2021-01-05 22:27:10 +00:00
|
|
|
ifeq ($(VERBOSE_LD_CMD),yes)
|
|
|
|
LDFLAGS += -v
|
|
|
|
endif
|
2024-09-01 17:54:53 +00:00
|
|
|
|
2015-04-09 16:32:04 +00:00
|
|
|
LDFLAGS += $(EXTMEMOPTS)
|
|
|
|
LDFLAGS += $(patsubst %,-L%,$(EXTRALIBDIRS))
|
2022-06-05 22:47:22 +00:00
|
|
|
LDFLAGS += -lm
|
2015-04-09 16:32:04 +00:00
|
|
|
# You can give EXTRALDFLAGS at 'make' command line.
|
|
|
|
LDFLAGS += $(EXTRALDFLAGS)
|
|
|
|
|
2021-11-12 07:31:40 +00: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)
|
2024-09-01 17:54:53 +00:00
|
|
|
LDFLAGS += -Wa,-adhlns=$(BUILD_DIR)/$(TARGET).lst
|
2021-11-12 07:31:40 +00:00
|
|
|
else
|
2024-09-01 17:54:53 +00:00
|
|
|
CFLAGS += -Wa,-adhlns=$(@:%.o=%.lst)
|
2021-11-12 07:31:40 +00:00
|
|
|
CXXFLAGS += -Wa,-adhlns=$(@:%.o=%.lst)
|
2024-09-01 17:54:53 +00:00
|
|
|
ASFLAGS += -Wa,-adhlns=$(@:%.o=%.lst),--listing-cont-lines=100
|
2021-11-12 07:31:40 +00:00
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2015-04-09 16:32:04 +00:00
|
|
|
# Define programs and commands.
|
|
|
|
SHELL = sh
|
2022-02-09 21:50:55 +00:00
|
|
|
SED = sed
|
2015-04-09 16:32:04 +00: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 17:31:31 +00:00
|
|
|
SECHO = $(SILENT) || echo
|
2020-12-31 06:20:56 +00:00
|
|
|
MD5SUM ?= md5sum
|
|
|
|
ifneq ($(filter Darwin FreeBSD,$(shell uname -s)),)
|
|
|
|
MD5SUM = md5
|
|
|
|
endif
|
2015-04-09 16:32:04 +00:00
|
|
|
|
2021-04-06 06:39:15 +00: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
|
2023-05-25 22:07:47 +00:00
|
|
|
UF2CONV_ARGS ?=
|
2021-04-06 06:39:15 +00:00
|
|
|
UF2_FAMILY ?= 0x0
|
|
|
|
|
2015-04-09 16:32:04 +00:00
|
|
|
# Compiler flags to generate dependency files.
|
|
|
|
#GENDEPFLAGS = -MMD -MP -MF .dep/$(@F).d
|
2016-07-30 15:16:34 +00:00
|
|
|
GENDEPFLAGS = -MMD -MP -MF $(patsubst %.o,%.td,$@)
|
2015-04-09 16:32:04 +00: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 19:07:01 +00:00
|
|
|
ALL_CFLAGS = $(MCUFLAGS) $(CFLAGS) $(EXTRAFLAGS)
|
2020-01-04 01:21:08 +00: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 14:04:53 +00:00
|
|
|
ALL_ASFLAGS = $(MCUFLAGS) -x assembler-with-cpp $(ASFLAGS) $(EXTRAFLAGS)
|
2015-04-09 16:32:04 +00:00
|
|
|
|
2018-12-15 05:31:56 +00: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 15:16:34 +00:00
|
|
|
MOVE_DEP = mv -f $(patsubst %.o,%.td,$@) $(patsubst %.o,%.d,$@)
|
|
|
|
|
2020-04-12 23:39:38 +00:00
|
|
|
# For a ChibiOS build, ensure that the board files have the hook overrides injected
|
|
|
|
define BOARDSRC_INJECT_HOOKS
|
2023-06-20 22:41:49 +00:00
|
|
|
$(INTERMEDIATE_OUTPUT)/$(patsubst %.c,%.o,$(patsubst ./%,%,$1)): INIT_HOOK_CFLAGS += -include $(TOP_DIR)/tmk_core/protocol/chibios/init_hooks.h
|
2020-04-12 23:39:38 +00:00
|
|
|
endef
|
|
|
|
$(foreach LOBJ, $(BOARDSRC), $(eval $(call BOARDSRC_INJECT_HOOKS,$(LOBJ))))
|
|
|
|
|
2019-07-07 16:08:49 +00:00
|
|
|
# Add QMK specific flags
|
|
|
|
DFU_SUFFIX ?= dfu-suffix
|
|
|
|
DFU_SUFFIX_ARGS ?=
|
|
|
|
|
2015-04-09 16:32:04 +00: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 17:31:31 +00:00
|
|
|
elf: $(BUILD_DIR)/$(TARGET).elf
|
|
|
|
hex: $(BUILD_DIR)/$(TARGET).hex
|
2021-04-06 06:39:15 +00:00
|
|
|
uf2: $(BUILD_DIR)/$(TARGET).uf2
|
2023-11-27 20:53:43 +00:00
|
|
|
cpfirmware_qmk: $(FIRMWARE_FORMAT)
|
2018-01-28 19:11:28 +00:00
|
|
|
$(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 17:31:31 +00:00
|
|
|
eep: $(BUILD_DIR)/$(TARGET).eep
|
|
|
|
lss: $(BUILD_DIR)/$(TARGET).lss
|
|
|
|
sym: $(BUILD_DIR)/$(TARGET).sym
|
2015-04-09 16:32:04 +00:00
|
|
|
LIBNAME=lib$(TARGET).a
|
|
|
|
lib: $(LIBNAME)
|
|
|
|
|
2023-11-27 20:53:43 +00:00
|
|
|
cpfirmware: cpfirmware_qmk
|
|
|
|
|
|
|
|
ifneq ($(QMK_USERSPACE),)
|
|
|
|
cpfirmware: cpfirmware_userspace
|
|
|
|
cpfirmware_userspace: cpfirmware_qmk
|
|
|
|
$(SILENT) || printf "Copying $(TARGET).$(FIRMWARE_FORMAT) to userspace folder" | $(AWK_CMD)
|
|
|
|
$(COPY) $(BUILD_DIR)/$(TARGET).$(FIRMWARE_FORMAT) $(QMK_USERSPACE)/$(TARGET).$(FIRMWARE_FORMAT) && $(PRINT_OK)
|
|
|
|
endif
|
|
|
|
|
2022-02-09 21:50:55 +00: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 16:32:04 +00:00
|
|
|
|
|
|
|
sizebefore:
|
2022-02-09 21:50:55 +00: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 17:31:31 +00:00
|
|
|
2>/dev/null; $(SECHO); fi
|
2015-04-09 16:32:04 +00:00
|
|
|
|
2016-07-08 14:20:37 +00:00
|
|
|
sizeafter: $(BUILD_DIR)/$(TARGET).hex
|
2022-02-09 21:50:55 +00: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 17:31:31 +00:00
|
|
|
2>/dev/null; $(SECHO); fi
|
2015-04-09 16:32:04 +00:00
|
|
|
|
|
|
|
# Display compiler version information.
|
2016-06-18 00:25:58 +00: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 17:31:31 +00:00
|
|
|
@$(SILENT) || $(CC) --version
|
2015-04-09 16:32:04 +00: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 14:04:53 +00:00
|
|
|
$(eval CMD=$(HEX) $< $@)
|
2021-04-06 06:39:15 +00:00
|
|
|
#@$(SILENT) || printf "$(MSG_EXECUTING) '$(CMD)':\n"
|
|
|
|
@$(SILENT) || printf "$(MSG_FLASH) $@" | $(AWK_CMD)
|
|
|
|
@$(BUILD_CMD)
|
|
|
|
|
2023-02-26 04:24:43 +00:00
|
|
|
%.uf2: %.elf
|
2023-05-25 22:07:47 +00:00
|
|
|
$(eval CMD=$(HEX) $< $(BUILD_DIR)/$(TARGET).tmp && $(UF2CONV) $(UF2CONV_ARGS) $(BUILD_DIR)/$(TARGET).tmp --output $@ --convert --family $(UF2_FAMILY) >/dev/null 2>&1)
|
2021-04-06 06:39:15 +00: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 17:31:31 +00:00
|
|
|
@$(BUILD_CMD)
|
2015-04-09 16:32:04 +00: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 14:04:53 +00:00
|
|
|
$(eval CMD=$(EEP) $< $@ || exit 0)
|
2021-04-06 06:39:15 +00: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 17:31:31 +00:00
|
|
|
@$(BUILD_CMD)
|
2015-04-09 16:32:04 +00: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 17:31:31 +00:00
|
|
|
$(eval CMD=$(OBJDUMP) -h -S -z $< > $@)
|
2021-04-06 06:39:15 +00: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 17:31:31 +00:00
|
|
|
@$(BUILD_CMD)
|
2015-04-09 16:32:04 +00: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 17:31:31 +00:00
|
|
|
$(eval CMD=$(NM) -n $< > $@ )
|
2021-04-06 06:39:15 +00: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 17:31:31 +00:00
|
|
|
@$(BUILD_CMD)
|
2015-04-09 16:32:04 +00:00
|
|
|
|
2016-07-05 16:28:17 +00:00
|
|
|
%.bin: %.elf
|
|
|
|
$(eval CMD=$(BIN) $< $@ || exit 0)
|
2021-04-06 06:39:15 +00:00
|
|
|
#@$(SILENT) || printf "$(MSG_EXECUTING) '$(CMD)':\n"
|
|
|
|
@$(SILENT) || printf "$(MSG_BIN) $@" | $(AWK_CMD)
|
2016-07-05 16:28:17 +00:00
|
|
|
@$(BUILD_CMD)
|
2019-07-07 16:08:49 +00:00
|
|
|
if [ ! -z "$(DFU_SUFFIX_ARGS)" ]; then \
|
|
|
|
$(DFU_SUFFIX) $(DFU_SUFFIX_ARGS) -a $(BUILD_DIR)/$(TARGET).bin 1>/dev/null ;\
|
|
|
|
fi
|
2021-05-11 15:17:28 +00:00
|
|
|
#$(SILENT) || printf "$(MSG_EXECUTING) '$(DFU_SUFFIX) $(DFU_SUFFIX_ARGS) -a $(BUILD_DIR)/$(TARGET).bin 1>/dev/null':\n" ;\
|
2019-07-07 16:08:49 +00:00
|
|
|
$(COPY) $(BUILD_DIR)/$(TARGET).bin $(TARGET).bin;
|
2016-07-05 16:28:17 +00:00
|
|
|
|
2017-08-08 19:26:19 +00:00
|
|
|
BEGIN = gccversion sizebefore
|
2016-07-08 20:19:48 +00:00
|
|
|
|
2015-04-09 16:32:04 +00: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 17:31:31 +00:00
|
|
|
.SECONDARY : $(BUILD_DIR)/$(TARGET).elf
|
2015-04-09 16:32:04 +00:00
|
|
|
.PRECIOUS : $(OBJ)
|
2016-07-30 19:07:01 +00:00
|
|
|
# Note the obj.txt depeendency is there to force linking if a source file is deleted
|
2016-08-15 05:20:16 +00: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 17:31:31 +00:00
|
|
|
@$(SILENT) || printf "$(MSG_LINKING) $@" | $(AWK_CMD)
|
2023-09-17 04:25:46 +00:00
|
|
|
$(eval CMD=MAKE=$(MAKE) $(CC) $(ALL_CFLAGS) $(call uniq,$(OBJ)) --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 17:31:31 +00: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 00:46:04 +00:00
|
|
|
|
2015-04-09 16:32:04 +00:00
|
|
|
|
2016-07-09 17:58:19 +00:00
|
|
|
define GEN_OBJRULE
|
2016-08-15 05:45:36 +00:00
|
|
|
$1_INCFLAGS := $$(patsubst %,-I%,$$($1_INC))
|
2016-08-15 05:58:05 +00:00
|
|
|
ifdef $1_CONFIG
|
2017-10-14 21:32:19 +00:00
|
|
|
$1_CONFIG_FLAGS += $$(patsubst %,-include %,$$($1_CONFIG))
|
2016-08-15 05:58:05 +00:00
|
|
|
endif
|
2018-12-15 05:31:56 +00:00
|
|
|
$1_CFLAGS = $$(ALL_CFLAGS) $$($1_DEFS) $$($1_INCFLAGS) $$($1_CONFIG_FLAGS) $$(NOLTO_CFLAGS)
|
2020-04-12 23:39:38 +00: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 05:20:16 +00:00
|
|
|
|
2015-04-09 16:32:04 +00:00
|
|
|
# Compile: create object files from C source files.
|
2016-07-31 10:49:04 +00:00
|
|
|
$1/%.o : %.c $1/%.d $1/cflags.txt $1/compiler.txt | $(BEGIN)
|
2016-07-09 17:58:19 +00:00
|
|
|
@mkdir -p $$(@D)
|
|
|
|
@$$(SILENT) || printf "$$(MSG_COMPILING) $$<" | $$(AWK_CMD)
|
2021-01-05 22:27:10 +00: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 17:58:19 +00:00
|
|
|
@$$(BUILD_CMD)
|
2021-01-05 22:27:10 +00: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 16:32:04 +00:00
|
|
|
|
|
|
|
# Compile: create object files from C++ source files.
|
2020-01-04 01:21:08 +00:00
|
|
|
$1/%.o : %.cpp $1/%.d $1/cxxflags.txt $1/compiler.txt | $(BEGIN)
|
2016-07-09 17:58:19 +00:00
|
|
|
@mkdir -p $$(@D)
|
2020-01-04 01:21:08 +00:00
|
|
|
@$$(SILENT) || printf "$$(MSG_COMPILING_CXX) $$<" | $$(AWK_CMD)
|
2020-04-12 23:39:38 +00:00
|
|
|
$$(eval CMD=$$(CC) -c $$($1_CXXFLAGS) $$(INIT_HOOK_CFLAGS) $$(GENDEPFLAGS) $$< -o $$@ && $$(MOVE_DEP))
|
2016-08-22 06:16:08 +00:00
|
|
|
@$$(BUILD_CMD)
|
|
|
|
|
2020-01-04 01:21:08 +00:00
|
|
|
$1/%.o : %.cc $1/%.d $1/cxxflags.txt $1/compiler.txt | $(BEGIN)
|
2016-08-22 06:16:08 +00:00
|
|
|
@mkdir -p $$(@D)
|
2020-01-04 01:21:08 +00:00
|
|
|
@$$(SILENT) || printf "$$(MSG_COMPILING_CXX) $$<" | $$(AWK_CMD)
|
2020-04-12 23:39:38 +00:00
|
|
|
$$(eval CMD=$$(CC) -c $$($1_CXXFLAGS) $$(INIT_HOOK_CFLAGS) $$(GENDEPFLAGS) $$< -o $$@ && $$(MOVE_DEP))
|
2016-08-22 06:16:08 +00:00
|
|
|
@$$(BUILD_CMD)
|
2015-04-09 16:32:04 +00:00
|
|
|
|
2016-07-09 17:58:19 +00:00
|
|
|
# Assemble: create object files from assembler source files.
|
2016-07-31 10:49:04 +00:00
|
|
|
$1/%.o : %.S $1/asflags.txt $1/compiler.txt | $(BEGIN)
|
2016-07-09 17:58:19 +00:00
|
|
|
@mkdir -p $$(@D)
|
|
|
|
@$(SILENT) || printf "$$(MSG_ASSEMBLING) $$<" | $$(AWK_CMD)
|
2016-08-15 05:20:16 +00:00
|
|
|
$$(eval CMD=$$(CC) -c $$($1_ASFLAGS) $$< -o $$@)
|
2016-07-09 17:58:19 +00:00
|
|
|
@$$(BUILD_CMD)
|
2016-07-30 19:07:01 +00:00
|
|
|
|
2018-12-15 05:31:56 +00:00
|
|
|
$1/%.a : $1/%.o
|
|
|
|
@mkdir -p $$(@D)
|
|
|
|
@$(SILENT) || printf "Archiving: $$<" | $$(AWK_CMD)
|
2019-04-22 18:20:13 +00:00
|
|
|
$$(eval CMD=$$(AR) rcs $$@ $$<)
|
2018-12-15 05:31:56 +00:00
|
|
|
@$$(BUILD_CMD)
|
|
|
|
|
2016-07-30 19:07:01 +00:00
|
|
|
$1/force:
|
|
|
|
|
|
|
|
$1/cflags.txt: $1/force
|
2016-08-15 05:20:16 +00:00
|
|
|
echo '$$($1_CFLAGS)' | cmp -s - $$@ || echo '$$($1_CFLAGS)' > $$@
|
2016-07-30 19:07:01 +00:00
|
|
|
|
2020-01-04 01:21:08 +00:00
|
|
|
$1/cxxflags.txt: $1/force
|
|
|
|
echo '$$($1_CXXFLAGS)' | cmp -s - $$@ || echo '$$($1_CXXFLAGS)' > $$@
|
2016-07-30 19:07:01 +00:00
|
|
|
|
|
|
|
$1/asflags.txt: $1/force
|
2016-08-15 05:20:16 +00:00
|
|
|
echo '$$($1_ASFLAGS)' | cmp -s - $$@ || echo '$$($1_ASFLAGS)' > $$@
|
2016-07-30 19:07:01 +00:00
|
|
|
|
2016-07-31 10:49:04 +00:00
|
|
|
$1/compiler.txt: $1/force
|
2022-11-01 00:35:38 +00:00
|
|
|
test -f $$@ || touch $$@
|
2016-07-31 10:49:04 +00:00
|
|
|
$$(CC) --version | cmp -s - $$@ || $$(CC) --version > $$@
|
2016-07-09 17:58:19 +00:00
|
|
|
endef
|
|
|
|
|
2016-09-04 20:26:49 +00:00
|
|
|
.PRECIOUS: $(MASTER_OUTPUT)/obj.txt
|
2016-08-15 05:20:16 +00:00
|
|
|
$(MASTER_OUTPUT)/obj.txt: $(MASTER_OUTPUT)/force
|
2016-09-04 20:26:49 +00:00
|
|
|
echo '$(OBJ)' | cmp -s - $@ || echo '$(OBJ)' > $@
|
2016-08-15 05:20:16 +00:00
|
|
|
|
2016-09-04 20:26:49 +00:00
|
|
|
.PRECIOUS: $(MASTER_OUTPUT)/ldflags.txt
|
2016-08-15 05:20:16 +00:00
|
|
|
$(MASTER_OUTPUT)/ldflags.txt: $(MASTER_OUTPUT)/force
|
2016-09-04 20:26:49 +00:00
|
|
|
echo '$(LDFLAGS)' | cmp -s - $@ || echo '$(LDFLAGS)' > $@
|
2016-08-15 05:20:16 +00:00
|
|
|
|
|
|
|
|
2016-07-30 15:16:34 +00:00
|
|
|
# We have to use static rules for the .d files for some reason
|
2018-12-15 05:31:56 +00:00
|
|
|
DEPS = $(patsubst %.o,%.d,$(patsubst %.a,%.o,$(OBJ)))
|
2016-07-30 15:16:34 +00: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 00:46:04 +00:00
|
|
|
|
2016-07-30 15:16:34 +00:00
|
|
|
|
2016-08-15 05:20:16 +00:00
|
|
|
$(foreach OUTPUT,$(OUTPUTS),$(eval $(call GEN_OBJRULE,$(OUTPUT))))
|
2015-04-09 16:32:04 +00:00
|
|
|
|
|
|
|
# Create preprocessed source for use in sending a bug report.
|
2016-07-08 20:19:48 +00:00
|
|
|
%.i : %.c | $(BEGIN)
|
2016-06-18 00:25:58 +00:00
|
|
|
$(CC) -E -mmcu=$(MCU) $(CFLAGS) $< -o $@
|
2015-04-09 16:32:04 +00:00
|
|
|
|
|
|
|
# Target: clean project.
|
2016-07-30 15:16:34 +00:00
|
|
|
clean:
|
2016-08-20 09:44:04 +00:00
|
|
|
$(foreach OUTPUT,$(OUTPUTS), $(REMOVE) -r $(OUTPUT) 2>/dev/null)
|
2016-07-31 11:17:32 +00:00
|
|
|
$(REMOVE) $(BUILD_DIR)/$(TARGET).*
|
2015-04-09 16:32:04 +00:00
|
|
|
|
|
|
|
show_path:
|
|
|
|
@echo VPATH=$(VPATH)
|
|
|
|
@echo SRC=$(SRC)
|
2016-08-15 05:20:16 +00:00
|
|
|
@echo OBJ=$(OBJ)
|
2015-04-09 16:32:04 +00:00
|
|
|
|
2020-08-15 20:51:35 +00:00
|
|
|
dump_vars: ERROR_IF_EMPTY=""
|
|
|
|
dump_vars: ERROR_IF_NONBOOL=""
|
|
|
|
dump_vars: ERROR_IF_UNSET=""
|
2022-08-04 11:05:16 +00:00
|
|
|
dump_vars: CATASTROPHIC_ERROR=""
|
2020-08-15 20:51:35 +00:00
|
|
|
dump_vars:
|
|
|
|
@$(foreach V,$(sort $(.VARIABLES)),$(if $(filter-out environment% default automatic,$(origin $V)),$(info $V=$($V))))
|
|
|
|
|
2019-07-16 05:45:31 +00:00
|
|
|
objs-size:
|
|
|
|
for i in $(OBJ); do echo $$i; done | sort | xargs $(SIZE)
|
|
|
|
|
2019-03-27 15:51:56 +00:00
|
|
|
|
2023-09-12 04:16:39 +00:00
|
|
|
# size check optionally implemented in its platform.mk
|
2017-11-28 04:08:21 +00:00
|
|
|
check-size:
|
|
|
|
|
2020-12-31 06:20:56 +00: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 17:31:31 +00:00
|
|
|
# Create build directory
|
2016-08-27 15:59:22 +00:00
|
|
|
$(shell mkdir -p $(BUILD_DIR) 2>/dev/null)
|
2015-04-09 16:32:04 +00:00
|
|
|
|
|
|
|
# Create object files directory
|
2016-08-27 15:59:22 +00:00
|
|
|
$(eval $(foreach OUTPUT,$(OUTPUTS),$(shell mkdir -p $(OUTPUT) 2>/dev/null)))
|
2015-04-09 16:32:04 +00:00
|
|
|
|
|
|
|
# Include the dependency files.
|
2018-12-15 05:31:56 +00:00
|
|
|
-include $(patsubst %.o,%.d,$(patsubst %.a,%.o,$(OBJ)))
|
2015-04-09 16:32:04 +00:00
|
|
|
|
|
|
|
|
|
|
|
# Listing of phony targets.
|
2020-08-15 20:51:35 +00:00
|
|
|
.PHONY : all dump_vars finish sizebefore sizeafter qmkversion \
|
2021-04-06 06:39:15 +00:00
|
|
|
gccversion build elf hex uf2 eep lss sym coff extcoff \
|
2015-04-09 16:32:04 +00:00
|
|
|
clean clean_list debug gdb-config show_path \
|
2020-04-17 07:50:58 +00:00
|
|
|
program teensy dfu dfu-ee dfu-start \
|
2019-08-20 22:39:24 +00:00
|
|
|
flash dfu-split-left dfu-split-right \
|
|
|
|
avrdude-split-left avrdude-split-right \
|
|
|
|
avrdude-loop usbasp
|