From 1bf043e22d2110b38a2f45216fbdbcea281c5994 Mon Sep 17 00:00:00 2001 From: Laurent Vivier Date: Wed, 16 Nov 2005 13:57:01 +0000 Subject: [PATCH] Move some generic Makefile parts --- Rules.mk | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 Rules.mk diff --git a/Rules.mk b/Rules.mk new file mode 100644 index 0000000..16bcb5c --- /dev/null +++ b/Rules.mk @@ -0,0 +1,34 @@ +OBJS = $(patsubst %.S,%.o,$(SOURCES:.c=.o)) + +MODULE ?= $(basename $(TOP)) + +DISTFILES ?= $(SOURCES) $(HEADERS) $(MANPAGES) Makefile + +%.8: %.sgml + docbook-to-man $< > $@ + +%.8.gz: %.8 + gzip -9c $< > $@ + +ifdef LIBRARY +$(LIBRARY): $(OBJS) + $(AR) rc $@ $^ +endif + +dist: + for file in $(DISTFILES); do \ + dir=$$(dirname $$file); \ + if [ "$$dir" != "" ] ; then \ + mkdir -p $(DISTDIR)/$(MODULE)/$$dir; \ + fi; \ + cp -p $$file $(DISTDIR)/$(MODULE)/$$file; \ + done + +ifdef TARGET +clean: + cd $(TARGET) && \ + rm -f $(OBJS) $(PROGRAMS) $(LIBRARY) $(MANPAGES) +else +clean: + rm -f $(OBJS) $(PROGRAMS) $(LIBRARY) $(MANPAGES) +endif