summaryrefslogtreecommitdiff
path: root/Makefile
blob: ee939c13fab04244f500396f53f2e655b68d513e (plain)
    1 CCOPTS = --std=gnu99 -Wall -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_net: common config_node
   37 	cc $(CCOPTS) src/config_net.c -c -o obj/config_net.o
   38 
   39 config: config_node config_bat config_fs config_net config_date config_time config_mem config_cpu
   40 	cc $(CCOPTS) src/config.c -c -o obj/config.o
   41 
   42 install:
   43 	install -D -m 0755 i3cstat $(DESTDIR)/usr/bin/i3cstat
   44 
   45 _tests:
   46 	mkdir -p tests/obj
   47 	$(info Compiling tests)
   48 	cc $(CCOPTS) tests/assert.c -c -o tests/obj/assert.o
   49 	cc $(CCOPTS) tests/test_common.c -c -o tests/obj/test_common.o
   50 	cc $(CCOPTS) tests/test_config.c -c -o tests/obj/test_config.o
   51 
   52 test: common config _tests
   53 	cc $(CCOPTS) tests/main.c obj/*.o tests/obj/*.o -o tests/runtests
   54 	$(info Running tests)
   55 	@tests/runtests

Generated by cgit