Commit | Line | Data |
---|---|---|
496f5d66 | 1 | .PHONY: all |
9fd3f859 | 2 | |
5efd4ba3 | 3 | CC?= /usr/bin/cc |
aa4e15df | 4 | CFLAGS= -Wall -Wextra -Werror -std=c89 |
5efd4ba3 AJ |
5 | |
6 | DEBUG= 1 | |
7 | .ifdef DEBUG | |
8 | CFLAGS+= -O0 -g | |
9 | .endif | |
10 | ||
11 | SANITY= 1 | |
12 | .ifdef SANITY | |
13 | CFLAGS+= -Wno-unused-variable -Wno-unused-parameter # -Wno-comment | |
14 | .endif | |
15 | ||
16 | PREFIX?= /usr/local | |
769aa60c | 17 | BINDIR= $(PREFIX)/libexec/systemd |
5efd4ba3 AJ |
18 | SYSCONFDIR?= /etc |
19 | ||
20 | INSTALL_PROGRAM= install -c -s -o root -g bin -m 555 | |
21 | INSTALL_PROGRAM_DIR= install -d -o root -g bin -m 755 | |
22 | INSTALL_DATA= install -c -o root -g bin -m 444 | |
23 | INSTALL_DATA_DIR= install -d -o root -g bin -m 755 | |
24 | ||
25 | LINKGN= bin/obj/hostnamed-gen.o \ | |
26 | bin/obj/localed-gen.o \ | |
27 | bin/obj/timedated-gen.o \ | |
28 | bin/obj/logind-gen.o | |
29 | ||
30 | LINKHN= bin/systemd-hostnamed \ | |
31 | bin/systemd-localed \ | |
32 | bin/systemd-timedated \ | |
33 | bin/systemd-logind | |
34 | ||
35 | DBUS_SERVICES= org.freedesktop.hostname1.service \ | |
36 | org.freedesktop.locale1.service \ | |
5efd4ba3 | 37 | org.freedesktop.timedate1.service |
9fd3f859 | 38 | |
904d744d | 39 | GLIBEF=`pkg-config --cflags --libs glib-2.0 gobject-2.0 gio-2.0 gio-unix-2.0 polkit-agent-1` |
40 | GLIBOF=`pkg-config --cflags glib-2.0 gobject-2.0 gio-2.0 gio-unix-2.0 polkit-agent-1` | |
32a2d8e2 | 41 | |
5efd4ba3 AJ |
42 | SRCDIR= src |
43 | CONFDIR= conf | |
44 | POLICYDIR= $(CONFDIR)/sysbus-policy | |
45 | ISPECTDIR= $(CONFDIR)/introspect-xml | |
46 | SERVICEFDIR= $(CONFDIR)/service-files | |
87847f07 | 47 | POLKITDIR= $(CONFDIR)/polkit-policy |
eb9f042e | 48 | |
5efd4ba3 | 49 | INTFDIR= $(SRCDIR)/interfaces |
eb9f042e | 50 | |
87847f07 AJ |
51 | DBUS_POLICYDIR= $(SYSCONFDIR)/dbus-1/system.d |
52 | DBUS_CONFIGDIR= $(PREFIX)/share/dbus-1/system-services | |
53 | POLKIT_POLICYDIR= $(PREFIX)/share/polkit-1/actions | |
b63d30e3 | 54 | |
5efd4ba3 AJ |
55 | INVOKE_GENFILE_SCRIPT= \ |
56 | ./scripts/gen-gdbus-interfaces.sh | |
9ce45670 | 57 | |
d89a2b87 | 58 | all: build |
59 | ||
5efd4ba3 | 60 | build: _build_interface_objs |
d89a2b87 | 61 | |
62 | clean: | |
9ce45670 | 63 | find ./bin -type f -exec rm {} \; |
64 | find $(INTFDIR)/ -type f -iname *-gen.* -exec rm {} \; | |
d89a2b87 | 65 | |
7f0a0212 | 66 | install: _install_conf _install_interface_binaries |
d89a2b87 | 67 | |
d5200a78 | 68 | _build_interface_objs: _build_genfile_objs |
483e90b7 | 69 | $(CC) -o bin/systemd-hostnamed $(CFLAGS) $(GLIBEF) $(INTFDIR)/hostnamed/hostnamed.c bin/obj/hostnamed-gen.o bin/obj/polkit-auth.o |
70 | $(CC) -o bin/systemd-localed $(CFLAGS) $(GLIBEF) $(INTFDIR)/localed/localed.c bin/obj/localed-gen.o bin/obj/polkit-auth.o | |
71 | $(CC) -o bin/systemd-timedated $(CFLAGS) $(GLIBEF) $(INTFDIR)/timedated/timedated.c bin/obj/timedated-gen.o bin/obj/polkit-auth.o | |
72 | $(CC) -o bin/systemd-logind $(CFLAGS) $(GLIBEF) $(INTFDIR)/logind/logind.c bin/obj/logind-gen.o bin/obj/polkit-auth.o | |
d5200a78 | 73 | |
483e90b7 | 74 | _build_genfile_objs: _generate_genfiles _build_auth_obj |
5efd4ba3 AJ |
75 | $(CC) -o bin/obj/hostnamed-gen.o $(CFLAGS) $(GLIBOF) -c $(INTFDIR)/hostnamed/hostnamed-gen.c |
76 | $(CC) -o bin/obj/localed-gen.o $(CFLAGS) $(GLIBOF) -c $(INTFDIR)/localed/localed-gen.c | |
77 | $(CC) -o bin/obj/timedated-gen.o $(CFLAGS) $(GLIBOF) -c $(INTFDIR)/timedated/timedated-gen.c | |
78 | $(CC) -o bin/obj/logind-gen.o $(CFLAGS) $(GLIBOF) -c $(INTFDIR)/logind/logind-gen.c | |
d5200a78 | 79 | |
483e90b7 | 80 | _build_auth_obj: |
ed4cf3c8 | 81 | $(CC) -o bin/obj/polkit-auth.o $(CFLAGS) $(GLIBOF) -c $(SRCDIR)/util.c |
483e90b7 | 82 | |
9ce45670 | 83 | _generate_genfiles: |
84 | $(INVOKE_GENFILE_SCRIPT) hostnamed | |
85 | $(INVOKE_GENFILE_SCRIPT) localed | |
86 | $(INVOKE_GENFILE_SCRIPT) timedated | |
87 | $(INVOKE_GENFILE_SCRIPT) logind | |
88 | ||
5efd4ba3 AJ |
89 | _generate_servicefiles: |
90 | for svc in $(DBUS_SERVICES); do \ | |
91 | sed -e 's,@BINDIR@,${BINDIR},' $(SERVICEFDIR)/$$svc.in > $(SERVICEFDIR)/$$svc; \ | |
92 | done | |
93 | ||
94 | _install_conf: _generate_servicefiles | |
95 | ${INSTALL_DATA_DIR} $(DESTDIR)$(DBUS_POLICYDIR) | |
96 | ${INSTALL_DATA_DIR} $(DESTDIR)$(DBUS_CONFIGDIR) | |
87847f07 | 97 | ${INSTALL_DATA_DIR} $(DESTDIR)$(POLKIT_POLICYDIR) |
aa4868db | 98 | ${INSTALL_DATA} $(CONFDIR)/machine-info $(DESTDIR)$(SYSCONFDIR)/ |
5efd4ba3 AJ |
99 | ${INSTALL_DATA} $(POLICYDIR)/*-dbus.conf $(DESTDIR)$(DBUS_POLICYDIR)/ |
100 | ${INSTALL_DATA} $(SERVICEFDIR)/*.service $(DESTDIR)$(DBUS_CONFIGDIR)/ | |
89048d5b | 101 | ${INSTALL_DATA} $(POLKITDIR)/*.policy $(DESTDIR)$(POLKIT_POLICYDIR)/ |
7f0a0212 | 102 | |
d5200a78 | 103 | _install_interface_binaries: $(LINKHN) |
5efd4ba3 AJ |
104 | ${INSTALL_PROGRAM_DIR} $(DESTDIR)$(BINDIR) |
105 | ${INSTALL_PROGRAM} bin/systemd-* $(DESTDIR)$(BINDIR)/ |