Update Makefile

This commit is contained in:
Night Kaly 2024-10-22 01:11:03 +01:00
parent c716935d1d
commit 11f2c123d5
Signed by: night0721
GPG key ID: 957D67B8DB7A119B

View file

@ -1,42 +1,42 @@
CC=gcc .POSIX:
.SUFFIXES:
VERSION = 1.0 VERSION = 1.0
PREFIX = /usr/local TARGET = based
MANPREFIX = ${PREFIX}/share/man MANPAGE = $(TARGET).1
PREFIX ?= /usr/local
BINDIR = $(PREFIX)/bin
MANDIR = $(PREFIX)/share/man/man1
CFLAGS = -std=gnu11 -O0 -Wall CFLAGS = -O3 -march=native -mtune=native -pipe -s -std=c99 -pedantic -Wall
SRC = based.c SRC = based.c
OBJ = ${SRC:.c=.o}
.c.o: $(TARGET): $(SRC)
${CC} -c ${CFLAGS} $< $(CC) $(SRC) -o $@ $(CFLAGS)
based: ${OBJ} dist:
${CC} -o $@ ${OBJ} mkdir -p $(TARGET)-$(VERSION)
strip based cp -R README.md $(MANPAGE) $(TARGET) $(TARGET)-$(VERSION)
tar -cf $(TARGET)-$(VERSION).tar $(TARGET)-$(VERSION)
gzip $(TARGET)-$(VERSION).tar
rm -rf $(TARGET)-$(VERSION)
clean: install: $(TARGET)
rm -rf based mkdir -p $(DESTDIR)$(BINDIR)
mkdir -p $(DESTDIR)$(MANDIR)
dist: based cp -p $(TARGET) $(DESTDIR)$(BINDIR)/$(TARGET)
mkdir -p based-${VERSION} chmod 755 $(DESTDIR)$(BINDIR)/$(TARGET)
cp -R LICENSE README.md based.1 based based-${VERSION} cp -p $(MANPAGE) $(DESTDIR)$(MANDIR)/$(MANPAGE)
tar -cf based-${VERSION}.tar based-${VERSION} chmod 644 $(DESTDIR)$(MANDIR)/$(MANPAGE)
gzip based-${VERSION}.tar
rm -rf based-${VERSION}
install: all
mkdir -p ${DESTDIR}${PREFIX}/bin
cp -f based ${DESTDIR}${PREFIX}/bin
chmod 755 ${DESTDIR}${PREFIX}/bin/based
mkdir -p ${DESTDIR}${MANPREFIX}/man1
sed "s/VERSION/${VERSION}/g" < based.1 > ${DESTDIR}${MANPREFIX}/man1/based.1
chmod 644 ${DESTDIR}${MANPREFIX}/man1/based.1
uninstall: uninstall:
rm -f ${DESTDIR}${PREFIX}/bin/based\ rm $(DESTDIR)$(BINDIR)/$(TARGET)
${DESTDIR}${MANPREFIX}/man1/based.1 rm $(DESTDIR)$(MANDIR)/$(MANPAGE)
all: based
.PHONY: all clean dist install uninstall based clean:
rm $(TARGET)
all: $(TARGET)
.PHONY: all dist install uninstall clean