summaryrefslogtreecommitdiff
path: root/src/Makefile
blob: 82ac0b19468853408ca6dfa2ae1504e822a446ef (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
.POSIX:

all: bosix

CFLAGS=-Wall -Wextra -Wpedantic
LDFLAGS=
LIBS=-ll -ly

include .deps.mk
include .objs.mk

bosix: $(OBJS)
	$(CC) -o $@ $(OBJS) $(LDFLAGS) $(LIBS)

deps:
	printf '.POSIX:\n\n' > .deps.mk
	for i in *.c; do printf '%s.o: %s ' "$$(basename $$i .c)" "$$i"; grep include "$$i" | sed -e 's/^.*"\(.*\)".*/\1/g' | paste -d' ' -s -; printf '\t$$(CC) -c $$(CFLAGS) %s\n\n' "$$i"; done >> .deps.mk
	printf '.POSIX:\n\nOBJS=' > .objs.mk
	for i in *.c; do printf '\\\n\t%s.o' $$(basename $$i .c); done >> .objs.mk
	printf '\n' >> .objs.mk

clean:
	rm -f bosix *.o