slr/Makefile

46 lines
1,019 B
Makefile
Raw Normal View History

2024-05-16 19:40:44 +02:00
.POSIX:
.SUFFIXES:
CC = cc
VERSION = 1.0
TARGET = slr
2024-05-17 09:46:11 +02:00
MANPAGE = $(TARGET).1
2024-05-16 19:40:44 +02:00
PREFIX ?= /usr/local
BINDIR = $(PREFIX)/bin
MANDIR = $(PREFIX)/share/man/man1
# Flags
2024-05-22 12:12:48 +02:00
LDFLAGS =
CFLAGS = -O3 -march=native -mtune=native -pipe -s -std=c99 -pedantic -Wall -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=600
2024-05-16 19:40:44 +02:00
2024-05-22 12:12:48 +02:00
SRC = slr.c lexer.c parser.c
2024-05-16 19:40:44 +02:00
$(TARGET): $(SRC)
$(CC) $(SRC) -o $@ $(CFLAGS) $(LDFLAGS)
dist:
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)
cp -p $(MANPAGE) $(DESTDIR)$(MANDIR)/$(MANPAGE)
chmod 644 $(DESTDIR)$(MANDIR)/$(MANPAGE)
uninstall:
$(RM) $(DESTDIR)$(BINDIR)/$(TARGET)
$(RM) $(DESTDIR)$(MANDIR)/$(MANPAGE)
clean:
$(RM) $(TARGET)
all: $(TARGET)
.PHONY: all dist install uninstall clean