wmail: handle allocation failures.
[dockapps.git] / wmacpi / Makefile
blob5c6f0aaa74243d356039fec00b4ed31a7a649052
1 # set options. pick one, acpi or apm. comment out the other one. don't
2 # uncomment both, bad things will happen :)
4 OPT := -O2
6 # uncomment this to build the command line acpi tool
7 BUILD_CLI = 1
9 # uncomment this to make wmacpi use less system colors (looks uglier too)
10 #OPT += -DLOW_COLOR
12 # debugging options (don't bother with these)
13 #OPT = -pg -g
15 CC := gcc
16 CFLAGS += $(OPT) -Wall -W -g -ansi
17 LDFLAGS += $(OPT) -lX11 -ldockapp
19 WMSRC := wmacpi.c libacpi.c
20 HEADERS := libacpi.h wmacpi.h
21 targets := wmacpi
22 doc_targets := wmacpi.1
24 ifdef BUILD_CLI
25 targets += wmacpi-cli
26 doc_targets += wmacpi-cli.1
27 endif
29 PREFIX := /usr/local
31 all: $(targets)
33 # build the list of object files
34 WMOBJ := $(patsubst %.c,%.o,$(filter %.c,$(WMSRC)))
36 # include per-file dependencies
37 -include $(WMOBJ:.o=.d)
39 wmacpi: $(WMOBJ)
40 $(CC) -o $@ $^ $(LDFLAGS)
42 # for the Debian package, we want to make building the command line tools
43 # optional. So, we hide all the necessary stuff here . . .
44 ifdef BUILD_CLI
45 CLSRC := wmacpi-cli.c libacpi.c
46 CLOBJ := $(patsubst %.c,%.o,$(filter %.c,$(CLSRC)))
47 -include $(CLOBJ:.o=.d)
49 wmacpi-cli: $(CLOBJ)
50 $(CC) $(LDFLAGS) -o $@ $^
51 endif
53 # build per-file dependencies - note that -MM may not be supported
54 # in gcc versions older than 2.95.4, but most likely is.
55 %.d: %.c
56 gcc -MM $(CFLAGS) $< > $@
58 clean:
59 rm -f TAGS *.o *~ trace *.out *.bb *.bbg
60 rm -f *.d $(targets)
62 clean-all: clean
64 install: $(targets)
65 install -d $(DESTDIR)$(PREFIX)/bin/
66 install -pc $(targets) $(DESTDIR)$(PREFIX)/bin/
67 install -d $(DESTDIR)$(PREFIX)/share/man/man1/
68 install -pc $(doc_targets) $(DESTDIR)$(PREFIX)/share/man/man1/
70 tags:
71 etags $(WMSRC) $(CLSRC) $(HEADERS)