aboutsummaryrefslogtreecommitdiff
path: root/Makefile
blob: beb6144fe12122abded3eebad8190da7c4b67513 (plain) (blame)
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
CC=gcc

CFLAGS=-Wall -Wextra -Werror -fstack-protector-all -pedantic -std=c99
SANITY_FLAGS=-Wfloat-equal -Wshadow -Wpointer-arith

PREFIX ?= /usr

SOURCE=composer.c

OUTPUT=composer

ALL: $(OUTPUT)

debug: CFLAGS += -g -O0
debug: $(OUTPUT)

release: CFLAGS += -static -O3
release: $(OUTPUT)

$(OUTPUT): Makefile $(SOURCE)
	$(CC) $(CFLAGS) $(SANITY_FLAGS) $(SOURCE) -o $(OUTPUT)

install: $(OUTPUT)
	install -Dm755 "composer"   "$(PREFIX)/bin/composer"
	install -Dm644 "LICENSE"    "$(PREFIX)/share/licenses/composer/LICENSE"
	#install -Dm644 "composer.8" "$(PREFIX)/share/man/man8/composer.8.gz"

uninstall:
	rm -f "$(PREFIX)/bin/composer"
	rm -f "$(PREFIX)/share/licenses/composer/LICENSE"
	#rm -f "$(PREFIX)/share/man/man8/composer.8.gz"

#composer: composer.c
#	gcc -ggdb -o $@ -std=c99 -Wall $<

.PHONY:watch
watch: composer
	while true; do \
		clear; \
		(make composer && ./composer) || true; \
		inotifywait -qe modify ./composer.c; \
	done