summaryrefslogtreecommitdiffstats
path: root/Makefile
blob: ba6711a5086c222b654ee055b0c585c77ce623e6 (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
default: build/qlprint

# Get rid of most of the implicit rules by clearing the .SUFFIXES target
.SUFFIXES:
# Get rid of the auto-checkout from old version control systems rules
%: %,v
%: RCS/%,v
%: RCS/%
%: s.%
%: SCCS/s.%


CFLAGS=-std=c11 -Wall -Wextra -g -Iinclude -D_DEFAULT_SOURCE -D_POSIX_C_SOURCE=200809 $(shell pkg-config --cflags libpng)
LDFLAGS=$(shell pkg-config --libs libpng)

OBJS=$(addprefix build/, \
	main.o \
	ql.o \
	loadpng.o \
)

vpath %.c src

build/%.o: %.c
	$(CC) $(CFLAGS) -c $< -o $@

build/qlprint: $(OBJS)
	$(CC) $^ $(LDFLAGS) -o $@

$(OBJS): $(wildcard include/*) Makefile

.PHONY: clean fixstyle
clean:
	-rm -f build/*

fixstyle:
	find include/ src/ -regex '.*\.[ch]' -print0 | xargs -0 -n 1 env VERSION_CONTROL=never indent --linux-style -l100