tle.cpp-obj.mk revision 5d0ab6ce
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 $(RTE_SDK)/mk/internal/rte.depdirs-pre.mk
19include $(TLDK_ROOT)/mk/tle.cpp-pre.mk
20
21#
22# copy of rte.obj.mk starts here
23#
24
25# VPATH contains at least SRCDIR
26VPATH += $(SRCDIR)
27
28ifneq ($(OBJ),)
29_BUILD = $(OBJ)
30else
31_BUILD = $(OBJS-y)
32endif
33_INSTALL = $(INSTALL-FILES-y) $(SYMLINK-FILES-y)
34_CLEAN = doclean
35
36.PHONY: all
37all: install
38
39.PHONY: install
40install: build _postinstall
41
42_postinstall: build
43
44.PHONY: build
45build: _postbuild
46
47ifneq ($(OBJ),)
48exe2cmd = $(strip $(call dotfile,$(patsubst %,%.cmd,$(1))))
49
50O_TO_O = $(LD) $(CPU_LDFLAGS) -r -o $(OBJ) $(OBJS-y)
51O_TO_O_STR = $(subst ','\'',$(O_TO_O)) #'# fix syntax highlight
52O_TO_O_DISP =  $(if $(V),"$(O_TO_O_STR)","  LD $(@)")
53O_TO_O_CMD = "cmd_$@ = $(O_TO_O_STR)"
54O_TO_O_DO = @set -e; \
55	echo $(O_TO_O_DISP); \
56	$(O_TO_O) && \
57	echo $(O_TO_O_CMD) > $(call exe2cmd,$(@))
58
59-include .$(OBJ).cmd
60
61#
62# Archive objects in .a file if needed
63#
64$(OBJ): $(OBJS-y) FORCE
65	@[ -d $(dir $@) ] || mkdir -p $(dir $@)
66	$(if $(D),\
67		@echo -n "$< -> $@ " ; \
68		echo -n "file_missing=$(call boolean,$(file_missing)) " ; \
69		echo -n "cmdline_changed=$(call boolean,$(call cmdline_changed,$(O_TO_O_STR))) " ; \
70		echo -n "depfile_missing=$(call boolean,$(depfile_missing)) " ; \
71		echo "depfile_newer=$(call boolean,$(depfile_newer)) ")
72	$(if $(or \
73		$(file_missing),\
74		$(call cmdline_changed,$(O_TO_O_STR)),\
75		$(depfile_missing),\
76		$(depfile_newer)),\
77		$(O_TO_O_DO))
78endif
79
80#
81# Clean all generated files
82#
83.PHONY: clean
84clean: _postclean
85
86.PHONY: doclean
87doclean:
88	@rm -rf $(OBJ) $(OBJS-all) $(DEPS-all) $(DEPSTMP-all) \
89	  $(CMDS-all) $(INSTALL-FILES-all)
90	@rm -f $(_BUILD_TARGETS) $(_INSTALL_TARGETS) $(_CLEAN_TARGETS)
91
92include $(RTE_SDK)/mk/internal/rte.compile-post.mk
93include $(RTE_SDK)/mk/internal/rte.install-post.mk
94include $(RTE_SDK)/mk/internal/rte.clean-post.mk
95include $(RTE_SDK)/mk/internal/rte.build-post.mk
96include $(RTE_SDK)/mk/internal/rte.depdirs-post.mk
97
98.PHONY: FORCE
99FORCE:
100