crypto/ccp: support device init
[dpdk.git] / mk / rte.obj.mk
1 # SPDX-License-Identifier: BSD-3-Clause
2 # Copyright(c) 2010-2014 Intel Corporation
3
4 include $(RTE_SDK)/mk/internal/rte.compile-pre.mk
5 include $(RTE_SDK)/mk/internal/rte.install-pre.mk
6 include $(RTE_SDK)/mk/internal/rte.clean-pre.mk
7 include $(RTE_SDK)/mk/internal/rte.build-pre.mk
8
9 # VPATH contains at least SRCDIR
10 VPATH += $(SRCDIR)
11
12 ifneq ($(OBJ),)
13 _BUILD = $(OBJ)
14 else
15 _BUILD = $(OBJS-y)
16 endif
17 _INSTALL = $(INSTALL-FILES-y) $(SYMLINK-FILES-y)
18 _CLEAN = doclean
19
20 .PHONY: all
21 all: install
22
23 .PHONY: install
24 install: build _postinstall
25
26 _postinstall: build
27
28 .PHONY: build
29 build: _postbuild
30
31 ifneq ($(OBJ),)
32 exe2cmd = $(strip $(call dotfile,$(patsubst %,%.cmd,$(1))))
33
34 O_TO_O = $(LD) -r -o $(OBJ) $(OBJS-y)
35 O_TO_O_STR = $(subst ','\'',$(O_TO_O)) #'# fix syntax highlight
36 O_TO_O_DISP =  $(if $(V),"$(O_TO_O_STR)","  LD $(@)")
37 O_TO_O_CMD = "cmd_$@ = $(O_TO_O_STR)"
38 O_TO_O_DO = @set -e; \
39         echo $(O_TO_O_DISP); \
40         $(O_TO_O) && \
41         echo $(O_TO_O_CMD) > $(call exe2cmd,$(@))
42
43 -include .$(OBJ).cmd
44
45 #
46 # Archive objects in .a file if needed
47 #
48 $(OBJ): $(OBJS-y) FORCE
49         @[ -d $(dir $@) ] || mkdir -p $(dir $@)
50         $(if $(D),\
51                 @echo -n "$< -> $@ " ; \
52                 echo -n "file_missing=$(call boolean,$(file_missing)) " ; \
53                 echo -n "cmdline_changed=$(call boolean,$(call cmdline_changed,$(O_TO_O_STR))) " ; \
54                 echo -n "depfile_missing=$(call boolean,$(depfile_missing)) " ; \
55                 echo "depfile_newer=$(call boolean,$(depfile_newer)) ")
56         $(if $(or \
57                 $(file_missing),\
58                 $(call cmdline_changed,$(O_TO_O_STR)),\
59                 $(depfile_missing),\
60                 $(depfile_newer)),\
61                 $(O_TO_O_DO))
62 endif
63
64 #
65 # Clean all generated files
66 #
67 .PHONY: clean
68 clean: _postclean
69
70 .PHONY: doclean
71 doclean:
72         @rm -rf $(OBJ) $(OBJS-all) $(DEPS-all) $(DEPSTMP-all) \
73           $(CMDS-all) $(INSTALL-FILES-all)
74         @rm -f $(_BUILD_TARGETS) $(_INSTALL_TARGETS) $(_CLEAN_TARGETS)
75
76 include $(RTE_SDK)/mk/internal/rte.compile-post.mk
77 include $(RTE_SDK)/mk/internal/rte.install-post.mk
78 include $(RTE_SDK)/mk/internal/rte.clean-post.mk
79 include $(RTE_SDK)/mk/internal/rte.build-post.mk
80
81 .PHONY: FORCE
82 FORCE: