-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makerules
157 lines (130 loc) · 4.38 KB
/
Makerules
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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
## -*- mode: Makefile -*-
##
## Copyright (c) 2011, 2012, 2013, 2014 The University of Utah
##
## 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, 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
###############################################################################
# Get rid of a bunch of nasty built-in implicit rules,
# to avoid bogus circular dependencies and make things go faster.
# Use the `-r' command line option to make to get even better performance.
.SUFFIXES: .lo .c
.SECONDARY:
#
# Various install targets.
#
$(INSTALL_BINDIR)/%: %
@echo "Installing $<"
-mkdir -p $(INSTALL_BINDIR)
$(INSTALL_PROGRAM) $< $@
$(INSTALL_SBINDIR)/%: %
@echo "Installing $<"
-mkdir -p $(INSTALL_SBINDIR)
$(INSTALL_PROGRAM) $< $@
#
# The libtool way :)
#
$(INSTALL_LIBDIR)/%.la: %.la
@echo "Installing $<"
-mkdir -p $(INSTALL_LIBDIR)
-$(LIBTOOL) --mode=install $(INSTALL_PROGRAM) $< $@
$(INSTALL_LIBDIR)/%: %
@echo "Installing $<"
-mkdir -p $(INSTALL_LIBDIR)
$(INSTALL_PROGRAM) $< $@
$(INSTALL_INCDIR)/$(TOP_SRCDIR)/%: $(TOP_SRCDIR)/%
@echo "Installing $<"
-mkdir -p $(INSTALL_INCDIR)
$(INSTALL_DATA) $< $(INSTALL_INCDIR)
$(INSTALL_INCDIR)/%: %
@echo "Installing $<"
-mkdir -p $(INSTALL_INCDIR)
$(INSTALL_DATA) $< $@
$(INSTALL_LIBEXECDIR)/%: %
@echo "Installing $<"
-mkdir -p $(INSTALL_LIBEXECDIR)
$(INSTALL_PROGRAM) $< $@
$(INSTALL_ETCDIR)/%: %
@echo "Installing $<"
-mkdir -p $(INSTALL_ETCDIR)
$(INSTALL_DATA) $< $@
$(INSTALL_SHAREDIR)/%: %
@echo "Installing $<"
-mkdir -p $(INSTALL_SHAREDIR)
$(INSTALL_DATA) $< $@
$(INSTALL_PCDIR)/%: %
@echo "Installing $<"
-mkdir -p $(INSTALL_PCDIR)
$(INSTALL_DATA) $< $@
$(addprefix $(INSTALL_SBINDIR)/, $(INST_SBIN_SETUID)): $(INSTALL_SBINDIR)/%: %
echo "Installing (setuid) $<"
-mkdir -p $(INSTALL_SBINDIR)
$(SUDO) $(INSTALL) -o root -m 4755 $< $@
$(addprefix $(INSTALL_BINDIR)/, $(INST_BIN_SETUID)): $(INSTALL_BINDIR)/%: %
echo "Installing (setuid) $<"
-mkdir -p $(INSTALL_BINDIR)
$(SUDO) $(INSTALL) -o root -m 4755 $< $@
$(addprefix $(INSTALL_LIBEXECDIR)/, $(INST_LIBEXEC_SETUID)): $(INSTALL_LIBEXECDIR)/%: %
echo "Installing (setuid) $<"
-mkdir -p $(INSTALL_LIBEXECDIR)
$(SUDO) $(INSTALL) -o root -m 4755 $< $@
#
# Install stuff by just setting variables in Makefiles that include this guy.
#
.PHONY: def-install
def-install: $(addprefix $(INSTALL_BINDIR)/, $(INST_BIN)) \
$(addprefix $(INSTALL_SBINDIR)/, $(INST_SBIN)) \
$(addprefix $(INSTALL_INCDIR)/, $(INST_INC)) \
$(addprefix $(INSTALL_LIBDIR)/, $(INST_LIB)) \
$(addprefix $(INSTALL_LIBEXECDIR)/, $(INST_LIBEXEC)) \
$(addprefix $(INSTALL_ETCDIR)/, $(INST_ETC)) \
$(addprefix $(INSTALL_SHAREDIR)/, $(INST_SHARE)) \
$(addprefix $(INSTALL_PCDIR)/, $(INST_PC))
CFLAGS += $(LOCALCFLAGS)
#
# Where to find source files.
# Using specific patterns instead of the catch-all VPATH variable
# avoids hitting miscellaneous wrong targets in other directories
# when configuring in the source directory.
#
vpath %.in $(SRCDIR) $(MOSTLY_SRCDIRS)
vpath %.c $(SRCDIR) $(MOSTLY_SRCDIRS)
vpath %.h $(SRCDIR) $(MOSTLY_SRCDIRS)
vpath %.cc $(SRCDIR) $(MOSTLY_SRCDIRS)
vpath %.C $(SRCDIR) $(MOSTLY_SRCDIRS)
vpath % $(SRCDIR) $(MOSTLY_SRCDIRS)
#
# Define rules which we blew away with .SUFFIXES
#
%.o: %.c
$(CC) -c -o $@ $(CFLAGS) -MD -MP -MF ${@:.o=.d} $<
%.o: %.cc
$(CXX) -c -o $@ $(CXXFLAGS) $<
%.o: %.cpp
$(CXX) -c -o $@ $(CXXFLAGS) $<
%.o: %.C
$(CXX) -c -o $@ $(CXXFLAGS) $<
.c.lo: $(HEADERS)
$(LIBTOOL) --tag=CC --mode=compile ${CC} ${CFLAGS} \
-MD -MP -MT $@ -MF ${@:.lo=.d} -c $<
%: %-debug
$(STRIP) -o $@$(EXE) $<$(EXE)
%-version.c:
echo >$@ "char build_info[] = \"Built on `date` by `id -nu`@`hostname | sed 's/\..*//'`:`pwd`\";"
#
# Rules to regen configure written files.
#
%: %.in $(OBJDIR)/config.status
@echo "Regenerating $@"
cd $(OBJDIR) && CONFIG_FILES=$(SUBDIR)/$@ ./config.status