qmk build system

This commit is contained in:
Jimmy
2020-07-16 15:13:03 +08:00
parent d895c15e4f
commit a2ec961500
3 changed files with 139 additions and 96 deletions

View File

@@ -18,7 +18,7 @@ targetexec = ${OUTDIR}/${exec}.elf
all:: ${OUTDIR}/.tree ${targetexec}
$(info $(wildcard $(LIBDIR)/%.a) )
$(info $(wildcard $(BLDROOT)/%.a) )
ifeq (,$(LD_O_FILES))
LD_O_FILES = $(sort $(BOBJS))
@@ -40,17 +40,17 @@ endif
$(targetexec): $(OUTDIR)/.tree ${LD_O_FILES}
@/bin/rm -f $@ # Prevent core dump if currently running
@$(ECHO) "[$(BP)] LINK $@" # This is needed for error parsing
$(Q)/bin/ls $(LIBDIR)
$(Q)/bin/ls $(BLDROOT)
$(Q)$(CC) \
$(patsubst -I%,,${CFLAGS} ${EXTRA_CFLAGS} ${LDFLAGS}) \
-o $@ -L${LIBDIR} \
-o $@ -L${BLDROOT} \
$(_LD_START_GROUP) $(LD_O_FILES) $(LD_A_FILES) $(_LD_END_GROUP) $(LD_L_LISTS) $(LD_INFO_OPTS)
$(Q)$(STRIP) --strip-debug $@ -o $(OUTDIR)/$(basename $(notdir $@)).strip
$(Q)$(OBJCOPY) -O binary -S $@ $(OUTDIR)/$(basename $(notdir $@)).bin
$(Q)$(OBJCOPY) -O ihex $@ $(OUTDIR)/$(basename $(notdir $@)).hex
$(CP) $(OUTDIR)/$(basename $(notdir $@)).* $(LIBDIR)/
$(CP) $(OUTDIR)/$(basename $(notdir $@)).* $(BLDROOT)/
@$(ECHO) -e "[$(BP)] INFO [$(BP)] INFO \e[1;32mLINK OK,OK,OK!!!\e[m"
@$(ECHO) -e "\e[1;32m$$(/bin/ls $(LIBDIR)/$(basename $(notdir $@)).*)\e[m"
@$(ECHO) -e "\e[1;32m$$(/bin/ls $(BLDROOT)/$(basename $(notdir $@)).*)\e[m"
install:: all
@@ -59,7 +59,7 @@ clean::
$(Q)$(RM) ${BOBJS}
$(Q)$(RM) $(filter %.a ,$(LD_A_FILES))
$(Q)$(RM) $(OUTDIR)/$(basename $(notdir ${targetexec})).*
$(Q)$(RM) $(LIBDIR)/$(basename $(notdir ${targetexec})).*
$(Q)$(RM) $(BLDROOT)/$(basename $(notdir ${targetexec})).*
distclean:: clean

View File

@@ -8,10 +8,10 @@
ifndef lib
lib = lib$(shell basename ${LOCALDIR})
endif
targetlib = ${LIBDIR}/${lib}.a
targetlib = ${BLDROOT}/${lib}.a
${LIBDIR}/%.a: ${BOBJS}
${BLDROOT}/%.a: ${BOBJS}
ifeq (@,$(Q))
@$(ECHO) "[$(BP)] ARLIB $(subst $(QTOP)/,,$@)"
endif