GNUmakerules 2.68 KB
Newer Older
1 2
#
# EMULAB-COPYRIGHT
3
# Copyright (c) 2000-2011 University of Utah and the Flux Group.
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
# All rights reserved.

# 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.
# 
$(INSTALL_BINDIR)/%: %
	@echo "Installing $<"
	-mkdir -p $(INSTALL_BINDIR)
	$(INSTALL_PROGRAM) $< $@

$(INSTALL_SBINDIR)/%: %
	@echo "Installing $<"
	-mkdir -p $(INSTALL_SBINDIR)
	$(INSTALL_PROGRAM) $< $@

$(INSTALL_LIBDIR)/%: %
	@echo "Installing $<"
	-mkdir -p $(INSTALL_LIBDIR)
	$(INSTALL_PROGRAM) $< $@

$(INSTALL_LIBEXECDIR)/%: %
	@echo "Installing $<"
	-mkdir -p $(INSTALL_LIBEXECDIR)
	$(INSTALL_PROGRAM) $< $@

$(INSTALL_ETCDIR)/%: %
	@echo "Installing $<"
	-mkdir -p $(INSTALL_ETCDIR)
	$(INSTALL_DATA) $< $@

$(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 $< $@


CFLAGS += $(LOCALCFLAGS)

clean:

distclean: clean
	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.
#
vpath %.in  $(SRCDIR) $(MOSTLY_SRCDIRS)
vpath %.c   $(SRCDIR) $(MOSTLY_SRCDIRS)
vpath %.cc  $(SRCDIR) $(MOSTLY_SRCDIRS)
vpath %     $(SRCDIR) $(MOSTLY_SRCDIRS)

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

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

%.o: %.C
	$(CXX) -c -o $@ $(CXXFLAGS) $<

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

%_xdr.c: %.x %_xdr.h
	rpcgen -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

ifeq ($(TESTS),)
.PHONY: check
else
check: $(TESTS)
	@export SRCDIR=${SRCDIR}; for tst in $^; do \
		if test `basename $$tst .sh` != `basename $$tst`; then \
			tst="sh $$tst"; \
		fi; \
		if $$tst; then \
			echo "PASS: $$tst"; \
		else \
			echo "FAIL: $$tst"; \
			exit 1; \
		fi \
	done
endif