diff options
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..ee939c1 --- /dev/null +++ b/Makefile @@ -0,0 +1,55 @@ +CCOPTS = --std=gnu99 -Wall -O2 + +all: setup common config + cc $(CCOPTS) src/main.c obj/*.o -o i3cstat + +setup: + if [ ! -d obj ]; then mkdir obj; fi + +clean: + if [ ! -d obj ]; then rm -r obj; fi + +common: + cc $(CCOPTS) src/common.c -c -o obj/common.o + +config_node: + cc $(CCOPTS) src/config_node.c -c -o obj/config_node.o + +config_time: common config_node + cc $(CCOPTS) src/config_time.c -c -o obj/config_time.o + +config_date: common config_node + cc $(CCOPTS) src/config_date.c -c -o obj/config_date.o + +config_cpu: common config_node + cc $(CCOPTS) src/config_cpu.c -c -o obj/config_cpu.o + +config_bat: common config_node + cc $(CCOPTS) src/config_bat.c -c -o obj/config_bat.o + +config_fs: common config_node + cc $(CCOPTS) src/config_fs.c -c -o obj/config_fs.o + +config_mem: common config_node + cc $(CCOPTS) src/config_mem.c -c -o obj/config_mem.o + +config_net: common config_node + cc $(CCOPTS) src/config_net.c -c -o obj/config_net.o + +config: config_node config_bat config_fs config_net config_date config_time config_mem config_cpu + cc $(CCOPTS) src/config.c -c -o obj/config.o + +install: + install -D -m 0755 i3cstat $(DESTDIR)/usr/bin/i3cstat + +_tests: + mkdir -p tests/obj + $(info Compiling tests) + cc $(CCOPTS) tests/assert.c -c -o tests/obj/assert.o + cc $(CCOPTS) tests/test_common.c -c -o tests/obj/test_common.o + cc $(CCOPTS) tests/test_config.c -c -o tests/obj/test_config.o + +test: common config _tests + cc $(CCOPTS) tests/main.c obj/*.o tests/obj/*.o -o tests/runtests + $(info Running tests) + @tests/runtests |