1 # SPDX-License-Identifier: BSD-3-Clause
2 # Copyright(c) 2010-2014 Intel Corporation
4 # tell rte.compile-pre.mk to use HOSTCC instead of CC
6 include $(RTE_SDK)/mk/internal/rte.compile-pre.mk
7 include $(RTE_SDK)/mk/internal/rte.install-pre.mk
8 include $(RTE_SDK)/mk/internal/rte.clean-pre.mk
9 include $(RTE_SDK)/mk/internal/rte.build-pre.mk
11 # VPATH contains at least SRCDIR
15 _INSTALL = $(INSTALL-FILES-y) $(SYMLINK-FILES-y) $(RTE_OUTPUT)/app/$(HOSTAPP)
22 install: build _postinstall
29 exe2cmd = $(strip $(call dotfile,$(patsubst %,%.cmd,$(1))))
31 O_TO_EXE = $(HOSTCC) $(HOST_LDFLAGS) $(LDFLAGS_$(@)) \
32 $(EXTRA_HOST_LDFLAGS) -o $@ $(OBJS-y) $(LDLIBS)
33 O_TO_EXE_STR = $(subst ','\'',$(O_TO_EXE)) #'# fix syntax highlight
34 O_TO_EXE_DISP = $(if $(V),"$(O_TO_EXE_STR)"," HOSTLD $(@)")
35 O_TO_EXE_CMD = "cmd_$@ = $(O_TO_EXE_STR)"
36 O_TO_EXE_DO = @set -e; \
37 echo $(O_TO_EXE_DISP); \
39 echo $(O_TO_EXE_CMD) > $(call exe2cmd,$(@))
41 -include .$(HOSTAPP).cmd
43 # list of .a files that are linked to this application
44 LDLIBS_FILES := $(sort $(wildcard \
45 $(addprefix $(RTE_OUTPUT)/lib/, \
46 $(patsubst -l%,lib%.a,$(filter -l%,$(LDLIBS))))))
49 # Compile executable file if needed
51 $(HOSTAPP): $(OBJS-y) $(LDLIBS_FILES) FORCE
52 @[ -d $(dir $@) ] || mkdir -p $(dir $@)
54 @echo -n "$@ -> $< " ; \
55 echo -n "file_missing=$(call boolean,$(file_missing)) " ; \
56 echo -n "cmdline_changed=$(call boolean,$(call cmdline_changed,$(O_TO_EXE_STR))) " ; \
57 echo -n "depfile_missing=$(call boolean,$(depfile_missing)) " ; \
58 echo "depfile_newer=$(call boolean,$(depfile_newer)) ")
61 $(call cmdline_changed,$(O_TO_EXE_STR)),\
67 # install app in $(RTE_OUTPUT)/hostapp
69 $(RTE_OUTPUT)/app/$(HOSTAPP): $(HOSTAPP)
70 @echo " INSTALL-HOSTAPP $(HOSTAPP)"
71 @[ -d $(RTE_OUTPUT)/app ] || mkdir -p $(RTE_OUTPUT)/app
72 $(Q)cp -f $(HOSTAPP) $(RTE_OUTPUT)/app
75 # Clean all generated files
79 $(Q)rm -f $(_BUILD_TARGETS) $(_INSTALL_TARGETS) $(_CLEAN_TARGETS)
83 $(Q)rm -rf $(HOSTAPP) $(OBJS-all) $(DEPS-all) $(DEPSTMP-all) \
84 $(CMDS-all) $(INSTALL-FILES-all) .$(HOSTAPP).cmd
87 include $(RTE_SDK)/mk/internal/rte.compile-post.mk
88 include $(RTE_SDK)/mk/internal/rte.install-post.mk
89 include $(RTE_SDK)/mk/internal/rte.clean-post.mk
90 include $(RTE_SDK)/mk/internal/rte.build-post.mk