GNUmakerules 2.65 KB
Newer Older
1
#
2 3 4
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2006 University of Utah and the Flux Group.
# All rights reserved.
5 6 7 8 9 10 11 12 13

# 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:

#
# Various install targets.
# 
14 15 16
$(INSTALL_BINDIR)/%: %
	@echo "Installing $<"
	-mkdir -p $(INSTALL_BINDIR)
17
	$(INSTALL_PROGRAM) $< $@
18

19 20 21 22 23
$(INSTALL_SBINDIR)/%: %
	@echo "Installing $<"
	-mkdir -p $(INSTALL_SBINDIR)
	$(INSTALL_PROGRAM) $< $@

24
$(INSTALL_LIBDIR)/%: %
25
	@echo "Installing $<"
26
	-mkdir -p $(INSTALL_LIBDIR)
27
	$(INSTALL_PROGRAM) $< $@
28

29
$(INSTALL_LIBEXECDIR)/%: %
30
	@echo "Installing $<"
31
	-mkdir -p $(INSTALL_LIBEXECDIR)
32
	$(INSTALL_PROGRAM) $< $@
33

34 35 36 37 38
$(INSTALL_ETCDIR)/%: %
	@echo "Installing $<"
	-mkdir -p $(INSTALL_ETCDIR)
	$(INSTALL_DATA) $< $@

39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
$(addprefix $(INSTALL_SBINDIR)/, $(SETUID_SBIN_SCRIPTS)): $(INSTALL_SBINDIR)/%: %
	echo "Installing (setuid) $<"
	-mkdir -p $(INSTALL_SBINDIR)
	$(SUDO) $(INSTALL) -o root -m 4755 $< $@

$(addprefix $(INSTALL_BINDIR)/, $(SETUID_BIN_SCRIPTS)): $(INSTALL_BINDIR)/%: %
	echo "Installing (setuid) $<"
	-mkdir -p $(INSTALL_BINDIR)
	$(SUDO) $(INSTALL) -o root -m 4755 $< $@

$(addprefix $(INSTALL_LIBEXECDIR)/, $(SETUID_LIBX_SCRIPTS)): $(INSTALL_LIBEXECDIR)/%: %
	echo "Installing (setuid) $<"
	-mkdir -p $(INSTALL_LIBEXECDIR)
	$(SUDO) $(INSTALL) -o root -m 4755 $< $@


55 56
CFLAGS += $(LOCALCFLAGS)

57 58 59
clean:

distclean: clean
60 61 62 63 64 65 66 67
	rm -f GNUmakefile

#
# 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.
#
Leigh Stoller's avatar
Leigh Stoller committed
68 69 70 71
vpath %.in  $(SRCDIR) $(MOSTLY_SRCDIRS)
vpath %.c   $(SRCDIR) $(MOSTLY_SRCDIRS)
vpath %.cc  $(SRCDIR) $(MOSTLY_SRCDIRS)
vpath %     $(SRCDIR) $(MOSTLY_SRCDIRS)
72 73 74 75 76 77 78

#
# Define rules which we blew away with .SUFFIXES
# 
%.o: %.c
	$(CC) -c -o $@ $(CFLAGS) $<

79 80 81
%.o: %.cc
	$(CXX) -c -o $@ $(CXXFLAGS) $<

Timothy Stack's avatar
Timothy Stack committed
82 83 84
%.o: %.C
	$(CXX) -c -o $@ $(CXXFLAGS) $<

85 86 87 88 89 90
%_xdr.h: %.x
	rpcgen -h $< > $@

%_xdr.c: %.x %_xdr.h
	rpcgen -c $< > $@

91
%: %-debug
92
	$(STRIP) -o $@$(EXE) $<$(EXE)
93

Timothy Stack's avatar
Timothy Stack committed
94 95 96
%-version.c:
	echo >$@ "char build_info[] = \"Built on `date` by `id -nu`@`hostname | sed 's/\..*//'`:`pwd`\";"

97 98 99
#
# Rules to regen configure written files.
#
100
%: %.in
101
	@echo "Regenerating $@"
102
	cd $(OBJDIR) && CONFIG_FILES=$(SUBDIR)/$@ ./config.status
103 104 105 106 107

ifeq ($(TESTS),)
.PHONY: check
else
check: $(TESTS)
108
	@export SRCDIR=${SRCDIR}; for tst in $^; do \
109 110 111 112 113
		if test `basename $$tst .sh` != `basename $$tst`; then \
			tst="sh $$tst"; \
		fi; \
		if $$tst; then \
			echo "PASS: $$tst"; \
Timothy Stack's avatar
Timothy Stack committed
114 115 116
		else \
			echo "FAIL: $$tst"; \
			exit 1; \
117 118 119
		fi \
	done
endif