aboutsummaryrefslogtreecommitdiff
path: root/vendor/librune/gen/mkfile
blob: a55b08a60991f346cea3fb6a6e5b1ad1b71fc170 (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
#!/bin/sh

set -e
cd "${0%/*}/.."
exec >Makefile

cat <<make
.POSIX:

CC = cc
CFLAGS = -Wall -Wextra -Wpedantic -g -ggdb3 -fanalyzer -Iinclude

make

printf 'objs = \\\n'
find lib -name '*.c' | sort | sed '
	s/c$/o/
	s/.*/\t& \\/
	$s/ \\$//
'

cat <<make

all: \$(objs)

make

find lib -name '*.c' | sort | sed -E 's/(.*)c$/\1o: \1c/'

cat <<make

clean:
	find lib -name '*.o' -delete

ls:
	@echo "alias ls='ls --color=auto -I \"*.o\" -I \"compile_commands.json\"'" >&2
make