blob: 645c7b2992ab605125865de18a167fe599f34d36 (
plain)
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
#!/usr/bin/env lua
do
function getCFLAGSArr()return{
"-Wall", "-Werror", "-pedantic", "-std=c99", "-fmax-errors=1", "-ggdb", "-O0",
}end
function getLDFLAGSAarr()return{ }end
end
function main()
local snk = io.open("Makefile", "wb")
snk:write([=[
.SILENT:
CC=gcc
LD=gcc
MKDIRS=mkdir -p
RIMRAF=rm -rf
PROJECT_NAME=quotprint
PROJECT_VERSION=$(shell git describe --tags|sed -E 's;^v;;' || date -u +0.0.0-%Y%m%d.%H%M%S)
CFLAGS=]=])for _, f in ipairs(getCFLAGSArr())do snk:write(" ")snk:write(f)end snk:write([=[ \
-DPROJECT_NAME=$(PROJECT_NAME) \
-DPROJECT_VERSION=$(PROJECT_VERSION) \
DFLAGS=]=])for _, f in ipairs(getLDFLAGSAarr())do snk:write(" ")snk:write(f)end snk:write("\n"..[=[
.PHONY: default
default: build/bin/quotprint
.PHONY: clean
clean:
$(RIMRAF) build/bin/* build/obj/*
build/bin/quotprint:
build/bin/quotprint: build/obj/quotprint.o
printf ' LN\t%s\n' '$@'
$(MKDIRS) "$(shell dirname "$@")"
$(LD) -o $@ $^ $(LDFLAGS)
build/obj/quotprint.o:
build/obj/quotprint.o: src/quotprint.c
printf ' CC\t%s\n' '$@'
$(MKDIRS) "$(shell dirname "$@")"
$(CC) -c -o $@ $^ $(CFLAGS)
]=])
snk:close()
end
main()
|