68 lines
1.9 KiB
Plaintext
68 lines
1.9 KiB
Plaintext
# QMK for TencentOS
|
|
# @author Jimmin.huang jimmin@163.com
|
|
########################################################################
|
|
|
|
# Make rules/targets for handling user application
|
|
|
|
.SECONDARY:: ${LD_O_FILES}
|
|
|
|
include $(QTOP)/qmk/generic/Make.tpl
|
|
|
|
ifeq (,$(strip $(exec)))
|
|
exec = $(shell basename $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST)))))
|
|
endif
|
|
|
|
OUTDIR = ${BLDDIR}/out
|
|
|
|
targetexec = ${OUTDIR}/${exec}.elf
|
|
|
|
all:: ${OUTDIR}/.tree ${targetexec}
|
|
|
|
$(info $(wildcard $(BLDROOT)/%.a) )
|
|
|
|
ifeq (,$(LD_O_FILES))
|
|
LD_O_FILES = $(sort $(BOBJS))
|
|
endif
|
|
ifeq (2,$(V))
|
|
LD_INFO_OPTS := -Wl,--warn-common -Wl,--verbose
|
|
endif
|
|
ifeq (3,$(V))
|
|
LD_INFO_OPTS := -Wl,--warn-common -Wl,-Map,${OUTDIR}/${exec}.map -Wl,--verbose
|
|
endif
|
|
|
|
_LD_START_GROUP := -Wl,--start-group
|
|
_LD_END_GROUP := -Wl,--end-group
|
|
|
|
ifeq (,$(strip ${OBJCOPY}))
|
|
OBJCOPY=$(subst strip,objcopy,$(STRIP))
|
|
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 $(BLDROOT)
|
|
$(Q)$(CC) \
|
|
$(patsubst -I%,,${CFLAGS} ${EXTRA_CFLAGS} ${LDFLAGS}) \
|
|
-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 $@)).* $(BLDROOT)/
|
|
@$(ECHO) -e "[$(BP)] INFO [$(BP)] INFO \e[1;32mLINK OK,OK,OK!!!\e[m"
|
|
@$(ECHO) -e "\e[1;32m$$(/bin/ls $(BLDROOT)/$(basename $(notdir $@)).*)\e[m"
|
|
|
|
|
|
install:: all
|
|
|
|
clean::
|
|
$(Q)$(RM) ${BOBJS}
|
|
$(Q)$(RM) $(filter %.a ,$(LD_A_FILES))
|
|
$(Q)$(RM) $(OUTDIR)/$(basename $(notdir ${targetexec})).*
|
|
$(Q)$(RM) $(BLDROOT)/$(basename $(notdir ${targetexec})).*
|
|
|
|
distclean:: clean
|
|
|
|
.PHONY: $(targetexec)
|
|
|