Rename and split the README file
[idra/gss-ntlmssp.git] / Makefile.am
1 SUBDIRS =
2 #SUBDIRS += po
3
4 if HAVE_MANPAGES
5 SUBDIRS += man
6 endif
7 if HAVE_NLS
8 SUBDIRS += po
9 endif
10
11 # Some old versions of automake don't define builddir
12 builddir ?= .
13
14 DOXYGEN = @DOXYGEN@
15
16 DISTSETUPOPTS =
17 if HAVE_DEBIAN
18 DISTSETUPOPTS += --install-layout=deb
19 endif
20
21 gssconfdir = $(sysconfdir)/gss
22 gssntlmsspdir = $(libdir)/gssntlmssp
23 localedir = @localedir@
24
25 pkgconfigdir = $(libdir)/pkgconfig
26
27 AM_CFLAGS =
28 if WANT_AUX_INFO
29     AM_CFLAGS += -aux-info $@.X
30 endif
31 if HAVE_GCC
32     AM_CFLAGS += -Wall -Wshadow -Wstrict-prototypes -Wpointer-arith \
33                  -Wcast-qual -Wcast-align -Wwrite-strings \
34                  -Werror-implicit-function-declaration \
35                  -fno-strict-aliasing
36 endif
37 if HAVE_NLS
38     AM_CFLAGS += -DLOCALEDIR="\"$(localedir)\""
39 endif
40
41 dist_pkgconfig_DATA =
42
43 ACLOCAL_AMFLAGS = -I m4 -I .
44
45 check_PROGRAMS = \
46     ntlmssptest
47
48 gssntlmssp_LTLIBRARIES = \
49     gssntlmssp.la
50
51 dist_noinst_SCRIPTS = tests/scripts/dlopen.sh
52
53 dist_noinst_DATA =
54
55 ###############################
56 # Global compilation settings #
57 ###############################
58
59 AM_CPPFLAGS = \
60     -Wall \
61     -Iinclude \
62     -I.. \
63     -I$(srcdir)/include \
64     -I$(srcdir) \
65     -Iinclude \
66     -I. \
67     -DLIBDIR=\"$(libdir)\" \
68     -DVARDIR=\"$(localstatedir)\" \
69     -DSHLIBEXT=\"$(SHLIBEXT)\" \
70     -DSYSCONFDIR=\"$(sysconfdir)\" \
71     -DLOCALEDIR=\"$(localedir)\"
72
73 #EXTRA_DIST = build/config.rpath
74
75 GN_MECHGLUE_LIBS = $(GSSAPI_LIBS) $(CRYPTO_LIBS) $(WBC_LIBS)
76
77 GN_MECHGLUE_OBJ = \
78     src/crypto.c \
79     src/ntlm_crypto.c \
80     src/ntlm.c \
81     src/debug.c \
82     src/gss_err.c \
83     src/gss_spi.c \
84     src/gss_names.c \
85     src/gss_creds.c \
86     src/gss_sec_ctx.c \
87     src/gss_signseal.c \
88     src/gss_serialize.c \
89     src/external.c \
90     src/gss_auth.c \
91     src/gss_ntlmssp.c
92
93 if BUILD_WBCLIENT
94    GN_MECHGLUE_OBJ += src/winbind.c
95 endif
96
97 dist_noinst_HEADERS = \
98     src/crypto.h \
99     src/ntlm_common.h \
100     src/ntlm.h \
101     src/debug.h \
102     src/gss_ntlmssp.h \
103     src/gss_ntlmssp_winbind.h
104
105 gssapidir = $(includedir)/gssapi
106 dist_gssapi_HEADERS = \
107     src/gssapi_ntlmssp.h
108
109 POTFILES = src/gss_err.c
110
111 ####################
112 # Program Binaries #
113 ####################
114
115 gssntlmssp_la_SOURCES = \
116     $(GN_MECHGLUE_OBJ)
117 gssntlmssp_la_CFLAGS = \
118     $(WBC_CFLAGS) \
119     $(AM_CFLAGS)
120 gssntlmssp_la_LDFLAGS = \
121     $(GN_MECHGLUE_LIBS) \
122     -export-symbols-regex '^gss(spi|)_' \
123     -avoid-version \
124     -module
125
126 ntlmssptest_SOURCES = \
127     $(GN_MECHGLUE_OBJ) \
128     tests/ntlmssptest.c
129 ntlmssptest_CFLAGS = \
130     $(WBC_CFLAGS) \
131     $(AM_CFLAGS)
132 ntlmssptest_LDADD = \
133     $(WBC_LIBS) \
134     $(GSSAPI_LIBS) \
135     $(CRYPTO_LIBS)
136
137 dist_noinst_DATA += \
138     m4
139
140 noinst_PROGRAMS = ntlmssptest
141
142 ################
143 # TRANSLATIONS #
144 ################
145 update-po:
146 if HAVE_MANPAGES
147         $(MAKE) -C man update-po
148 endif
149 #       $(MAKE) -C po update-po
150
151 #######################
152 # Installation Extras #
153 #######################
154
155 installgssntlmsspdirs::
156         mkdir -p \
157     $(DESTDIR)$(libdir)/gssntlmssp \
158     $(DESTDIR)$(mandir)
159
160 if HAVE_DOXYGEN
161 docs:
162         $(DOXYGEN) doxy.config
163 else
164 docs:
165         @echo "Doxygen not installed, cannot generate documentation"
166         @exit 1
167 endif
168
169 install-exec-hook: installgssntlmsspdirs
170         mkdir -p doc $(DESTDIR)/$(docdir); cp -a doc $(DESTDIR)/$(docdir)/
171
172 clean-local:
173         rm -Rf doc
174
175 CLEANFILES = *.X */*.X */*/*.X
176
177 tests: all $(check_PROGRAMS)
178
179 # RPM-related tasks
180
181 RPMBUILD ?= $(PWD)/rpmbuild
182
183 dist_noinst_DATA += \
184     m4 \
185     contrib/gssntlmssp.spec.in \
186     BUILD.txt \
187     COPYING
188
189 rpmroot:
190         mkdir -p $(RPMBUILD)/BUILD
191         mkdir -p $(RPMBUILD)/RPMS
192         mkdir -p $(RPMBUILD)/SOURCES
193         mkdir -p $(RPMBUILD)/SPECS
194         mkdir -p $(RPMBUILD)/SRPMS
195
196 po/$(PACKAGE).pot: $(POTFILES)
197         @echo "Regenerating $@" ; rm -f $@ && \
198         xgettext --directory=$(top_srcdir) --from-code=UTF-8 \
199           --sort-by-file --add-comments --keyword=_ --keyword=N_ \
200           --package-name="@PACKAGE@" --package-version="@VERSION@" \
201           --msgid-bugs-address="simo@samba.org" \
202           -o $@ $(POTFILES)
203
204 rpms: dist-gzip rpmroot
205         cp $(builddir)/contrib/gssntlmssp.spec $(RPMBUILD)/SPECS
206         cp $(distdir).tar.gz $(RPMBUILD)/SOURCES
207         cd $(RPMBUILD); \
208         rpmbuild --define "_topdir $(RPMBUILD)" -ba SPECS/gssntlmssp.spec
209
210 if GIT_CHECKOUT
211 prerelease-rpms:
212         cp $(srcdir)/version.m4 $(srcdir)/version.m4.orig
213         sed -e "s/m4_define(\[PRERELEASE_VERSION_NUMBER\], \[.*\])/m4_define(\[PRERELEASE_VERSION_NUMBER\], \[.`date +%Y%m%d.%H%M`.git`git log -1 --pretty=format:%h`\])/" < $(srcdir)/version.m4.orig > $(srcdir)/version.m4
214         $(MAKE) rpms
215         mv $(srcdir)/version.m4.orig $(srcdir)/version.m4
216 endif
217
218 # make srpms will use the old digest algorithm to be compatible
219 # with RHEL5
220 srpm: dist-gzip rpmroot
221         cp $(builddir)/contrib/gssntlmssp.spec $(RPMBUILD)/SPECS
222         cp $(distdir).tar.gz $(RPMBUILD)/SOURCES
223         cd $(RPMBUILD); \
224         rpmbuild --define "_topdir $(RPMBUILD)" \
225                  --define _source_filedigest_algorithm=1 \
226                  -bs SPECS/gssntlmssp.spec
227
228 if GIT_CHECKOUT
229 prerelease-srpm:
230         cp $(srcdir)/version.m4 $(srcdir)/version.m4.orig
231         sed -e "s/m4_define(\[PRERELEASE_VERSION_NUMBER\], \[.*\])/m4_define(\[PRERELEASE_VERSION_NUMBER\], \[.`date +%Y%m%d.%H%M`.git`git log -1 --pretty=format:%h`\])/" < $(srcdir)/version.m4.orig > $(srcdir)/version.m4
232         $(MAKE) srpm
233         mv $(srcdir)/version.m4.orig $(srcdir)/version.m4
234 endif
235
236 ####################
237 # Testing          #
238 ####################
239
240 test_gssntlmssp:
241         TMPDIR=tests/scripts/ ./tests/scripts/dlopen.sh ./.libs/gssntlmssp.so || exit 1