.POSIX: .SUFFIXES: CC = cc VERSION = 1.0 TARGET = ccc MANPAGE = ccc.1 CONF = config.h PREFIX ?= /usr/local BINDIR = $(PREFIX)/bin MANDIR = $(PREFIX)/share/man/man1 # Flags LDFLAGS = $(shell pkg-config --libs ncurses) CFLAGS = -march=native -mtune=native -O3 -pipe -s -std=c99 -pedantic $(shell pkg-config --cflags ncurses) -Wall # -Wextra -Werror SRC = ccc.c util.c file.c $(TARGET): $(SRC) $(CC) $(CFLAGS) $(LDFLAGS) $(SRC) -o $@ 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