fatbase

portable OpenBSD tools
git clone git://git.2f30.org/fatbase
Log | Files | Refs

commit 7ac827138b87fbf2a8d5502cee226235e97fa91c
parent b1bc08c47735e79475c902e4c5838b57c218653a
Author: sin <sin@2f30.org>
Date:   Tue, 18 Nov 2014 17:17:00 +0000

Add install/uninstall targets

Diffstat:
MMakefile | 2+-
Mawk/Makefile | 9++++-----
Mhexdump/Makefile | 9++++-----
Msed/Makefile | 9++++-----
Astd.mk | 12++++++++++++
5 files changed, 25 insertions(+), 16 deletions(-)

diff --git a/Makefile b/Makefile @@ -6,7 +6,7 @@ all: @echo "CC = $(CC)" for i in $(TARG); do cd $$i && $(MAKE) CC="$(CC)" CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" || exit; cd ..; done -install: +install: all for i in $(TARG); do cd $$i && $(MAKE) install || exit; cd ..; done uninstall: diff --git a/awk/Makefile b/awk/Makefile @@ -1,8 +1,8 @@ OBJ = arc4random.o b.o lex.o lib.o main.o parse.o proctab.o reallocarray.o run.o strlcat.o strlcpy.o tran.o ytab.o -BIN = awk +TARG = awk LDLIBS = -lm -all: ytab.c proctab.c $(BIN) +all: ytab.c proctab.c $(TARG) ytab.c ytab.h: awkgram.y $(YACC) -d awkgram.y @@ -15,8 +15,7 @@ proctab.c: maketab maketab: ytab.h maketab.c $(CC) maketab.c -o $@ -$(BIN): $(OBJ) - $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(OBJ) $(LDLIBS) +include ../std.mk clean: - rm -f $(BIN) $(OBJ) maketab proctab.c ytab.[ch] + rm -f $(TARG) $(OBJ) maketab proctab.c ytab.[ch] diff --git a/hexdump/Makefile b/hexdump/Makefile @@ -1,10 +1,9 @@ OBJ = conv.o display.o fgetln.o hexdump.o hexsyntax.o odsyntax.o parse.o -BIN = hexdump +TARG = hexdump -all: $(BIN) +all: $(TARG) -$(BIN): $(OBJ) - $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(OBJ) +include ../std.mk clean: - rm -f $(BIN) $(OBJ) + rm -f $(TARG) $(OBJ) diff --git a/sed/Makefile b/sed/Makefile @@ -1,10 +1,9 @@ OBJ = compile.o fgetln.o main.o misc.o process.o reallocarray.o strlcat.o strlcpy.o -BIN = sed +TARG = sed -all: $(BIN) +all: $(TARG) -$(BIN): $(OBJ) - $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(OBJ) +include ../std.mk clean: - rm -f $(BIN) $(OBJ) + rm -f $(TARG) $(OBJ) diff --git a/std.mk b/std.mk @@ -0,0 +1,12 @@ +$(TARG): $(OBJ) + $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(OBJ) $(LDLIBS) + +install: + mkdir -p $(DESTDIR)/$(PREFIX)/bin + cp -f $(TARG) $(DESTDIR)/$(PREFIX)/bin + mkdir -p $(DESTDIR)/$(MANPREFIX)/man1 + cp -f $(TARG).1 $(DESTDIR)/$(PREFIX)/man1 + +uninstall: + cd $(DESTDIR)/$(PREFIX)/bin && rm $(TARG) + cd $(DESTDIR)/$(MANPREFIX)/man1 && rm $(TARG).1