# Makefile for Asus ACPI daemon

# update these numbers for new releases
VERSION = 1.0.3
RELEASE = 1

INSTPREFIX =
BINDIR = $(INSTPREFIX)/usr/local/bin
MAN8DIR = $(INSTPREFIX)/usr/local/share/man/man8

PROG = asus_acpid
SRCS = acpid.c event.c ud_socket.c
HDRS = acpid.h
MAN8 = asus_acpid.8
OBJS = $(SRCS:.c=.o)
MAN8GZ = $(MAN8:.8=.8.gz)
CLEANFILES = $(PROG) $(OBJS) $(MAN) *.spec tags

CFLAGS = -Wall -g $(DEFS)
DEFS = -DVERSION="\"$(VERSION)\""

all: $(PROG)

$(PROG): $(OBJS)
	$(CC) -o $@ $^

$(OBJS): $(HDRS)

man: $(MAN8)
	for a in $^; do gzip -f -9 -c $$a > $$a.gz; done

install: $(PROG) man
	mkdir -p $(BINDIR)
	install -m 755 $(PROG) $(BINDIR)
	mkdir -p $(MAN8DIR)
	install -m 644 $(MAN8GZ) $(MAN8DIR)

clean: 
	$(RM) $(CLEANFILES) $(MAN8GZ)

