]> git.proxmox.com Git - pve-cluster.git/blob - data/PVE/Makefile
move datacenter.cfg to own file
[pve-cluster.git] / data / PVE / Makefile
1 DESTDIR=
2 PERL5DIR=${DESTDIR}/usr/share/perl5
3 PVEDIR=${PERL5DIR}/PVE
4 MAN=${DESTDIR}/usr/share/man
5 BASHCOMPLETION=${DESTDIR}/usr/share/bash-completion/completions
6 ZSHCOMPLETION=${DESTDIR}/usr/share/zsh/vendor-completions
7
8 PERL_VENDORARCH=$(shell perl -MConfig -e 'print $$Config{vendorarch};')
9 PVE_VENDORARCH=${DESTDIR}/${PERL_VENDORARCH}/auto/PVE/IPCC
10
11 PERL_DOC_INC_DIRS:=..
12
13 SUBDIRS=Cluster CLI API2
14 SOURCES=IPCC.pm Cluster.pm Corosync.pm RRD.pm DataCenterConfig.pm
15
16 all:
17
18 .PHONY: install
19 install: pvecm ${SOURCES} IPCC.so pvecm.1 pvecm.bash-completion pvecm.zsh-completion datacenter.cfg.5
20 install -D -m 0755 pvecm ${DESTDIR}/usr/bin/pvecm
21 install -d ${PVEDIR}
22 for f in ${SOURCES}; do install -m 0664 $$f ${PVEDIR}/$$f; done
23 install -D IPCC.so ${PVE_VENDORARCH}/IPCC.so
24 install -D pvecm.1 ${MAN}/man1/pvecm.1
25 install -D datacenter.cfg.5 ${MAN}/man5/datacenter.cfg.5
26 install -m 0644 -D pvecm.bash-completion ${BASHCOMPLETION}/pvecm
27 install -m 0644 -D pvecm.zsh-completion ${ZSHCOMPLETION}/_pvecm
28 for d in ${SUBDIRS}; do $(MAKE) -C $$d install; done
29
30 %.bash-completion:
31 perl ${PERL_DOC_INC} -T -e "use PVE::CLI::$*; PVE::CLI::$*->generate_bash_completions();" >$@.tmp
32 mv $@.tmp $@
33
34 %.zsh-completion:
35 perl ${PERL_DOC_INC} -T -e "use PVE::CLI::$*; PVE::CLI::$*->generate_zsh_completions();" >$@.tmp
36 mv $@.tmp $@
37
38 Cluster/IPCConst.pm:
39 $(MAKE) -C Cluster IPCConst.pm
40
41 check: IPCC.so Cluster/IPCConst.pm
42 perl ${PERL_DOC_INC} -T -e "use PVE::CLI::pvecm; PVE::CLI::pvecm->verify_api();"
43
44 CC=gcc
45 CFLAGS += -fPIC -Wl,-z,relro -Wall -Werror -Wno-strict-aliasing -g -O2 -shared
46 CFLAGS += $(shell perl -MExtUtils::Embed -e perl_inc)
47 LDFLAGS = $(shell pkg-config --libs libqb)
48
49 .c.o:
50 $(CC) $(CFLAGS) -c -o $@ $<
51
52 IPCC.c: IPCC.xs ppport.h
53 xsubpp -noversioncheck IPCC.xs > IPCC.xsc
54 mv IPCC.xsc IPCC.c
55
56 IPCC.so: IPCC.o
57 $(CC) ${CFLAGS} ${LDFLAGS} -shared -o $@ $<
58
59 export NOVIEW=1
60 -include /usr/share/pve-doc-generator/pve-doc-generator.mk
61
62 .PHONY: clean
63 clean:
64 $(MAKE) cleanup-docgen
65 rm -f IPCC.so IPCC.o IPCC.c pvecm.bash-completion pvecm.zsh-completion
66 for d in ${SUBDIRS}; do $(MAKE) -C $$d clean; done