summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2014-08-19 00:00:51 -0400
committerOri Bernstein <ori@eigenstate.org>2014-08-19 00:00:51 -0400
commit852f60121592169bb597db06bb8765a270a8d03c (patch)
tree50068525810415eb49d72ad6c9e6dd1480f14ff1
parent536105d659535689404ddde480cf26f849b84772 (diff)
downloadmc-852f60121592169bb597db06bb8765a270a8d03c.tar.gz
Clean up makefiles a bit.
-rw-r--r--6/Makefile1
-rw-r--r--doc/Makefile18
-rw-r--r--mk/c.mk49
3 files changed, 33 insertions, 35 deletions
diff --git a/6/Makefile b/6/Makefile
index a3c69c0..5667fd3 100644
--- a/6/Makefile
+++ b/6/Makefile
@@ -1,5 +1,4 @@
INSTBIN=6m
-BIN=6m
OBJ=isel.o \
locs.o \
main.o \
diff --git a/doc/Makefile b/doc/Makefile
index 9ee91a7..5153571 100644
--- a/doc/Makefile
+++ b/doc/Makefile
@@ -1,21 +1,7 @@
-MAN=mc.1 \
+INSTMAN=mc.1 \
muse.1 \
myrbuild.1 \
include ../config.mk
-
-all:
-
-install:
- @echo install -m 644 $(MAN) $(abspath $(DESTDIR)/$(INST_ROOT)/share/man/man1); \
- mkdir -p $(abspath $(DESTDIR)/$(INST_ROOT)/share/man/man1); \
- install -m 644 $(MAN) $(abspath $(DESTDIR)/$(INST_ROOT)/share/man/man1); \
-
-uninstall: $(MAN)
- @for i in $^; do \
- echo rm -f $(abspath $(DESTDIR)/$(INST_ROOT)/share/man/man1/$$i); \
- rm -f $(abspath $(DESTDIR)/$(INST_ROOT)/share/man/man1/$$i); \
- done
-
-clean:
+include ../mk/c.mk
diff --git a/mk/c.mk b/mk/c.mk
index 5fb3030..fc17072 100644
--- a/mk/c.mk
+++ b/mk/c.mk
@@ -10,6 +10,9 @@ CFLAGS += -Wall -Werror -Wextra -Wno-unused-parameter -Wno-missing-field-initial
CFLAGS += -g
CFLAGS += -MMD -MP -MF ${_DEPSDIR}/$(subst /,-,$*).d
+LIB ?= $(INSTLIB)
+BIN ?= $(INSTBIN)
+
# disable implicit rules.
.SUFFIXES:
.PHONY: clean clean-gen clean-bin clean-obj clean-misc clean-backups
@@ -47,32 +50,36 @@ subdirs-install:
exit 1 \
); done
-
clean: subdirs-clean
rm -f ${BIN} ${OBJ} ${CLEAN}
-
install: subdirs-install $(INSTBIN) $(INSTLIB) $(INSTHDR) $(INSTPKG)
- @if [ ! -z "$(INSTBIN)" ]; then \
- echo install $(abspath $(INSTBIN) $(DESTDIR)/$(INST_ROOT)/bin); \
+ @for i in $(INSTBIN); do \
+ echo install $(abspath $$i $(DESTDIR)/$(INST_ROOT)/bin); \
mkdir -p $(abspath $(DESTDIR)/$(INST_ROOT)/bin); \
- install $(INSTBIN) $(abspath $(DESTDIR)/$(INST_ROOT)/bin); \
- fi
- @if [ ! -z "$(INSTLIB)" ]; then \
- echo install -m 644 $(INSTLIB) $(abspath $(DESTDIR)/$(INST_ROOT)/lib); \
+ install $$i $(abspath $(DESTDIR)/$(INST_ROOT)/bin); \
+ done
+ @for i in $(INSTLIB); do \
+ echo install -m 644 $$i $(abspath $(DESTDIR)/$(INST_ROOT)/lib); \
mkdir -p $(abspath $(DESTDIR)/$(INST_ROOT)/lib); \
- install -m 644 $(INSTLIB) $(abspath $(DESTDIR)/$(INST_ROOT)/lib); \
- fi
- @if [ ! -z "$(INSTHDR)" ]; then \
- echo install $(INSTHDR) $(abspath $(DESTDIR)/$(INST_ROOT)/include); \
+ install -m 644 $$i $(abspath $(DESTDIR)/$(INST_ROOT)/lib); \
+ done
+ @for i in $(INSTHDR); do \
+ echo install $$i $(abspath $(DESTDIR)/$(INST_ROOT)/include); \
mkdir -p $(abspath $(DESTDIR)/$(INST_ROOT)/include); \
- install $(INSTHDR) $(abspath $(DESTDIR)/$(INST_ROOT)/include); \
- fi
- @if [ ! -z "$(INSTPKG)" ]; then \
- echo install $(abspath $(INSTPKG) $(DESTDIR)/$(INST_ROOT)/lib/pkgconfig); \
+ install $$i $(abspath $(DESTDIR)/$(INST_ROOT)/include); \
+ done
+ @for i in $(INSTPKG); do \
+ echo install $(abspath $$i $(DESTDIR)/$(INST_ROOT)/lib/pkgconfig); \
mkdir -p $(abspath $(DESTDIR)/$(INST_ROOT)/lib/pkgconfig); \
- install $(abspath $(INSTPKG) $(DESTDIR)/$(INST_ROOT)/lib/pkgconfig); \
- fi
+ install $(abspath $$i $(DESTDIR)/$(INST_ROOT)/lib/pkgconfig); \
+ done
+ @for i in $(INSTMAN); do \
+ sect="$${i##*.}"; \
+ echo install -m 644 $$i $(abspath $(DESTDIR)/$(INST_ROOT)/share/man/man$${sect}); \
+ mkdir -p $(abspath $(DESTDIR)/$(INST_ROOT)/share/man/man$${sect}); \
+ install -m 644 $$i $(abspath $(DESTDIR)/$(INST_ROOT)/share/man/man$${sect}); \
+ done
subdirs-uninstall:
@for i in $(SUB); do (\
@@ -98,6 +105,12 @@ uninstall: subdirs-uninstall
echo rm -f $(abspath $(DESTDIR)/$(INST_ROOT)/lib/pkgconfig/$$i); \
rm -f $(abspath $(DESTDIR)/$(INST_ROOT)/lib/pkgconfig/$$i); \
done
+ @for i in $(INSTMAN); do \
+ sect="$${i##*.}" \
+ echo rm -f $$i $(abspath $(DESTDIR)/$(INST_ROOT)/share/man/man$${sect}/$$i); \
+ rm -f $(abspath $(DESTDIR)/$(INST_ROOT)/share/man/man$${sect}/$$i); \
+ done
+
clean-backups:
find ./ -name .*.sw* -exec rm -f {} \;