Update makefile

This commit is contained in:
Night Kaly 2025-02-28 13:59:03 +00:00
parent a26a5bcc3a
commit 11245204ae
Signed by: night0721
SSH key fingerprint: SHA256:B/hgVwUoBpx5vdNsXl9w8XwZljA9766uk6T4ubZp5HM

View file

@ -1,5 +1,4 @@
.POSIX:
.SUFFIXES:
VERSION = 1.0
TARGET = bob
@ -7,20 +6,23 @@ MANPAGE = $(TARGET).1
PREFIX ?= /usr/local
BINDIR = $(PREFIX)/bin
MANDIR = $(PREFIX)/share/man/man1
PKG_CONFIG = pkg-config
LDFLAGS != pkg-config --libs libcurl
CFLAGS = -Os -march=native -mtune=native -pipe -s -std=c99 -pedantic -Wall -D_DEFAULT_SOURCE
PKGS = libcurl
LIBS != $(PKG_CONFIG) --libs $(PKGS)
INCS != $(PKG_CONFIG) --cflags $(PKGS)
CFLAGS += -std=c99 -pedantic -Wall -D_DEFAULT_SOURCE $(INCS)
SRC = bob.c
.c.o:
$(CC) -o $@ $(CFLAGS) -c $<
$(TARGET): $(SRC)
$(CC) $(SRC) -o $@ $(CFLAGS) $(LDFLAGS)
$(TARGET): $(TARGET).o
$(CC) -o $@ $(TARGET).o $(LIBS)
dist:
mkdir -p $(TARGET)-$(VERSION)
cp -R README.md $(MANPAGE) $(TARGET) $(TARGET)-$(VERSION)
tar -cf $(TARGET)-$(VERSION).tar $(TARGET)-$(VERSION)
gzip $(TARGET)-$(VERSION).tar
tar -czf $(TARGET)-$(VERSION).tar.gz $(TARGET)-$(VERSION)
rm -rf $(TARGET)-$(VERSION)
install: $(TARGET)
@ -32,11 +34,11 @@ install: $(TARGET)
chmod 644 $(DESTDIR)$(MANDIR)/$(MANPAGE)
uninstall:
rm $(DESTDIR)$(BINDIR)/$(TARGET)
rm $(DESTDIR)$(MANDIR)/$(MANPAGE)
rm -f $(DESTDIR)$(BINDIR)/$(TARGET)
rm -f $(DESTDIR)$(MANDIR)/$(MANPAGE)
clean:
rm $(TARGET)
rm -f $(TARGET) *.o
all: $(TARGET)