aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarel Kočí <cynerd@email.cz>2017-03-09 07:33:52 +0100
committerKarel Kočí <cynerd@email.cz>2017-03-09 07:33:52 +0100
commite5e698b5036ce68073bd1897e3547493ece72a53 (patch)
treed9c8e45daf31a77d5f0966ffeceb072ae12fdfeb
parentdfc471c4f68eba0c054e61dbb3567ee89e3a036f (diff)
downloadavr-ioe-e5e698b5036ce68073bd1897e3547493ece72a53.tar.gz
avr-ioe-e5e698b5036ce68073bd1897e3547493ece72a53.tar.bz2
avr-ioe-e5e698b5036ce68073bd1897e3547493ece72a53.zip
Make add + to run in parallelHEADmaster
-rw-r--r--examples/examples.mk4
-rw-r--r--template/Kconfig3
-rw-r--r--template/Makefile42
-rw-r--r--tools/kconfig.mk12
4 files changed, 29 insertions, 32 deletions
diff --git a/examples/examples.mk b/examples/examples.mk
index 3d838e7..a108bf0 100644
--- a/examples/examples.mk
+++ b/examples/examples.mk
@@ -43,7 +43,7 @@ clean:
$(Q)$(RM) $(OBJ)
@echo " CLEAN $(EXAMPLE_NAME).elf $(EXAMPLE_NAME).hex"
$(Q)$(RM) $(EXAMPLE_NAME).elf $(EXAMPLE_NAME).hex
- $(Q)$(MAKE) -C "$(IOEROOT)" clean O=examples/$(EXAMPLE_PATH)
+ $(Q)+$(MAKE) -C "$(IOEROOT)" clean O=examples/$(EXAMPLE_PATH)
# Building targets are available only if configuration is generated
ifneq ("$(wildcard $(CONFIG))","")
@@ -69,7 +69,7 @@ $(OBJ): %.o: %.c libioe.a
$(Q)$(CC) $(CFLAGS) -c -o $@ $<
libioe.a: $(CONFIG)
- $(Q)$(MAKE) -C "$(IOEROOT)" examples/$(EXAMPLE_PATH)/libioe.a O=examples/$(EXAMPLE_PATH)
+ $(Q)+$(MAKE) -C "$(IOEROOT)" examples/$(EXAMPLE_PATH)/libioe.a O=examples/$(EXAMPLE_PATH)
endif
TOOL_PATH="$(IOEROOT)/tools"
diff --git a/template/Kconfig b/template/Kconfig
new file mode 100644
index 0000000..37410ea
--- /dev/null
+++ b/template/Kconfig
@@ -0,0 +1,3 @@
+mainmenu "AVR-IOE template"
+
+source "avr-ioe/ioe.Kconfig"
diff --git a/template/Makefile b/template/Makefile
index 0661d7b..9add29f 100644
--- a/template/Makefile
+++ b/template/Makefile
@@ -9,12 +9,15 @@ SRC = main.c
OBJ = $(patsubst %.c,%.o,$(SRC)) # This creates list of *.o files from *.c
Q ?= @ # This can be overwritten to show commands
+IOEROOT = avr-ioe
+CONFIG = ioeconfig
+
.PHONY: all
-ifneq ("$(wildcard ioeconfig)","") # Checking if configuration exists
+ifneq ("$(wildcard $(CONFIG))","") # Checking if configuration exists
all: $(PROJNAME).hex
@echo Now you can flash $< to your chip.
else
-all: help .config
+all: $(CONFIG)
endif
# Edit here help like you ever want
@@ -33,47 +36,38 @@ clean:
$(Q)$(RM) $(OBJ)
@echo " CLEAN $(PROJNAME).elf $(PROJNAME).hex"
$(Q)$(RM) $(PROJNAME).elf $(PROJNAME).hex
- $(Q)$(MAKE) -C avr-ioe clean CONFIG="$$( readlink -f ioeconfig )"
+ $(Q)+$(MAKE) -C "$(IOEROOT)" clean CONFIG="$$( readlink -f $(CONFIG) )"
# Building targets are available only if configuration is generated
-ifneq ("$(wildcard ioeconfig)","")
-include ioeconfig
+ifneq ("$(wildcard $(CONFIG))","")
+include $(CONFIG)
# If you want change some standard CFLAGS, change them in configuration not here.
# Add here only options that should not be applied to avr-ioe also.
-CFLAGS = -Iavr-ioe/include -mmcu=$(MMCU) -imacros avr-ioe/build/config.h \
+CFLAGS = -I"$(IOEROOT)/include" -mmcu=$(MMCU) -imacros "$(IOEROOT)/build/config.h" \
$(shell echo $(CCFLAGS)) $(shell echo -DF_CPU=$(F_CPU)000L)
CC = $(CHOST)gcc
AR = $(CHOST)ar
CPP = $(CHOST)cpp
OBJCOPY = $(CHOST)objcopy
-$(PROJNAME).elf: avr-ioe/libioe.a
+$(PROJNAME).elf: $(IOEROOT)/libioe.a
$(PROJNAME).elf: $(OBJ)
@echo " LD $@"
- $(Q)$(CC) -Os -mmcu=$(MMCU) $^ -o $@ -Lavr-ioe -lioe
+ $(Q)$(CC) -Os -mmcu=$(MMCU) $^ -o $@ -L"$(IOEROOT)" -lioe
$(PROJNAME).hex: $(PROJNAME).elf
@echo " OBJCOPY $@"
$(Q)$(OBJCOPY) -O ihex -R .eeprom $< $@
-$(OBJ): %.o: %.c avr-ioe/build/config.h
+$(OBJ): %.o: %.c $(IOEROOT)/build/config.h
@echo " CC $@"
$(Q)$(CC) $(CFLAGS) -c -o $@ $<
-avr-ioe/libioe.a: ioeconfig
- $(Q)+$(MAKE) -C avr-ioe libioe.a CONFIG="$$( readlink -f ioeconfig )"
-avr-ioe/build/config.h: ioeconfig
- $(Q)+$(MAKE) -C avr-ioe build/config.h CONFIG="$$( readlink -f ioeconfig )"
+$(IOEROOT)/libioe.a: $(CONFIG)
+ $(Q)+$(MAKE) -C $(IOEROOT) libioe.a CONFIG="$$( readlink -f $(CONFIG) )"
+$(IOEROOT)/build/config.h: $(CONFIG)
+ $(Q)+$(MAKE) -C $(IOEROOT) build/config.h CONFIG="$$( readlink -f $(CONFIG) )"
endif
-.config:
- @echo Please generate configuration first using config or menuconfig target
- @exit 1
-
-.PHONY: config
-config:
- $(Q)$(MAKE) -C avr-ioe menuconfig CONFIG="$$( readlink -f ioeconfig )"
-
-.PHONY: menuconfig
-menuconfig:
- $(Q)$(MAKE) -C avr-ioe menuconfig CONFIG="$$( readlink -f ioeconfig )"
+TOOL_PATH="$(IOEROOT)/tools"
+include $(IOEROOT)/tools/kconfig.mk
diff --git a/tools/kconfig.mk b/tools/kconfig.mk
index c07bbfa..882ff31 100644
--- a/tools/kconfig.mk
+++ b/tools/kconfig.mk
@@ -15,12 +15,12 @@ $(CONFIG):
# So include of this file should be last line in Makefile
MAKEOVERRIDES =
-callconfig = $(Q)\
- [ ! -f "$(CONFIG)" ] || mv "$(CONFIG)" config; \
- IOEROOT="$(IOEROOT)" $(MAKE) -f "$(TOOL_PATH)/kconfig/GNUmakefile" --no-print-directory \
- TOPDIR=. SRCDIR="$(TOOL_PATH)/kconfig" $(1); \
- [ ! -f config ] || mv config "$(CONFIG)"; \
- [ ! -f config.old ] || mv config.old "$(CONFIG).old"
+define callconfig
+$(Q)[ ! -f "$(CONFIG)" ] || mv "$(CONFIG)" config
+$(Q)+$(MAKE) -f "$(TOOL_PATH)/kconfig/GNUmakefile" --no-print-directory IOEROOT="$(IOEROOT)" TOPDIR=. SRCDIR="$(TOOL_PATH)/kconfig" $(1)
+$(Q)[ ! -f config ] || mv config "$(CONFIG)"
+$(Q)[ ! -f config.old ] || mv config.old "$(CONFIG).old"
+endef
# Note about this file moving madness:
# avr-ioe is using Kconfig for configuration and it is not prepared too well for
# nested projects (at least I don't know way). This unfortunately means that to