2011-03-25 18:45:13 +00:00
|
|
|
# set options. pick one, acpi or apm. comment out the other one. don't
|
|
|
|
# uncomment both, bad things will happen :)
|
|
|
|
|
2014-08-18 22:56:10 +00:00
|
|
|
OPT := -O2
|
2011-03-25 18:45:13 +00:00
|
|
|
|
2014-08-18 22:56:14 +00:00
|
|
|
# uncomment this to build the command line acpi tool
|
2014-08-18 22:56:18 +00:00
|
|
|
BUILD_CLI = 1
|
2014-08-18 22:56:14 +00:00
|
|
|
|
2011-03-25 18:45:13 +00:00
|
|
|
# uncomment this to make wmacpi use less system colors (looks uglier too)
|
|
|
|
#OPT += -DLOW_COLOR
|
|
|
|
|
|
|
|
# debugging options (don't bother with these)
|
2014-08-18 22:56:14 +00:00
|
|
|
#OPT = -pg -g
|
2011-03-25 18:45:13 +00:00
|
|
|
|
2014-08-18 22:56:10 +00:00
|
|
|
CC := gcc
|
2014-08-18 22:56:33 +00:00
|
|
|
CFLAGS += $(OPT) -Wall -W -g -ansi -I/usr/X11R6/include
|
|
|
|
LDFLAGS += $(OPT) -lX11 -ldockapp
|
2011-03-25 18:45:13 +00:00
|
|
|
|
2014-08-18 22:56:14 +00:00
|
|
|
WMSRC := wmacpi.c libacpi.c
|
|
|
|
HEADERS := libacpi.h wmacpi.h
|
|
|
|
targets := wmacpi
|
|
|
|
doc_targets := wmacpi.1
|
|
|
|
|
|
|
|
ifdef BUILD_CLI
|
2014-08-18 22:56:32 +00:00
|
|
|
targets += wmacpi-cli
|
|
|
|
doc_targets += wmacpi-cli.1
|
2014-08-18 22:56:14 +00:00
|
|
|
endif
|
2014-08-18 22:56:11 +00:00
|
|
|
|
|
|
|
PREFIX := /usr/local
|
2011-03-25 18:45:13 +00:00
|
|
|
|
2014-08-18 22:56:10 +00:00
|
|
|
all: $(targets)
|
2011-03-25 18:45:13 +00:00
|
|
|
|
2014-08-18 22:56:10 +00:00
|
|
|
# build the list of object files
|
|
|
|
WMOBJ := $(patsubst %.c,%.o,$(filter %.c,$(WMSRC)))
|
|
|
|
|
|
|
|
# include per-file dependencies
|
2014-08-18 22:56:27 +00:00
|
|
|
-include $(WMOBJ:.o=.d)
|
2014-08-18 22:56:10 +00:00
|
|
|
|
2014-08-18 22:56:14 +00:00
|
|
|
wmacpi: $(WMOBJ)
|
2014-08-18 22:56:30 +00:00
|
|
|
$(CC) -o $@ $^ $(LDFLAGS)
|
2014-08-18 22:56:10 +00:00
|
|
|
|
2014-08-18 22:56:14 +00:00
|
|
|
# for the Debian package, we want to make building the command line tools
|
|
|
|
# optional. So, we hide all the necessary stuff here . . .
|
|
|
|
ifdef BUILD_CLI
|
2014-08-18 22:56:32 +00:00
|
|
|
CLSRC := wmacpi-cli.c libacpi.c
|
2014-08-18 22:56:14 +00:00
|
|
|
CLOBJ := $(patsubst %.c,%.o,$(filter %.c,$(CLSRC)))
|
2014-08-18 22:56:27 +00:00
|
|
|
-include $(CLOBJ:.o=.d)
|
2014-08-18 22:56:14 +00:00
|
|
|
|
2014-08-18 22:56:32 +00:00
|
|
|
wmacpi-cli: $(CLOBJ)
|
2014-08-18 22:56:11 +00:00
|
|
|
$(CC) $(LDFLAGS) -o $@ $^
|
2014-08-18 22:56:14 +00:00
|
|
|
endif
|
2014-08-18 22:56:10 +00:00
|
|
|
|
|
|
|
# build per-file dependencies - note that -MM may not be supported
|
|
|
|
# in gcc versions older than 2.95.4, but most likely is.
|
|
|
|
%.d: %.c
|
|
|
|
gcc -MM $(CFLAGS) $< > $@
|
2011-03-25 18:45:13 +00:00
|
|
|
|
|
|
|
clean:
|
2014-08-18 22:56:10 +00:00
|
|
|
rm -f TAGS *.o *~ trace *.out *.bb *.bbg
|
|
|
|
|
|
|
|
clean-all: clean
|
|
|
|
rm -f *.d $(targets)
|
|
|
|
|
2014-08-18 22:56:11 +00:00
|
|
|
install: $(targets)
|
|
|
|
install -d $(PREFIX)/bin/
|
|
|
|
install -pc $(targets) $(PREFIX)/bin/
|
2014-08-18 22:56:31 +00:00
|
|
|
install -d $(PREFIX)/share/man/man1/
|
|
|
|
install -pc $(doc_targets) $(PREFIX)/share/man/man1/
|
2014-08-18 22:56:11 +00:00
|
|
|
|
2014-08-18 22:56:10 +00:00
|
|
|
tags:
|
|
|
|
etags $(WMSRC) $(CLSRC) $(HEADERS)
|