ref: 961fb6813b00f224c219d026da48cf6d01c779ab
parent: f0ce247dea7ef73e621b5a0ed8598ee9108dbd75
author: Ori Bernstein <[email protected]>
date: Mon Aug 18 20:00:51 EDT 2014
Clean up makefiles a bit.
--- a/6/Makefile
+++ b/6/Makefile
@@ -1,5 +1,4 @@
INSTBIN=6m
-BIN=6m
OBJ=isel.o \
locs.o \
main.o \
--- 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
--- a/mk/c.mk
+++ b/mk/c.mk
@@ -10,6 +10,9 @@
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 @@
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 @@
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 {} \;