-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathheaders.mk
More file actions
74 lines (54 loc) · 2.48 KB
/
headers.mk
File metadata and controls
74 lines (54 loc) · 2.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# Copyright 2015 Andrew Gottemoller.
#
# This software is a copyrighted work licensed under the terms of the
# Weld license. Please consult the file "WELD_LICENSE" for
# details.
# This makefile defines the set of rules for a header list
# This makefile is included for each component definition so clear out
# any variables used by this makefile
def_header_path :=
def_header_output_path :=
header_file :=
header_name :=
def_header_file :=
header_alias :=
dest_path :=
header_goal_list :=
# Figure out the include path for this component definition
def_header_path := $(def_path)/$(def_include_subdir)
def_header_output_path := $(header_output_path)/$(name)
define header_file_rule
$$(call debug_info,header specified: $(1))
header_file := $(1)
header_name := $$(notdir $$(header_file))
def_header_file := $$(def_header_path)/$$(header_file)
header_alias := $$(name)/$$(header_name)
header_goal_list := $$(header_alias) $$(header_goal_list)
directory_list := $$(dest_path) $$(directory_list)
# Define an alias for the header file so the user can do
# "make name/header.h" on the command line
vpath $$(header_alias) $$(header_output_path)
# Set the target specific variables and dependencies for this header
$$(header_alias) : header_path := $$(header_path)
$$(header_alias) : def_header_file := $$(def_header_file)
$$(header_alias) : header_alias := $$(header_alias)
$$(header_alias) : $$(def_deps)
$$(header_alias) : $$(def_header_file)
endef
# Expand the header file rule for each header specified
$(foreach file,$(header_list),$(eval $(call header_file_rule,$(file))))
# Add the output header directory to the list of directories we need to build
directory_list := $(def_header_output_path) $(directory_list)
# Add the list of header goals as a dependency of the component definition's
# headers target
$(name)_def_headers : $(header_goal_list)
# Define the actual recipe for a header
$(header_goal_list) : | $(def_header_output_path)
$(call print_progress,$(header_alias))
$(call soft_copy,$(def_header_file),$(header_output_path)/$(header_alias))
.PHONY : clean_$(name)_def_headers
clean_$(name)_def_headers : header_output_path := $(header_output_path)
clean_$(name)_def_headers : header_goal_list := $(header_goal_list)
clean_$(name)_def_headers :
$(call print_progress,$@)
$(call remove_files,$(addprefix $(header_output_path)/,$(header_goal_list)))