log/Makefile

43 lines
985 B
Makefile
Raw Permalink Normal View History

.POSIX:
.SUFFIXES:
2024-02-18 00:41:59 +01:00
VERSION = 1.0
2024-10-22 02:18:18 +02:00
TARGET = log
MANPAGE = $(TARGET).1
PREFIX ?= /usr/local
BINDIR = $(PREFIX)/bin
MANDIR = $(PREFIX)/share/man/man1
CFLAGS = -Os -march=native -mtune=native -pipe -s -flto -std=c99 -pedantic -Wall -D_DEFAULT_SOURCE
2024-10-22 02:18:18 +02:00
SRC = log.c
$(TARGET): $(SRC) $(CONF)
$(CC) $(SRC) -o $@ $(CFLAGS)
dist: install
mkdir -p $(TARGET)-$(VERSION)
cp -R README.md $(MANPAGE) $(TARGET) $(TARGET)-$(VERSION)
tar -cf $(TARGET)-$(VERSION).tar $(TARGET)-$(VERSION)
gzip $(TARGET)-$(VERSION).tar
rm -rf $(TARGET)-$(VERSION)
install: $(TARGET)
mkdir -p $(DESTDIR)$(BINDIR)
mkdir -p $(DESTDIR)$(MANDIR)
cp -p $(TARGET) $(DESTDIR)$(BINDIR)/$(TARGET)
chmod 755 $(DESTDIR)$(BINDIR)/$(TARGET)
sed "s/VERSION/${VERSION}/g" < $(MANPAGE) > $(DESTDIR)/$(MANDIR)/$(MANPAGE)
chmod 644 $(DESTDIR)$(MANDIR)/$(MANPAGE)
2024-02-18 00:41:59 +01:00
uninstall:
2024-10-22 02:18:18 +02:00
rm $(DESTDIR)$(BINDIR)/$(TARGET)
rm $(DESTDIR)$(MANDIR)/$(MANPAGE)
2024-02-18 00:41:59 +01:00
clean:
2024-10-22 02:18:18 +02:00
rm $(TARGET)
2024-02-18 00:41:59 +01:00
all: $(TARGET)
2024-02-18 00:41:59 +01:00
.PHONY: all dist install uninstall clean