CFLAGS+=-std=c11 -Wall -Wextra -Wpedantic -D_POSIX_C_SOURCE=200809L CFLAGS+=`pkg-config --cflags lua5.4` LDLIBS+=`pkg-config --libs lua5.4` PREFIX?=/usr/local BINDIR?=$(PREFIX)/bin DATADIR?=$(PREFIX)/share MANDIR?=$(DATADIR)/man/man1 PLOP_DEFAULT_HANDLER?=$(DATADIR)/plop/default.lua all: plop plop: connection.o main.o plop.o stream.o buffer.o main.o plop.o: CFLAGS+=-DPLOP_DEFAULT_HANDLER=\"$(PLOP_DEFAULT_HANDLER)\" buffer.o: buffer.h main.o: plop.h plop.o: connection.h plop.h stream.h connection.o: connection.h stream.o: stream.h buffer.h clean: rm -f plop *.o install: plop mkdir -p $(DESTDIR)$(BINDIR) mkdir -p $(DESTDIR)$(MANDIR) mkdir -p $(DESTDIR)$(DATADIR)/plop cp -f plop $(DESTDIR)$(BINDIR)/plop cp -f plop.1 $(DESTDIR)$(MANDIR)/plop.1 cp -f default.lua $(DESTDIR)$(DATADIR)/plop chmod 755 $(DESTDIR)$(BINDIR)/plop chmod 644 $(DESTDIR)$(MANDIR)/plop.1 chmod 644 $(DESTDIR)$(DATADIR)/plop/default.lua uninstall: rm -f $(DESTDIR)$(BINDIR)/plop rm -f $(DESTDIR)$(MANDIR)/plop.1 rm -f $(DESTDIR)$(DATADIR)/plop/default.lua rmdir $(DESTDIR)$(DATADIR)/plop env: @echo DESTDIR=$(DESTDIR) @echo PREFIX=$(PREFIX) @echo DATADIR=$(DATADIR) @echo MANDIR=$(MANDIR) @echo PLOP_DEFAULT_HANDLER=$(PLOP_DEFAULT_HANDLER) .PHONY: all clean install uninstall env