#
#
#
#     Makefile
#
#
#

# installation location
BINDIR=/usr/local/bin

# DEBUG: change these for debugging (disable both for production)
CDEBUG=-g -Wall
#CFLAGS=

# Target executables
TARGETS=daylog
ALL_TARGETS=$(TARGETS) stest

# suffix rules
.SUFFIXES=.c .o

all: $(TARGETS)
everything: $(ALL_TARGETS)

daylog: daylog.o dir.o stamps.o util.o
	g++ -o daylog daylog.o dir.o stamps.o util.o

stest: stest.o stamps.o
	g++ -o stest stest.o stamps.o

.c.o:
	gcc $(CDEBUG) $(CFLAGS) -c $<

.cc.o:
	g++ $(CDEBUG) $(CFLAGS) -c $<

clean:
	rm -f *.o core $(ALL_TARGETS)

strip: $(TARGETS)
	strip --strip-unneeded $(TARGETS)

rebuild: clean all

install: $(TARGETS)
	for i in $(TARGETS) ; do install -g root -o root $$i $(BINDIR) ; done

install-strip: strip install

test: daylog
	./testgen.py | ./daylog -c . -f'logfile-%Y%m%d-%H%M%S.txt'
