1#***************************************************************************
2#                                  _   _ ____  _
3#  Project                     ___| | | |  _ \| |
4#                             / __| | | | |_) | |
5#                            | (__| |_| |  _ <| |___
6#                             \___|\___/|_| \_\_____|
7#
8# Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al.
9#
10# This software is licensed as described in the file COPYING, which
11# you should have received as part of this distribution. The terms
12# are also available at http://curl.haxx.se/docs/copyright.html.
13#
14# You may opt to use, copy, modify, merge, publish, distribute and/or sell
15# copies of the Software, and permit persons to whom the Software is
16# furnished to do so, under the terms of the COPYING file.
17#
18# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19# KIND, either express or implied.
20#
21###########################################################################
22
23AUTOMAKE_OPTIONS = foreign
24
25ACLOCAL_AMFLAGS = -I m4
26
27CMAKE_DIST = CMakeLists.txt CMake/CMakeConfigurableFile.in		\
28CMake/CurlCheckCSourceCompiles.cmake CMake/CurlCheckCSourceRuns.cmake	\
29CMake/CurlTests.c CMake/FindOpenSSL.cmake CMake/FindZLIB.cmake		\
30CMake/OtherTests.cmake CMake/Platforms/WindowsCache.cmake		\
31CMake/Utilities.cmake include/curl/curlbuild.h.cmake
32
33VC6LIBDSP = vs/vc6/lib/vc6libcurl.dsp
34VC6LIBDSPHEAD = vs/t/lib/vc6_libcurl_dsp.head
35VC6LIBDSPFOOT = vs/t/lib/vc6_libcurl_dsp.foot
36
37VC8LIBPRJ = vs/vc8/lib/vc8libcurl.vcproj
38VC8LIBPRJHEAD = vs/t/lib/vc8_libcurl_prj.head
39VC8LIBPRJFOOT = vs/t/lib/vc8_libcurl_prj.foot
40
41VC_DIST = \
42 vs/t/README \
43 $(VC6LIBDSP) $(VC6LIBDSPHEAD) $(VC6LIBDSPFOOT) \
44 $(VC8LIBPRJ) $(VC8LIBPRJHEAD) $(VC8LIBPRJFOOT) \
45 vs/vc6/vc6curl.dsw \
46 vs/vc6/lib/vc6libcurl.dsw \
47 vs/vc6/src/vc6curltool.dsw \
48 vs/vc6/src/vc6curltool.dsp
49
50VC6LIBDSP_DEPS = $(VC6LIBDSPHEAD) $(VC6LIBDSPFOOT) \
51 Makefile.am lib/Makefile.inc
52
53VC8LIBPRJ_DEPS = $(VC8LIBPRJHEAD) $(VC8LIBPRJFOOT) \
54 Makefile.am lib/Makefile.inc
55
56WINBUILD_DIST = winbuild/BUILD.WINDOWS.txt winbuild/gen_resp_file.bat	\
57 winbuild/MakefileBuild.vc winbuild/Makefile.vc				\
58 winbuild/Makefile.msvc.names
59
60EXTRA_DIST = CHANGES COPYING maketgz Makefile.dist curl-config.in	\
61 RELEASE-NOTES buildconf libcurl.pc.in MacOSX-Framework	\
62 $(CMAKE_DIST) $(VC_DIST) $(WINBUILD_DIST) lib/libcurl.vers.in
63
64CLEANFILES = $(VC6LIBDSP) $(VC8LIBPRJ)
65
66bin_SCRIPTS = curl-config
67
68SUBDIRS = lib src include
69DIST_SUBDIRS = $(SUBDIRS) tests packages docs
70
71pkgconfigdir = $(libdir)/pkgconfig
72pkgconfig_DATA = libcurl.pc
73
74# List of libcurl source files required to generate VC IDE dsp and prj files
75include lib/Makefile.inc
76
77WIN32SOURCES = $(CSOURCES)
78WIN32HEADERS = $(HHEADERS) config-win32.h
79
80dist-hook:
81	rm -rf $(top_builddir)/tests/log
82	find $(distdir) -name "*.dist" -exec rm {} \;
83	(distit=`find $(srcdir) -name "*.dist" | grep -v ./ares/`; \
84	for file in $$distit; do \
85	  strip=`echo $$file | sed -e s/^$(srcdir)// -e s/\.dist//`; \
86	  cp $$file $(distdir)$$strip; \
87	done)
88
89html:
90	cd docs; make html
91
92pdf:
93	cd docs; make pdf
94
95check: test examples
96
97if CROSSCOMPILING
98test-full: test
99test-torture: test
100
101test:
102	@echo "NOTICE: we can't run the tests when cross-compiling!"
103
104else
105
106test:
107	@(cd tests; $(MAKE) all quiet-test)
108
109test-full:
110	@(cd tests; $(MAKE) all full-test)
111
112test-torture:
113	@(cd tests; $(MAKE) all torture-test)
114
115test-am:
116	@(cd tests; $(MAKE) all am-test)
117
118endif
119
120examples:
121	@(cd docs/examples; $(MAKE) check)
122
123# This is a hook to have 'make clean' also clean up the docs and the tests
124# dir. The extra check for the Makefiles being present is necessary because
125# 'make distcheck' will make clean first in these directories _before_ it runs
126# this hook.
127clean-local:
128	@(if test -f tests/Makefile; then cd tests; $(MAKE) clean; fi)
129	@(if test -f docs/Makefile; then cd docs; $(MAKE) clean; fi)
130
131#
132# Build source and binary rpms. For rpm-3.0 and above, the ~/.rpmmacros
133# must contain the following line:
134# %_topdir /home/loic/local/rpm
135# and that /home/loic/local/rpm contains the directory SOURCES, BUILD etc.
136#
137# cd /home/loic/local/rpm ; mkdir -p SOURCES BUILD RPMS/i386 SPECS SRPMS
138#
139# If additional configure flags are needed to build the package, add the
140# following in ~/.rpmmacros
141# %configure CFLAGS="%{optflags}" ./configure %{_target_platform} --prefix=%{_prefix} ${AM_CONFIGFLAGS}
142# and run make rpm in the following way:
143# AM_CONFIGFLAGS='--with-uri=/home/users/loic/local/RedHat-6.2' make rpm
144#
145
146rpms:
147	$(MAKE) RPMDIST=curl rpm
148	$(MAKE) RPMDIST=curl-ssl rpm
149
150rpm:
151	RPM_TOPDIR=`rpm --showrc | $(PERL) -n -e 'print if(s/.*_topdir\s+(.*)/$$1/)'` ; \
152	cp $(srcdir)/packages/Linux/RPM/$(RPMDIST).spec $$RPM_TOPDIR/SPECS ; \
153	cp $(PACKAGE)-$(VERSION).tar.gz $$RPM_TOPDIR/SOURCES ; \
154	rpm -ba --clean --rmsource $$RPM_TOPDIR/SPECS/$(RPMDIST).spec ; \
155	mv $$RPM_TOPDIR/RPMS/i386/$(RPMDIST)-*.rpm . ; \
156	mv $$RPM_TOPDIR/SRPMS/$(RPMDIST)-*.src.rpm .
157
158#
159# Build a Solaris pkgadd format file
160# run 'make pkgadd' once you've done './configure' and 'make' to make a Solaris pkgadd format
161# file (which ends up back in this directory).
162# The pkgadd file is in 'pkgtrans' format, so to install on Solaris, do
163# pkgadd -d ./HAXXcurl-*
164#
165
166# gak - libtool requires an absoulte directory, hence the pwd below...
167pkgadd:
168	umask 022 ; \
169	make install DESTDIR=`/bin/pwd`/packages/Solaris/root ; \
170	cat COPYING > $(srcdir)/packages/Solaris/copyright ; \
171	cd $(srcdir)/packages/Solaris && $(MAKE) package
172
173#
174# Build a cygwin binary tarball installation file
175# resulting .tar.bz2 file will end up at packages/Win32/cygwin
176cygwinbin:
177	$(MAKE) -C packages/Win32/cygwin cygwinbin
178
179# We extend the standard install with a custom hook:
180install-data-hook:
181	cd include && $(MAKE) install
182	cd docs && $(MAKE) install
183
184# We extend the standard uninstall with a custom hook:
185uninstall-hook:
186	cd include && $(MAKE) uninstall
187	cd docs && $(MAKE) uninstall
188
189ca-bundle: lib/mk-ca-bundle.pl
190	@echo "generate a fresh ca-bundle.crt"
191	@perl $< -b -l -u lib/ca-bundle.crt
192
193ca-firefox: lib/firefox-db2pem.sh
194	@echo "generate a fresh ca-bundle.crt"
195	./lib/firefox-db2pem.sh lib/ca-bundle.crt
196
197checksrc:
198	cd lib && $(MAKE) checksrc
199	cd src && $(MAKE) checksrc
200
201.PHONY: vc6-ide
202
203vc6-ide:
204	$(MAKE) $(VC6LIBDSP)
205
206$(VC6LIBDSP): $(VC6LIBDSP_DEPS)
207	@(echo "generating '$(VC6LIBDSP)'"; \
208	\
209	for dir in 'vs' 'vs/vc6' 'vs/vc6/lib'; do \
210	  test -d "$$dir" || mkdir "$$dir" || exit 1; \
211	done; \
212	\
213	dir='..\..\..\lib\'; \
214	body='$(VC6LIBDSP)'.body; \
215	win32_srcs='$(WIN32SOURCES)'; \
216	win32_hdrs='$(WIN32HEADERS)'; \
217	sorted_srcs=`for file in $$win32_srcs; do echo $$file; done | sort`; \
218	sorted_hdrs=`for file in $$win32_hdrs; do echo $$file; done | sort`; \
219	\
220	echo "# Begin Group \"Source Files\""  > $$body; \
221	echo ""                               >> $$body; \
222	echo "# PROP Default_Filter \"\""     >> $$body; \
223	for file in $$sorted_srcs; do \
224	  echo "# Begin Source File"          >> $$body; \
225	  echo ""                             >> $$body; \
226	  echo "SOURCE="$$dir$$file           >> $$body; \
227	  echo "# End Source File"            >> $$body; \
228	done; \
229	echo "# End Group"                    >> $$body; \
230	echo "# Begin Group \"Header Files\"" >> $$body; \
231	echo ""                               >> $$body; \
232	echo "# PROP Default_Filter \"\""     >> $$body; \
233	for file in $$sorted_hdrs; do \
234	  echo "# Begin Source File"          >> $$body; \
235	  echo ""                             >> $$body; \
236	  echo "SOURCE="$$dir$$file           >> $$body; \
237	  echo "# End Source File"            >> $$body; \
238	done; \
239	echo "# End Group"                    >> $$body; \
240	\
241	awk '{ printf("%s\r\n", $$0); }' \
242	  $(srcdir)/$(VC6LIBDSPHEAD) $$body $(srcdir)/$(VC6LIBDSPFOOT) \
243	  > $(VC6LIBDSP) || { rm -f $$body; exit 1; }; \
244	\
245	rm -f $$body)
246
247.PHONY: vc8-ide
248
249vc8-ide:
250	$(MAKE) $(VC8LIBPRJ)
251
252$(VC8LIBPRJ): $(VC8LIBPRJ_DEPS)
253	@(echo "generating '$(VC8LIBPRJ)'"; \
254	\
255	for dir in 'vs' 'vs/vc8' 'vs/vc8/lib'; do \
256	  test -d "$$dir" || mkdir "$$dir" || exit 1; \
257	done; \
258	\
259	dir='..\..\..\lib\'; \
260	body='$(VC8LIBPRJ)'.body; \
261	win32_srcs='$(WIN32SOURCES)'; \
262	win32_hdrs='$(WIN32HEADERS)'; \
263	sorted_srcs=`for file in $$win32_srcs; do echo $$file; done | sort`; \
264	sorted_hdrs=`for file in $$win32_hdrs; do echo $$file; done | sort`; \
265	\
266	echo "%tab%%tab%<Filter Name=\"Source Files\">"  > $$body; \
267	for file in $$sorted_srcs; do \
268	  echo "%tab%%tab%%tab%<File RelativePath=\""$$dir$$file"\"></File>" >> $$body; \
269	done; \
270	echo "%tab%%tab%</Filter>"                      >> $$body; \
271	echo "%tab%%tab%<Filter Name=\"Header Files\">" >> $$body; \
272	for file in $$sorted_hdrs; do \
273	  echo "%tab%%tab%%tab%<File RelativePath=\""$$dir$$file"\"></File>" >> $$body; \
274	done; \
275	echo "%tab%%tab%</Filter>"                      >> $$body; \
276	\
277	awk '{ gsub(/%tab%/, "\t"); printf("%s\r\n", $$0); }' \
278	  $(srcdir)/$(VC8LIBPRJHEAD) $$body $(srcdir)/$(VC8LIBPRJFOOT) \
279	  > $(VC8LIBPRJ) || { rm -f $$body; exit 1; }; \
280	\
281	rm -f $$body)
282
283