summaryrefslogtreecommitdiff
path: root/ltp_framework/include/mk/generic_leaf_target.inc
blob: a88586fd22a3ab01e19e0d02649f7815631785fc (plain)
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
#
#    Generic leaf rules include Makefile.
#
#    Copyright (C) 2009, Cisco Systems Inc.
#
#    This program is free software; you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation; either version 2 of the License, or
#    (at your option) any later version.
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License along
#    with this program; if not, write to the Free Software Foundation, Inc.,
#    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Garrett Cooper, July 2009
#

#
# generic_leaf_target
#
# Generate a set of basic targets (all, clean, install) for a leaf directory
# (no subdirectories).
#
# $(MAKE_DEPS)			: What should we execute beforehand as a
#				  dependency of $(MAKE_TARGETS)?
#
# $(INSTALL_FILES) -> install
#
# Helpful variables are:
#
# $(MAKE_TARGETS)		: What to execute as direct dependencies of
# 				  all.
# 				  1. Defaults to the basename of the targets
# 				     produced by the %.c -> % implicit pattern
# 				     rules, e.g. the MAKE_TARGET in a directory
# 				     like the following:
#
#				  $$ ls /bar
# 				  foo.c
#
#				     Would be `foo'. Similarly, the following
#				     dir structure:
#
#				  $$ ls /bar
# 				  foo.c zanzibar.c
#
#				     Would be `foo zanzibar'.
#
#				  2. If you define MAKE_TARGETS as an empty
#				     string, this will override the defaults.
#				     I did this to avoid providing too much
#				     rope to hang one's self in the event of
#				     unwanted behavior.
#
# $(CLEAN_TARGETS)		: What targets should be cleaned (must be
#				  real files). This will automatically append
#				  adds the .o suffix to all files referenced
#				  by $(MAKE_TARGETS)) to CLEAN_TARGETS, if
#				  MAKE_TARGETS wasn't defined (see
#				  $(MAKE_TARGETS)).
# $(INSTALL_MODE)		: What mode should we using when calling
# 				  install(1)?
#
# Also, if you wish to change the installation directory, from the set default
# (testcases/bin) you must do something like either one of the following items:
#
# Method A:
#
# INSTALL_DIR			:= /path/to/installdir/from/$(DESTDIR)/$(prefix)
#
# e.g. if I wanted to install my binaries in testcases/bin, I would do:
#
# INSTALL_DIR			:= testcases/bin
#
# in my calling Makefile.
#
# Or Method B:
#
# INSTALL_DIR			:= /path/to/installdir/from/$(DESTDIR)
#
# e.g. if I wanted to install my binaries in $(libdir) (which may not exist
# outside of $(prefix) right now, but could in the future), I could do the
# following:
#
# INSTALL_DIR			:= $(libdir)
#

.PHONY: all clean install

$(MAKE_TARGETS): | $(MAKE_DEPS)

all: $(MAKE_TARGETS)

clean:: $(CLEAN_DEPS)
	-$(RM) -f $(CLEAN_TARGETS)

$(INSTALL_FILES): | $(INSTALL_DEPS)

install: $(INSTALL_FILES)

# vim: syntax=make