~ac/chnode

ref: a6d6a553682d40d7ac751021f78e88dc1ae5b6f5 chnode/Makefile -rw-r--r-- 619 bytes
a6d6a553 — Ant Cosentino experimenting with zig build system 1 year, 1 month ago
                                                                                
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
chnode: *.c
	cc \
		-fsanitize=undefined,nullability,integer \
		-std=c18 \
		-Wall \
		-D PREFIX="\"$(shell echo $$HOME)\"" \
		-D TRACE \
		-pedantic \
		$^ \
		$(shell curl-config --libs) \
		-o $@

.PHONY: install
install: *.c
	cc \
		-O3 \
		-D_FORTIFY_SOURCE=2 \
		-D PREFIX="\"$(PREFIX)\"" \
		-std=c18 \
		-Wall \
		-pedantic \
		$^ \
		$(shell curl-config --libs) \
		-o chnode
	cp -r chnode $(PREFIX)/bin

.PHONY: zig
zig:
	zig \
		build-exe \
		--c-source chnode.c \
		--library curl \
		-D PREFIX="\"$(shell echo $$HOME)\"" \
		-D TRACE=1

clean:
	-rm -f *.o *.out chnode
	-rm -rf $$HOME/.chnode zig-cache