Debian Codegraph @

GNUmakefile

raw
1 # $MirOS: contrib/hosted/tg/code/kwalletcli/GNUmakefile,v 1.16 2020/11/19 21:37:10 tg Exp $
2 #-
3 # Copyright © 2009, 2011, 2016, 2020
4 # mirabilos <[email protected]>
5 #
6 # Provided that these terms and disclaimer and all copyright notices
7 # are retained or reproduced in an accompanying document, permission
8 # is granted to deal in this work without restriction, including un‐
9 # limited rights to use, publicly perform, distribute, sell, modify,
10 # merge, give away, or sublicence.
11 #
12 # This work is provided “AS IS” and WITHOUT WARRANTY of any kind, to
13 # the utmost extent permitted by applicable law, neither express nor
14 # implied; without malicious intent or gross negligence. In no event
15 # may a licensor, author or contributor be held liable for indirect,
16 # direct, other damage, loss, or other issues arising in any way out
17 # of dealing in the work, even if advised of the possibility of such
18 # damage or existence of a defect, except proven that it results out
19 # of said person’s immediate fault when using the work as intended.
20 #-
21 # Note: Qt5 builds may require fPIC in CFLAGS, CXXFLAGS, and LDFLAGS
22 # (*not* CPPFLAGS!) to successfully build; PIE does not work.
23
24 SCRIPTS= kwalletaskpass kwalletcli_getpin pinentry-kwallet
25 BINDIR?= /usr/bin
26 MANDIR?= /usr/share/man/man
27
28 BINMODE?= 755
29 MANMODE?= 444
30 INSTALL_STRIP?= -s
31
32 PROG= kwalletcli
33 SRCS= charconv.c main.c
34 OBJS= charconv.o main.o
35
36 PKG_CONFIG?= pkg-config
37
38 KDE_VER:= 3
39 ifeq (${KDE_VER},3)
40 KDE_INCS?= -I/usr/include/qt3 -I/usr/include/kde
41 SRCS+= kwif3.cc
42 OBJS+= kwif3.o
43 LDADD+= -lkwalletclient -lkdecore -lqt-mt
44 else
45 ifeq (${KDE_VER},4)
46 KDE_INCS?= -I/usr/include/qt4 -I/usr/include/qt4/QtCore
47 SRCS+= kwif4.cc
48 OBJS+= kwif4.o
49 LDADD+= -lkdeui -lkdecore -lQtCore
50 else
51 ifeq (${KDE_VER},5)
52 KDE_INCS?= $(shell ${PKG_CONFIG} --cflags Qt5Gui) \
53 -I/usr/include/KF5/KI18n \
54 -I/usr/include/KF5/KCoreAddons \
55 -I/usr/include/KF5/KWallet
56 SRCS+= kwif5.cc
57 OBJS+= kwif5.o
58 LDADD+= -lKF5CoreAddons -lKF5Wallet -lKF5I18n -lQt5Core -lQt5Widgets
59 else
60 $(error unknown KDE_VER)
61 endif
62 endif
63 endif
64
65 CPPFLAGS+= ${KDE_INCS} -D_GNU_SOURCE
66
67 CC?= gcc
68 CXX?= g++
69
70 CFLAGS?= -O2
71 CXXFLAGS?= ${CFLAGS}
72
73 all: ${PROG}
74
75 install:
76 install -c ${INSTALL_STRIP} -m ${BINMODE} \
77 ${PROG} ${DESTDIR}${BINDIR}/
78 install -c -m ${BINMODE} \
79 ${SCRIPTS} ${DESTDIR}${BINDIR}/
80 for f in ${PROG} ${SCRIPTS}; do \
81 install -c -m ${MANMODE} $$f.1 ${DESTDIR}${MANDIR}1/; \
82 done
83
84 uninstall:
85 for f in ${PROG} ${SCRIPTS}; do \
86 rm -f ${DESTDIR}${BINDIR}/$$f ${DESTDIR}${MANDIR}1/$$f.1; \
87 done
88
89 clean:
90 -rm -f ${OBJS} ${PROG}
91
92 ${PROG}: ${OBJS} ${DPADD}
93 ${CXX} ${CXXFLAGS} ${LDFLAGS} -o $@ ${OBJS} ${LDADD}
94
95 .c.o:
96 ${CC} ${CPPFLAGS} ${CFLAGS} -c -o $@ $<
97
98 .cc.o:
99 ${CXX} ${CPPFLAGS} ${CXXFLAGS} -c -o $@ $<