Add qtproejct target to Makefile which generates a usable qtcreator project folder
This commit is contained in:
parent
af04da6eca
commit
7553cfa310
@ -5,7 +5,7 @@
|
|||||||
#Add Files and Folders below#########################################################
|
#Add Files and Folders below#########################################################
|
||||||
CFILES = main.c syscalls.c setup/system_stm32f4xx.c systick.c
|
CFILES = main.c syscalls.c setup/system_stm32f4xx.c systick.c
|
||||||
ASFILES = boot/startup_stm32f4xx.S
|
ASFILES = boot/startup_stm32f4xx.S
|
||||||
INCLUDEPATH = -Icmsis -Iinclude
|
INCLUDEPATH = -Iinclude
|
||||||
|
|
||||||
OBJDIR = obj
|
OBJDIR = obj
|
||||||
target = reflow-controller
|
target = reflow-controller
|
||||||
@ -75,6 +75,8 @@ CFLAGS += -Wall -Wextra -Wold-style-declaration -Wuninitialized -Wmaybe-uninitia
|
|||||||
OBJ = $(CFILES:%.c=$(OBJDIR)/%.c.o)
|
OBJ = $(CFILES:%.c=$(OBJDIR)/%.c.o)
|
||||||
ASOBJ += $(ASFILES:%.S=$(OBJDIR)/%.S.o)
|
ASOBJ += $(ASFILES:%.S=$(OBJDIR)/%.S.o)
|
||||||
|
|
||||||
|
all: default
|
||||||
|
|
||||||
default: $(target).elf
|
default: $(target).elf
|
||||||
|
|
||||||
%.bin: %.elf
|
%.bin: %.elf
|
||||||
@ -102,7 +104,7 @@ $(ASOBJ):
|
|||||||
$(QUIET)$(CC) $(CFLAGS) -MMD -MT $@ $(INCLUDEPATH) $(DEFINES) -o $@ $(@:$(OBJDIR)/%.S.o=%.S)
|
$(QUIET)$(CC) $(CFLAGS) -MMD -MT $@ $(INCLUDEPATH) $(DEFINES) -o $@ $(@:$(OBJDIR)/%.S.o=%.S)
|
||||||
|
|
||||||
|
|
||||||
.PHONY: qtproject clean mrproper objcopy disassemble program
|
.PHONY: qtproject-legacy qtproject clean mrproper objcopy disassemble program
|
||||||
|
|
||||||
program: $(target).elf
|
program: $(target).elf
|
||||||
./program-device.sh $<
|
./program-device.sh $<
|
||||||
@ -118,7 +120,9 @@ mrproper: clean
|
|||||||
clean:
|
clean:
|
||||||
@echo "Cleaning up derived files..."
|
@echo "Cleaning up derived files..."
|
||||||
$(QUIET)rm -f $(target).elf $(target).bin $(target).hex $(OBJ) $(ASOBJ) $(mapfile).map $(CFILES:%.c=$(OBJDIR)/%.c.d) $(ASFILES:%.S=$(OBJDIR)/%.S.d)
|
$(QUIET)rm -f $(target).elf $(target).bin $(target).hex $(OBJ) $(ASOBJ) $(mapfile).map $(CFILES:%.c=$(OBJDIR)/%.c.d) $(ASFILES:%.S=$(OBJDIR)/%.S.d)
|
||||||
qtproject:
|
$(QUIET)rm -rf $(OBJDIR)/*
|
||||||
|
|
||||||
|
qtproject-legacy:
|
||||||
echo -e "TEMPLATE = app\nCONFIG -= console app_bundle qt" > $(target).pro
|
echo -e "TEMPLATE = app\nCONFIG -= console app_bundle qt" > $(target).pro
|
||||||
echo -e "SOURCES += $(CFILES) $(ASFILES)" >> $(target).pro
|
echo -e "SOURCES += $(CFILES) $(ASFILES)" >> $(target).pro
|
||||||
echo -ne "INCLUDEPATH += " >> $(target).pro
|
echo -ne "INCLUDEPATH += " >> $(target).pro
|
||||||
@ -128,4 +132,22 @@ qtproject:
|
|||||||
echo -ne "\nDEFINES += " >> $(target).pro
|
echo -ne "\nDEFINES += " >> $(target).pro
|
||||||
echo "$(DEFINES)" | sed "s/-D//g" >> $(target).pro
|
echo "$(DEFINES)" | sed "s/-D//g" >> $(target).pro
|
||||||
|
|
||||||
|
qtproject:
|
||||||
|
$(QUIET)rm -f $(target).files $(target).cflags $(target).config $(target).creator $(target).includes $(target).creator.user
|
||||||
|
echo "Generating source file list"
|
||||||
|
$(QUIET)echo "$(CFILES)" | tr ' ' '\n' > $(target).files
|
||||||
|
@echo -n "Appending found header files from folders "
|
||||||
|
@echo `echo $(INCLUDEPATH) | sed "s/-I//g"`
|
||||||
|
$(QUIET)for dir in `echo $(INCLUDEPATH) | sed "s/-I//g"`; do \
|
||||||
|
find `echo "$${dir}"` -name "*.h" >> $(target).files; \
|
||||||
|
done
|
||||||
|
@echo "Generating CFLAGS File"
|
||||||
|
$(QUIET)echo "" > $(target).cflags
|
||||||
|
@echo "Generating includes files"
|
||||||
|
$(QUIET)echo $(INCLUDEPATH) | sed "s/-I/,/g" | tr , '\n' | sed "/^$$/d" > $(target).includes;
|
||||||
|
@echo "Generating config file"
|
||||||
|
$(QUIET)echo $(DEFINES) | sed "s/-D/,#define /g" | tr , '\n' | sed "/^$$/d" > $(target).config
|
||||||
|
@echo "Generating creator file"
|
||||||
|
$(QUIET)echo "[GENERAL]" > $(target).creator
|
||||||
|
|
||||||
-include $(CFILES:%.c=$(OBJDIR)/%.c.d) $(ASFILES:%.S=$(OBJDIR)/%.S.d)
|
-include $(CFILES:%.c=$(OBJDIR)/%.c.d) $(ASFILES:%.S=$(OBJDIR)/%.S.d)
|
||||||
|
Loading…
Reference in New Issue
Block a user