-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
68 lines (53 loc) · 1.38 KB
/
Makefile
File metadata and controls
68 lines (53 loc) · 1.38 KB
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
65
66
67
68
src = src/
srcDir = $(src)
includeDir = include/
lib = lib/
libDir = $(lib)
libs = $(wildcard $(libDir)*.dll.a)
libsFlag = $(libs:lib/lib%.dll.a=-l%)
program = program/
programDir = $(srcDir)$(program)
programSrc = $(wildcard $(programDir)*.c)
programObj = $(programSrc:%.c=%.o)
shared = shared/
sharedDir = $(srcDir)$(shared)
sharedSrc = $(wildcard $(sharedDir)*.c)
sharedObj = $(sharedSrc:%.c=%.o)
tests = tests/
testsDir = $(srcDir)$(tests)
testsBin = $(objDir)$(tests)
testsSrc = $(wildcard $(testsDir)*.c)
testsObj = $(testsSrc:%.c=%.o)
CC = gcc
CFLAGS = -I./$(includeDir) -I./$(sharedDir) -L./$(libDir) $(libsFlag) --ansi -g
build-run: build run
build: test program
rebuild: clean build
clean:
rm -rf src/*/*.o
rm -rf src/*/*.tmp
rm -rf *.exe
shared: $(sharedObj)
@echo
@echo =====[Compiling shared]=====
test: update tests
@echo
@echo =====[Running tests]=====
./tests.exe
tests: shared $(testsObj)
@echo
@echo =====[Linking tests]=====
$(CC) $(sharedObj) $(testsObj) -o ./tests.exe $(CFLAGS)
run: program
@echo
@echo =====[Running program]=====
./greengrid.exe 1 0 47
program: shared $(programObj)
@echo
@echo =====[Linking program]=====
$(CC) $(sharedObj) $(programObj) -o ./greengrid.exe $(CFLAGS)
update:
@echo
@echo =====[Updating ninjo2dmidk.json]=====
mkdir -p data
curl "https://www.dmi.dk/NinJo2DmiDk/ninjo2dmidk?cmd=llj&ids=2624886" -o data/ninjo2dmidk.json