properly credit frogs
[systembsd.git] / Makefile
CommitLineData
496f5d66 1.PHONY: all
9fd3f859 2
5efd4ba3 3CC?= /usr/bin/cc
aa4e15df 4CFLAGS= -Wall -Wextra -Werror -std=c89
5efd4ba3
AJ
5
6DEBUG= 1
7.ifdef DEBUG
8CFLAGS+= -O0 -g
9.endif
10
11SANITY= 1
12.ifdef SANITY
13CFLAGS+= -Wno-unused-variable -Wno-unused-parameter # -Wno-comment
14.endif
15
16PREFIX?= /usr/local
769aa60c 17BINDIR= $(PREFIX)/libexec/systemd
5efd4ba3
AJ
18SYSCONFDIR?= /etc
19
20INSTALL_PROGRAM= install -c -s -o root -g bin -m 555
21INSTALL_PROGRAM_DIR= install -d -o root -g bin -m 755
22INSTALL_DATA= install -c -o root -g bin -m 444
23INSTALL_DATA_DIR= install -d -o root -g bin -m 755
24
25LINKGN= bin/obj/hostnamed-gen.o \
26 bin/obj/localed-gen.o \
27 bin/obj/timedated-gen.o \
28 bin/obj/logind-gen.o
29
30LINKHN= bin/systemd-hostnamed \
31 bin/systemd-localed \
32 bin/systemd-timedated \
33 bin/systemd-logind
34
35DBUS_SERVICES= org.freedesktop.hostname1.service \
36 org.freedesktop.locale1.service \
5efd4ba3 37 org.freedesktop.timedate1.service
9fd3f859 38
904d744d 39GLIBEF=`pkg-config --cflags --libs glib-2.0 gobject-2.0 gio-2.0 gio-unix-2.0 polkit-agent-1`
40GLIBOF=`pkg-config --cflags glib-2.0 gobject-2.0 gio-2.0 gio-unix-2.0 polkit-agent-1`
32a2d8e2 41
5efd4ba3
AJ
42SRCDIR= src
43CONFDIR= conf
44POLICYDIR= $(CONFDIR)/sysbus-policy
45ISPECTDIR= $(CONFDIR)/introspect-xml
46SERVICEFDIR= $(CONFDIR)/service-files
87847f07 47POLKITDIR= $(CONFDIR)/polkit-policy
eb9f042e 48
5efd4ba3 49INTFDIR= $(SRCDIR)/interfaces
eb9f042e 50
87847f07
AJ
51DBUS_POLICYDIR= $(SYSCONFDIR)/dbus-1/system.d
52DBUS_CONFIGDIR= $(PREFIX)/share/dbus-1/system-services
53POLKIT_POLICYDIR= $(PREFIX)/share/polkit-1/actions
b63d30e3 54
5efd4ba3
AJ
55INVOKE_GENFILE_SCRIPT= \
56 ./scripts/gen-gdbus-interfaces.sh
9ce45670 57
d89a2b87 58all: build
59
5efd4ba3 60build: _build_interface_objs
d89a2b87 61
62clean:
9ce45670 63 find ./bin -type f -exec rm {} \;
64 find $(INTFDIR)/ -type f -iname *-gen.* -exec rm {} \;
d89a2b87 65
7f0a0212 66install: _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)/