40 lines
765 B
Makefile
40 lines
765 B
Makefile
DESTDIR ?=
|
|
PREFIX ?= /usr/local
|
|
EXEC_PREFIX ?= $(PREFIX)
|
|
BINDIR ?= $(EXEC_PREFIX)/bin
|
|
DATAROOTDIR ?= $(PREFIX)/share
|
|
MANDIR ?= $(DATAROOTDIR)/man
|
|
|
|
CFLAGS += -Os -g -Wall -Wextra -pedantic
|
|
CPPFLAGS +=
|
|
LDFLAGS +=
|
|
|
|
BINS := plainhex plainunhex
|
|
MAN1S := plainhex.1 plainunhex.1
|
|
|
|
.SUFFIXES:
|
|
.SUFFIXES: .c .o
|
|
|
|
.PHONY: all install uninstall clean distclean
|
|
|
|
all: $(BINS)
|
|
|
|
plainhex: plainhex.o
|
|
$(CC) -o $@ $< $(LDFLAGS)
|
|
|
|
plainunhex: plainunhex.o
|
|
$(CC) -o $@ $< $(LDFLAGS)
|
|
.c.o:
|
|
$(CC) -c $(CFLAGS) $(CPPFLAGS) -o $@ $<
|
|
|
|
install: $(BINS) $(MAN1S)
|
|
install -D -m 755 -t '$(DESTDIR)$(BINDIR)' $(BINS)
|
|
install -D -m 644 -t '$(DESTDIR)$(MANDIR)/man1' $(MAN1S)
|
|
|
|
uninstall:
|
|
cd $(DESTDIR)$(BINDIR) && rm $(BINS)
|
|
|
|
clean:
|
|
rm -f $(BINS) $(LIBEXECS) $(TOOLS) *.o
|
|
|
|
distclean: clean
|