summaryrefslogtreecommitdiff
path: root/mk
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2014-06-03 10:30:32 -0400
committerOri Bernstein <ori@eigenstate.org>2014-06-03 10:30:32 -0400
commitfd2490a9d1185b1a0e87efb68719cec2ba930d11 (patch)
tree7c82afa5df5e3fba8eccdcd655461d1d36988e8b /mk
parent4ab0244228437cef50a7209971b44f8888dd387f (diff)
downloadmc-fd2490a9d1185b1a0e87efb68719cec2ba930d11.tar.gz
Add 'uninstall' rule for libstd.
Diffstat (limited to 'mk')
-rw-r--r--mk/c.mk34
1 files changed, 26 insertions, 8 deletions
diff --git a/mk/c.mk b/mk/c.mk
index a98a5c2..6c1da86 100644
--- a/mk/c.mk
+++ b/mk/c.mk
@@ -14,7 +14,6 @@ CFLAGS += -MMD -MP -MF ${_DEPSDIR}/$(subst /,-,$*).d
.PHONY: all
all: subdirs $(BIN) $(LIB) $(EXTRA)
-install: subdirs-install install-bin install-lib install-hdr install-pc
$(LIB): $(OBJ) $(DEPS)
$(AR) -rcs $@ $(OBJ)
@@ -51,34 +50,53 @@ clean: subdirs-clean
rm -f ${BIN} ${OBJ} ${CLEAN}
-install-bin: $(INSTBIN)
+install: subdirs-install $(INSTBIN) $(INSTLIB) $(INSTHDR) $(INSTPKG)
@if [ ! -z "$(INSTBIN)" ]; then \
echo install $(INSTBIN) $(INST_ROOT)/bin; \
mkdir -p $(INST_ROOT)/bin; \
install $(INSTBIN) $(INST_ROOT)/bin; \
fi
-
-install-lib: $(INSTLIB)
@if [ ! -z "$(INSTLIB)" ]; then \
echo install -m 644 $(INSTLIB) $(INST_ROOT)/lib; \
mkdir -p $(INST_ROOT)/lib; \
install -m 644 $(INSTLIB) $(INST_ROOT)/lib; \
fi
-
-install-hdr: $(INSTHDR)
@if [ ! -z "$(INSTHDR)" ]; then \
echo install $(INSTHDR) $(INST_ROOT)/include; \
mkdir -p $(INST_ROOT)/include; \
install $(INSTHDR) $(INST_ROOT)/include; \
fi
-
-install-pc: $(INSTPKG)
@if [ ! -z "$(INSTPKG)" ]; then \
echo install $(INSTPKG) $(INST_ROOT)/lib/pkgconfig; \
mkdir -p $(INST_ROOT)/lib/pkgconfig; \
install $(INSTPKG) $(INST_ROOT)/lib/pkgconfig; \
fi
+subdirs-uninstall:
+ @for i in $(SUB); do (\
+ cd $$i && \
+ $(MAKE) uninstall|| \
+ exit 1 \
+ ); done
+
+uninstall: subdirs-uninstall
+ @for i in $(INSTBIN); do \
+ echo rm -f $(INST_ROOT)/bin/$$i; \
+ rm -f $(INST_ROOT)/bin/$$i; \
+ done
+ @for i in $(INSTLIB); do \
+ echo rm -f $(INST_ROOT)/lib/$$i; \
+ rm -f $(INST_ROOT)/lib/$$i; \
+ done
+ @for i in $(INSTHDR); do \
+ echo rm -f $(INST_ROOT)/include/$$i; \
+ rm -f $(INST_ROOT)/include/$$i; \
+ done
+ @for i in $(INSTPKG); do \
+ echo rm -f $(INST_ROOT)/lib/pkgconfig/$$i; \
+ rm -f $(INST_ROOT)/lib/pkgconfig/$$i; \
+ done
+
clean-backups:
find ./ -name .*.sw* -exec rm -f {} \;
find ./ -name *.bak -exec rm -f {} \;