1 # Makefile for ACPI daemon
3 # update these numbers for new releases
11 BINDIR = $(PREFIX)/bin
12 SBINDIR = $(PREFIX)/sbin
13 MANDIR = $(PREFIX)/share/man
14 DOCDIR = $(PREFIX)/share/doc/acpid
17 BIN_PROGS = acpi_listen
18 PROGS = $(SBIN_PROGS) $(BIN_PROGS)
20 acpid_SRCS = acpid.c acpi_ids.c connection_list.c event.c input_layer.c \
21 inotify_handler.c libnetlink.c log.c netlink.c proc.c sock.c ud_socket.c
22 acpid_OBJS = $(acpid_SRCS:.c=.o)
24 acpi_listen_SRCS = acpi_listen.c log.c ud_socket.c
25 acpi_listen_OBJS = $(acpi_listen_SRCS:.c=.o)
27 all_SRCS = $(acpid_SRCS) $(acpi_listen_SRCS)
29 MAN8 = acpid.8 acpi_listen.8
30 MAN8GZ = $(MAN8:.8=.8.gz)
32 DOCS = COPYING Changelog README TESTPLAN TODO
34 CFLAGS = -W -Wall -Werror -Wundef -Wshadow -D_GNU_SOURCE $(OPT) \
35 -fno-strict-aliasing -g $(DEFS)
36 DEFS = -DVERSION="\"$(VERSION)\""
42 acpi_listen: $(acpi_listen_OBJS)
45 for a in $^; do gzip -f -9 -c $$a > $$a.gz; done
48 mkdir -p $(DESTDIR)/$(DOCDIR)
49 for a in $(DOCS); do install -m 0644 $$a $(DESTDIR)/$(DOCDIR) ; done
50 cp -a samples $(DESTDIR)/$(DOCDIR)
52 install: $(PROGS) man install_docs
53 mkdir -p $(DESTDIR)/$(SBINDIR)
54 mkdir -p $(DESTDIR)/$(BINDIR)
55 install -m 0750 acpid $(DESTDIR)/$(SBINDIR)
56 install -m 0755 acpi_listen $(DESTDIR)/$(BINDIR)
57 mkdir -p $(DESTDIR)/$(MANDIR)/man8
58 install -m 0644 $(MAN8GZ) $(DESTDIR)/$(MANDIR)/man8
59 # You might want to run mandb(8) after install in case your system uses it.
62 DISTNAME=acpid-$(VERSION)
63 FULLTMP = $(DISTTMP)/$(DISTNAME)
68 find $(FULLTMP) -type d -name CVS | xargs rm -rf
69 make -C $(FULLTMP) clean
70 make -C $(FULLTMP)/kacpimon clean
71 rm -f $(FULLTMP)/cscope.out
72 rm -f $(FULLTMP)/*anjuta*
73 find $(FULLTMP) -name '*~' | xargs rm -f
74 # Get rid of previous dist
75 rm -f $(FULLTMP)/$(DISTNAME).tar.gz
76 tar -C $(DISTTMP) -zcvf $(DISTNAME).tar.gz $(DISTNAME)
80 $(RM) $(PROGS) $(MAN8GZ) *.o .depend
88 OBJ=$$(echo $$f | sed 's/\.cp*$$/.o/'); \
89 $(CPP) $(PP_INCLUDES) -MM $$f -MT $$OBJ; \
92 # NOTE: 'sinclude' is "silent-include". This suppresses a warning if
93 # .depend does not exist. Since Makefile includes this file, and this
94 # file includes .depend, .depend is itself "a makefile" and Makefile is
95 # dependent on it. Any makefile for which there is a rule (as above for
96 # .depend) will be evaluated before anything else. If the rule executes
97 # and the makefile is updated, make will reload the original Makefile and
100 # This means that the .depend rule will always be checked first. If
101 # .depend gets rebuilt, then the dependencies we have already sincluded
102 # must have been stale. Make starts over, the old dependencies are
103 # tossed, and the new dependencies are sincluded.
105 # So why use 'sinclude' instead of 'include'? We want to ALWAYS make
106 # Makefile depend on .depend, even if .depend doesn't exist yet. But we
107 # don't want that pesky warning.