2 # Generic leaf rules include Makefile.
4 # Copyright (C) 2009, Cisco Systems Inc.
6 # This program is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 2 of the License, or
9 # (at your option) any later version.
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License along
17 # with this program; if not, write to the Free Software Foundation, Inc.,
18 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20 # Garrett Cooper, July 2009
26 # Generate a set of basic targets (all, clean, install) for a leaf directory
27 # (no subdirectories).
29 # $(MAKE_DEPS) : What should we execute beforehand as a
30 # dependency of $(MAKE_TARGETS)?
32 # $(INSTALL_FILES) -> install
34 # Helpful variables are:
36 # $(MAKE_TARGETS) : What to execute as direct dependencies of
38 # 1. Defaults to the basename of the targets
39 # produced by the %.c -> % implicit pattern
40 # rules, e.g. the MAKE_TARGET in a directory
46 # Would be `foo'. Similarly, the following
52 # Would be `foo zanzibar'.
54 # 2. If you define MAKE_TARGETS as an empty
55 # string, this will override the defaults.
56 # I did this to avoid providing too much
57 # rope to hang one's self in the event of
60 # $(CLEAN_TARGETS) : What targets should be cleaned (must be
61 # real files). This will automatically append
62 # adds the .o suffix to all files referenced
63 # by $(MAKE_TARGETS)) to CLEAN_TARGETS, if
64 # MAKE_TARGETS wasn't defined (see
66 # $(INSTALL_MODE) : What mode should we using when calling
69 # Also, if you wish to change the installation directory, from the set default
70 # (testcases/bin) you must do something like either one of the following items:
74 # INSTALL_DIR := /path/to/installdir/from/$(DESTDIR)/$(prefix)
76 # e.g. if I wanted to install my binaries in testcases/bin, I would do:
78 # INSTALL_DIR := testcases/bin
80 # in my calling Makefile.
84 # INSTALL_DIR := /path/to/installdir/from/$(DESTDIR)
86 # e.g. if I wanted to install my binaries in $(libdir) (which may not exist
87 # outside of $(prefix) right now, but could in the future), I could do the
90 # INSTALL_DIR := $(libdir)
93 .PHONY: all clean install
95 $(MAKE_TARGETS): | $(MAKE_DEPS)
100 -$(RM) -f $(CLEAN_TARGETS)
102 $(INSTALL_FILES): | $(INSTALL_DEPS)
104 install: $(INSTALL_FILES)