RELEASE=0.5

OPT	= -DACPI -O

CC	= gcc
CFLAGS	= $(OPT) -Wall -I/usr/X11R6/include
LDFLAGS = $(OPT) -L/usr/X11R6/lib -lX11 -lXpm -lXext

SRCS	= wmacpimon.c libacpi.c history.c
OBJS	= wmacpimon.o libacpi.o history.o
PARSERS = valueparsers.o battinfo.o battstate.o thrmstate.o thrmcooling.o\
	acstate.o thrmtrip.o thrmtemp.o

DISTFILES = $(SRCS) valueparsers.c valueparsers.h wmacpimon.h history.h \
	acpiintf.h *.lex master.xpm wmgeneral \
	README INSTALL AUTHORS ChangeLog Makefile TODO

%.c: %.lex
	flex -o $@ $<

all:	wmacpimon

wmacpimon:	$(OBJS) $(PARSERS)

parsers.h: *.lex
	grep "^int parse_" *.lex | sed -e 's/.*://;s/)/);/' > parsers.h

install: wmacpimon
	cp wmacpimon /usr/local/bin/wmacpimon

clean:
	rm -f *.o *~ wmacpimon trace *.out *.bb *.bbg

DESTDIR=wmacpimon-$(RELEASE)

distri:
	if test ! -d $(DESTDIR); then mkdir $(DESTDIR); fi
	cp -r $(DISTFILES) $(DESTDIR)
	tar -cvf $(DESTDIR).tar $(DESTDIR)
	-rm $(DESTDIR).tar.gz
	gzip -9 $(DESTDIR).tar

libacpi.c: parsers.h
