GNUmakerules 1.87 KB
Newer Older
1 2 3
#
# Insert Copyright Here.
#
4 5 6 7 8 9 10 11 12

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

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

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

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

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

38 39
CFLAGS += $(LOCALCFLAGS)

40 41 42
clean:

distclean: clean
43 44 45 46 47 48 49 50
	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
51 52 53 54
vpath %.in  $(SRCDIR) $(MOSTLY_SRCDIRS)
vpath %.c   $(SRCDIR) $(MOSTLY_SRCDIRS)
vpath %.cc  $(SRCDIR) $(MOSTLY_SRCDIRS)
vpath %     $(SRCDIR) $(MOSTLY_SRCDIRS)
55 56 57 58 59 60 61

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

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

65 66 67 68 69 70
%_xdr.h: %.x
	rpcgen -h $< > $@

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

71
%: %-debug
72
	$(STRIP) -o $@$(EXE) $<$(EXE)
73

74 75 76 77 78
#
# Rules to regen configure written files.
#
%: %.in
	@echo "Regenerating $@"
79
	cd $(OBJDIR) && CONFIG_FILES=$(SUBDIR)/$@ ./config.status
80 81 82 83 84

ifeq ($(TESTS),)
.PHONY: check
else
check: $(TESTS)
85
	@export SRCDIR=${SRCDIR}; for tst in $^; do \
86 87 88 89 90
		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
91 92 93
		else \
			echo "FAIL: $$tst"; \
			exit 1; \
94 95 96
		fi \
	done
endif