tle.cpp-obj.mk revision fbba0a3b
1# Copyright (c) 2016 Intel Corporation.
2# Licensed under the Apache License, Version 2.0 (the "License");
3# you may not use this file except in compliance with the License.
4# You may obtain a copy of the License at:
5#
6#     http://www.apache.org/licenses/LICENSE-2.0
7#
8# Unless required by applicable law or agreed to in writing, software
9# distributed under the License is distributed on an "AS IS" BASIS,
10# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11# See the License for the specific language governing permissions and
12# limitations under the License.
13
14include $(RTE_SDK)/mk/internal/rte.compile-pre.mk
15include $(RTE_SDK)/mk/internal/rte.install-pre.mk
16include $(RTE_SDK)/mk/internal/rte.clean-pre.mk
17include $(RTE_SDK)/mk/internal/rte.build-pre.mk
18include $(TLDK_ROOT)/mk/tle.cpp-pre.mk
19
20#
21# copy of rte.obj.mk starts here
22#
23
24# VPATH contains at least SRCDIR
25VPATH += $(SRCDIR)
26
27ifneq ($(OBJ),)
28_BUILD = $(OBJ)
29else
30_BUILD = $(OBJS-y)
31endif
32_INSTALL = $(INSTALL-FILES-y) $(SYMLINK-FILES-y)
33_CLEAN = doclean
34
35.PHONY: all
36all: install
37
38.PHONY: install
39install: build _postinstall
40
41_postinstall: build
42
43.PHONY: build
44build: _postbuild
45
46ifneq ($(OBJ),)
47exe2cmd = $(strip $(call dotfile,$(patsubst %,%.cmd,$(1))))
48
49O_TO_O = $(LD) $(CPU_LDFLAGS) -r -o $(OBJ) $(OBJS-y)
50O_TO_O_STR = $(subst ','\'',$(O_TO_O)) #'# fix syntax highlight
51O_TO_O_DISP =  $(if $(V),"$(O_TO_O_STR)","  LD $(@)")
52O_TO_O_CMD = "cmd_$@ = $(O_TO_O_STR)"
53O_TO_O_DO = @set -e; \
54	echo $(O_TO_O_DISP); \
55	$(O_TO_O) && \
56	echo $(O_TO_O_CMD) > $(call exe2cmd,$(@))
57
58-include .$(OBJ).cmd
59
60#
61# Archive objects in .a file if needed
62#
63$(OBJ): $(OBJS-y) FORCE
64	@[ -d $(dir $@) ] || mkdir -p $(dir $@)
65	$(if $(D),\
66		@echo -n "$< -> $@ " ; \
67		echo -n "file_missing=$(call boolean,$(file_missing)) " ; \
68		echo -n "cmdline_changed=$(call boolean,$(call cmdline_changed,$(O_TO_O_STR))) " ; \
69		echo -n "depfile_missing=$(call boolean,$(depfile_missing)) " ; \
70		echo "depfile_newer=$(call boolean,$(depfile_newer)) ")
71	$(if $(or \
72		$(file_missing),\
73		$(call cmdline_changed,$(O_TO_O_STR)),\
74		$(depfile_missing),\
75		$(depfile_newer)),\
76		$(O_TO_O_DO))
77endif
78
79#
80# Clean all generated files
81#
82.PHONY: clean
83clean: _postclean
84
85.PHONY: doclean
86doclean:
87	@rm -rf $(OBJ) $(OBJS-all) $(DEPS-all) $(DEPSTMP-all) \
88	  $(CMDS-all) $(INSTALL-FILES-all)
89	@rm -f $(_BUILD_TARGETS) $(_INSTALL_TARGETS) $(_CLEAN_TARGETS)
90
91include $(RTE_SDK)/mk/internal/rte.compile-post.mk
92include $(RTE_SDK)/mk/internal/rte.install-post.mk
93include $(RTE_SDK)/mk/internal/rte.clean-post.mk
94include $(RTE_SDK)/mk/internal/rte.build-post.mk
95
96.PHONY: FORCE
97FORCE:
98