blob: 38885f43be364207ac2f30407bbac9b59f8e2f6b (
plain)
1 CCOPTS = --std=gnu99 -Wall -Werror -O2
2
3 all: setup common config
4 cc $(CCOPTS) src/main.c obj/*.o -o i3cstat
5
6 setup:
7 if [ ! -d obj ]; then mkdir obj; fi
8
9 clean:
10 if [ ! -d obj ]; then rm -r obj; fi
11
12 common:
13 cc $(CCOPTS) src/common.c -c -o obj/common.o
14
15 config_node:
16 cc $(CCOPTS) src/config_node.c -c -o obj/config_node.o
17
18 config_time: common config_node
19 cc $(CCOPTS) src/config_time.c -c -o obj/config_time.o
20
21 config_date: common config_node
22 cc $(CCOPTS) src/config_date.c -c -o obj/config_date.o
23
24 config_cpu: common config_node
25 cc $(CCOPTS) src/config_cpu.c -c -o obj/config_cpu.o
26
27 config_bat: common config_node
28 cc $(CCOPTS) src/config_bat.c -c -o obj/config_bat.o
29
30 config_fs: common config_node
31 cc $(CCOPTS) src/config_fs.c -c -o obj/config_fs.o
32
33 config_mem: common config_node
34 cc $(CCOPTS) src/config_mem.c -c -o obj/config_mem.o
35
36 config_swap: common config_node
37 cc $(CCOPTS) src/config_swap.c -c -o obj/config_swap.o
38
39 config_net: common config_node
40 cc $(CCOPTS) src/config_net.c -c -o obj/config_net.o
41
42 config_shell: common config_node
43 cc $(CCOPTS) src/config_shell.c -c -o obj/config_shell.o
44
45 config: config_node config_bat config_fs config_net config_date config_time config_mem config_swap config_cpu config_shell
46 cc $(CCOPTS) src/config.c -c -o obj/config.o
47
48 install:
49 install -D -m 0755 i3cstat $(DESTDIR)/usr/bin/i3cstat
50
51 _tests:
52 mkdir -p tests/obj
53 $(info Compiling tests)
54 cc $(CCOPTS) tests/assert.c -c -o tests/obj/assert.o
55 cc $(CCOPTS) tests/test_common.c -c -o tests/obj/test_common.o
56 cc $(CCOPTS) tests/test_config.c -c -o tests/obj/test_config.o
57
58 test: common config _tests
59 cc $(CCOPTS) tests/main.c obj/*.o tests/obj/*.o -o tests/runtests
60 $(info Running tests)
61 @tests/runtests
|