summaryrefslogtreecommitdiff
path: root/mk
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 /mk
parent536105d659535689404ddde480cf26f849b84772 (diff)
downloadmc-852f60121592169bb597db06bb8765a270a8d03c.tar.gz
Clean up makefiles a bit.
Diffstat (limited to 'mk')
-rw-r--r--mk/c.mk49
1 files changed, 31 insertions, 18 deletions
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 {} \;