-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathMakefile
28 lines (21 loc) · 864 Bytes
/
Makefile
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
PROG=sl1toctb
DEPS=zlib libzip
FILES=main.c spng.c utils.c convert.c parser.c inspect.c
DEV_CFLAGS=-std=c18 -D_POSIX_C_SOURCE=200809L -Wall -Wextra -Wpedantic -Werror -Wno-unused-parameter -O0 -g3 -ggdb3 -fsanitize=undefined
PROD_CFLAGS=-std=c18 -D_POSIX_C_SOURCE=200809L -O2 -pipe -march=native
CFLAGS=$(shell pkg-config --cflags ${DEPS})
PREFIX=/usr/local
LIBS=-lm $(shell pkg-config --libs ${DEPS})
all: ${PROG}
${PROG}: ${FILES}
gcc ${PROD_CFLAGS} ${CFLAGS} ${FILES} -o ${PROG} ${LIBS}
dev:
ctags --kinds-C=+p ${FILES} *.h $(shell gcc -M *.c ${CFLAGS} | sed -e 's/[\\ ]/\n/g' | sed -e '/^$$/d' -e '/\.o:/d')
gcc ${DEV_CFLAGS} ${CFLAGS} ${FILES} -o ${PROG}-dev ${LIBS}
install: ${PROG}
install -D ${PROG} ${PREFIX}/bin/${PROG}
clean:
rm ${PROG} || true
rm ${PROG}-dev || true
analyze:
scan-build clang ${PROD_CFLAGS} ${FILES} -o /dev/null ${LIBS}