summaryrefslogtreecommitdiffhomepage
path: root/Makefile
blob: b584fbc25a38f6d9132166617467db2de3d6556a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
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
SHARE?=$(PREFIX)/share
PLOP_DEFAULT_HANDLER?=$(SHARE)/plop/default.lua

plop: connection.o main.o plop.o stream.o

main.o: CFLAGS+=-DPLOP_DEFAULT_HANDLER=\"$(PLOP_DEFAULT_HANDLER)\"
main.o: plop.h
plop.o: connection.h plop.h stream.h
connection.o: connection.h
stream.o: stream.h

clean:
	rm -f plop *.o

install: plop
	mkdir -p $(PREFIX)/bin
	mkdir -p $(SHARE)/man/man1
	mkdir -p $(SHARE)/plop
	cp -f plop $(PREFIX)/bin
	cp -f plop.1 $(SHARE)/man/man1
	cp -f default.lua $(SHARE)/plop
	chmod 755 $(PREFIX)/bin/plop
	chmod 644 $(SHARE)/man/man1/plop.1
	chmod 644 $(SHARE)/plop/default.lua

uninstall:
	rm -f $(PREFIX)/bin/plop
	rm -f $(SHARE)/man/man1/plop.1
	rm -f $(SHARE)/plop/default.lua
	rmdir $(SHARE)/plop

env:
	@echo PREFIX=$(PREFIX)
	@echo SHARE=$(SHARE)
	@echo PLOP_DEFAULT_HANDLER=$(PLOP_DEFAULT_HANDLER)

.PHONY: clean install uninstall env