scc

simple c99 compiler
git clone git://git.simple-cc.org/scc
Log | Files | Refs | Submodules | README | LICENSE

commit e2e78b71c2036912928c495bf3135aa1423048cc
parent 6fb283ecec245963ec4afa4f7a0b09d4479dcdf9
Author: Anders Damsgaard <anders@adamsgaard.dk>
Date:   Wed, 15 Sep 2021 12:51:23 +0200

add uninstall make target and helper script

Diffstat:
MMakefile | 3+++
Ascripts/uninstall | 45+++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 48 insertions(+), 0 deletions(-)

diff --git a/Makefile b/Makefile @@ -35,6 +35,9 @@ dirs: $(SCRIPTDIR)/libc-proto install: all $(SCRIPTDIR)/install $(PREFIX) +uninstall: + $(SCRIPTDIR)/uninstall $(PREFIX) + clean: xargs rm -rf < $(SCRIPTDIR)/libc-proto rm -f dirs diff --git a/scripts/uninstall b/scripts/uninstall @@ -0,0 +1,45 @@ +#!/bin/sh + +set -e + +for i +do + case "$i" in + -p) + proto=$2 + shift 2 + ;; + -*) + echo 1=$1 + echo usage: uninstall [-p proto] prefix >&2 + exit 1 + ;; + esac +done + +prefix=${1?'prefix missed'} + +while read type perm name +do + case $type in + d) + continue + ;; + f) + rm -f $prefix/$name + ;; + *) + echo install: wrong entry type >&2 + exit 1 + ;; + esac +done < ${proto:-scripts/proto} + +while read type perm name +do + case $type in + d) + rmdir $prefix/$name || : + ;; + esac +done < ${proto:-scripts/proto}