CCOPTS = --std=gnu99 -Wall -Werror -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_swap: common config_node cc $(CCOPTS) src/config_swap.c -c -o obj/config_swap.o config_net: common config_node cc $(CCOPTS) src/config_net.c -c -o obj/config_net.o config_shell: common config_node cc $(CCOPTS) src/config_shell.c -c -o obj/config_shell.o config: config_node config_bat config_fs config_net config_date config_time config_mem config_swap config_cpu config_shell 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