2024-03-09 12:43:35 +01:00
|
|
|
.POSIX:
|
|
|
|
.SUFFIXES:
|
|
|
|
|
2024-03-15 12:51:58 +01:00
|
|
|
CC = cc
|
|
|
|
VERSION = 1.0
|
2024-03-09 18:37:04 +01:00
|
|
|
TARGET = ccc
|
|
|
|
MANPAGE = ccc.1
|
2024-03-15 12:51:58 +01:00
|
|
|
CONF = config.h
|
|
|
|
PREFIX ?= /usr/local
|
|
|
|
BINDIR = $(PREFIX)/bin
|
|
|
|
MANDIR = $(PREFIX)/share/man/man1
|
2024-03-09 12:43:35 +01:00
|
|
|
|
2024-03-09 18:37:04 +01:00
|
|
|
# Flags
|
|
|
|
LDFLAGS = $(shell pkg-config --libs ncurses)
|
2024-03-14 20:47:46 +01:00
|
|
|
CFLAGS = -march=native -mtune=native -O3 -pipe -s -std=c99 -pedantic $(shell pkg-config --cflags ncurses) -Wall # -Wextra -Werror
|
2024-03-09 12:43:35 +01:00
|
|
|
|
2024-03-19 23:07:05 +01:00
|
|
|
SRC = ccc.c util.c file.c
|
2024-03-09 12:43:35 +01:00
|
|
|
|
2024-03-13 20:19:22 +01:00
|
|
|
$(TARGET): $(SRC)
|
2024-03-09 12:43:35 +01:00
|
|
|
$(CC) $(CFLAGS) $(LDFLAGS) $(SRC) -o $@
|
|
|
|
|
2024-03-15 12:51:58 +01:00
|
|
|
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)
|
2024-03-09 12:43:35 +01:00
|
|
|
|
|
|
|
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)
|
2024-03-15 12:51:58 +01:00
|
|
|
|
|
|
|
all: $(TARGET)
|
|
|
|
|
|
|
|
.PHONY: all dist install uninstall clean
|