summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/Makefile6
-rw-r--r--libstd/Makefile4
-rw-r--r--mk/c.mk34
3 files changed, 36 insertions, 8 deletions
diff --git a/doc/Makefile b/doc/Makefile
index 06a0913..a665a06 100644
--- a/doc/Makefile
+++ b/doc/Makefile
@@ -11,5 +11,11 @@ install:
mkdir -p $(INST_ROOT)/share/man/man1; \
install -m 644 $(MAN) $(INST_ROOT)/share/man/man1; \
+uninstall: $(MAN)
+ @for i in $^; do \
+ echo rm -f $(INST_ROOT)/share/man/man1/$$i; \
+ rm -f $(INST_ROOT)/share/man/man1/$$i; \
+ done
+
clean:
diff --git a/libstd/Makefile b/libstd/Makefile
index 1c0a9b1..865d641 100644
--- a/libstd/Makefile
+++ b/libstd/Makefile
@@ -90,5 +90,9 @@ install:
install libstd.a $(INST_ROOT)/lib/myr
install std $(INST_ROOT)/lib/myr
+uninstall:
+ rm -f $(INST_ROOT)/lib/myr/libstd.a
+ rm -f $(INST_ROOT)/lib/myr/std
+
../6/6m:
cd ..; make
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 {} \;