mirror of https://github.com/Desuuuu/klipper.git
build: Rename makefile CFLAGS-y to CFLAGS and LDFLAGS-y to CFLAGS_klipper.elf
Rename some makefile variables. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
parent
33dfc386c9
commit
450c14b286
16
Makefile
16
Makefile
|
@ -1,6 +1,6 @@
|
|||
# Klipper build system
|
||||
#
|
||||
# Copyright (C) 2016 Kevin O'Connor <kevin@koconnor.net>
|
||||
# Copyright (C) 2016,2017 Kevin O'Connor <kevin@koconnor.net>
|
||||
#
|
||||
# This file may be distributed under the terms of the GNU GPLv3 license.
|
||||
|
||||
|
@ -32,18 +32,16 @@ dirs-y = src
|
|||
cc-option=$(shell if test -z "`$(1) $(2) -S -o /dev/null -xc /dev/null 2>&1`" \
|
||||
; then echo "$(2)"; else echo "$(3)"; fi ;)
|
||||
|
||||
CFLAGS-y := -I$(OUT) -Isrc -I$(OUT)board-generic/ -O2 -MD -g \
|
||||
CFLAGS := -I$(OUT) -Isrc -I$(OUT)board-generic/ -O2 -MD -g \
|
||||
-Wall -Wold-style-definition $(call cc-option,$(CC),-Wtype-limits,) \
|
||||
-ffunction-sections -fdata-sections
|
||||
CFLAGS-y += -flto -fwhole-program -fno-use-linker-plugin
|
||||
CFLAGS += -flto -fwhole-program -fno-use-linker-plugin
|
||||
|
||||
LDFLAGS-y := -Wl,--gc-sections -fno-whole-program
|
||||
CFLAGS_klipper.o = $(CFLAGS) -Wl,-r -nostdlib
|
||||
CFLAGS_klipper.elf = $(CFLAGS) -Wl,--gc-sections -fno-whole-program
|
||||
|
||||
CPPFLAGS = -I$(OUT) -P -MD -MT $@
|
||||
|
||||
CFLAGS = $(CFLAGS-y)
|
||||
LDFLAGS = $(LDFLAGS-y)
|
||||
|
||||
# Default targets
|
||||
target-y := $(OUT)klipper.elf
|
||||
|
||||
|
@ -83,7 +81,7 @@ $(OUT)declfunc.lds: src/declfunc.lds.S
|
|||
|
||||
$(OUT)klipper.o: $(patsubst %.c, $(OUT)src/%.o,$(src-y)) $(OUT)declfunc.lds
|
||||
@echo " Linking $@"
|
||||
$(Q)$(CC) $(CFLAGS) $(CFLAGS_klipper.o) -Wl,-r -Wl,-T,$(OUT)declfunc.lds -nostdlib $(patsubst %.c, $(OUT)src/%.o,$(src-y)) -o $@
|
||||
$(Q)$(CC) $(CFLAGS_klipper.o) -Wl,-T,$(OUT)declfunc.lds $(patsubst %.c, $(OUT)src/%.o,$(src-y)) -o $@
|
||||
|
||||
$(OUT)compile_time_request.o: $(OUT)klipper.o ./scripts/buildcommands.py
|
||||
@echo " Building $@"
|
||||
|
@ -93,7 +91,7 @@ $(OUT)compile_time_request.o: $(OUT)klipper.o ./scripts/buildcommands.py
|
|||
|
||||
$(OUT)klipper.elf: $(OUT)klipper.o $(OUT)compile_time_request.o
|
||||
@echo " Linking $@"
|
||||
$(Q)$(CC) $(CFLAGS) $(LDFLAGS) $^ -o $@
|
||||
$(Q)$(CC) $(CFLAGS_klipper.elf) $^ -o $@
|
||||
|
||||
################ Kconfig rules
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ CROSS_PREFIX=avr-
|
|||
|
||||
dirs-y += src/avr lib/pjrc_usb_serial
|
||||
|
||||
CFLAGS-y += -mmcu=$(CONFIG_MCU)
|
||||
CFLAGS += -mmcu=$(CONFIG_MCU)
|
||||
|
||||
# Add avr source files
|
||||
src-y += avr/main.c avr/timer.c avr/gpio.c
|
||||
|
@ -14,7 +14,7 @@ src-$(CONFIG_AVR_USBSERIAL) += avr/usbserial.c ../lib/pjrc_usb_serial/usb_serial
|
|||
src-$(CONFIG_AVR_SERIAL) += avr/serial.c
|
||||
|
||||
# Suppress broken "misspelled signal handler" warnings on gcc 4.8.1
|
||||
CFLAGS_klipper.o := $(if $(filter 4.8.1, $(shell $(CC) -dumpversion)), -w)
|
||||
CFLAGS_klipper.o := $(CFLAGS_klipper.o) $(if $(filter 4.8.1, $(shell $(CC) -dumpversion)), -w)
|
||||
|
||||
# Build the additional hex output file
|
||||
target-y += $(OUT)klipper.elf.hex
|
||||
|
|
|
@ -6,13 +6,13 @@ CROSS_PREFIX=arm-none-eabi-
|
|||
dirs-y += src/sam3x8e src/generic
|
||||
dirs-y += lib/cmsis-sam3x8e/source lib/cmsis-sam3x8e/source/gcc
|
||||
|
||||
CFLAGS-y += -mthumb -mcpu=cortex-m3
|
||||
CFLAGS-y += -Ilib/cmsis-sam3x8e/include -Ilib/cmsis-sam3x8e/cmsis-include
|
||||
CFLAGS-y += -D__SAM3X8E__
|
||||
CFLAGS += -mthumb -mcpu=cortex-m3
|
||||
CFLAGS += -Ilib/cmsis-sam3x8e/include -Ilib/cmsis-sam3x8e/cmsis-include
|
||||
CFLAGS += -D__SAM3X8E__
|
||||
|
||||
LDFLAGS-y += -Llib/cmsis-sam3x8e/source/gcc
|
||||
LDFLAGS-y += -T lib/cmsis-sam3x8e/source/gcc/sam3x8e_flash.ld
|
||||
LDFLAGS-y += --specs=nano.specs --specs=nosys.specs
|
||||
CFLAGS_klipper.elf += -Llib/cmsis-sam3x8e/source/gcc
|
||||
CFLAGS_klipper.elf += -T lib/cmsis-sam3x8e/source/gcc/sam3x8e_flash.ld
|
||||
CFLAGS_klipper.elf += --specs=nano.specs --specs=nosys.specs
|
||||
|
||||
# Add source files
|
||||
src-y += sam3x8e/main.c sam3x8e/timer.c sam3x8e/gpio.c
|
||||
|
|
Loading…
Reference in New Issue