test: offer "automake" output and check for perl better
[platform/upstream/curl.git] / Makefile.am
1 #***************************************************************************
2 #                                  _   _ ____  _
3 #  Project                     ___| | | |  _ \| |
4 #                             / __| | | | |_) | |
5 #                            | (__| |_| |  _ <| |___
6 #                             \___|\___/|_| \_\_____|
7 #
8 # Copyright (C) 1998 - 2012, 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
23 AUTOMAKE_OPTIONS = foreign
24
25 ACLOCAL_AMFLAGS = -I m4
26
27 CMAKE_DIST = CMakeLists.txt CMake/CMakeConfigurableFile.in              \
28 CMake/CurlCheckCSourceCompiles.cmake CMake/CurlCheckCSourceRuns.cmake   \
29 CMake/CurlTests.c CMake/FindOpenSSL.cmake CMake/FindZLIB.cmake          \
30 CMake/OtherTests.cmake CMake/Platforms/WindowsCache.cmake               \
31 CMake/Utilities.cmake include/curl/curlbuild.h.cmake
32
33 WINBUILD_DIST = winbuild/BUILD.WINDOWS.txt winbuild/gen_resp_file.bat   \
34 winbuild/MakefileBuild.vc winbuild/Makefile.vc
35
36 EXTRA_DIST = CHANGES COPYING maketgz Makefile.dist curl-config.in       \
37  curl-style.el sample.emacs RELEASE-NOTES buildconf     \
38  libcurl.pc.in vc6curl.dsw MacOSX-Framework Android.mk $(CMAKE_DIST)    \
39  Makefile.msvc.names $(WINBUILD_DIST) lib/libcurl.vers.in
40
41 bin_SCRIPTS = curl-config
42
43 SUBDIRS = lib src include
44 DIST_SUBDIRS = $(SUBDIRS) tests packages docs
45
46 pkgconfigdir = $(libdir)/pkgconfig
47 pkgconfig_DATA = libcurl.pc
48
49 dist-hook:
50         rm -rf $(top_builddir)/tests/log
51         find $(distdir) -name "*.dist" -exec rm {} \;
52         (distit=`find $(srcdir) -name "*.dist" | grep -v ./ares/`; \
53         for file in $$distit; do \
54           strip=`echo $$file | sed -e s/^$(srcdir)// -e s/\.dist//`; \
55           cp $$file $(distdir)$$strip; \
56         done)
57
58 html:
59         cd docs; make html
60
61 pdf:
62         cd docs; make pdf
63
64 check: test examples
65
66 if CROSSCOMPILING
67 test-full: test
68 test-torture: test
69
70 test:
71         @echo "NOTICE: we can't run the tests when cross-compiling!"
72
73 else
74
75 test:
76         @(cd tests; $(MAKE) all quiet-test)
77
78 test-full:
79         @(cd tests; $(MAKE) all full-test)
80
81 test-torture:
82         @(cd tests; $(MAKE) all torture-test)
83
84 test-am:
85         @(cd tests; $(MAKE) all am-test)
86
87 endif
88
89 examples:
90         @(cd docs/examples; $(MAKE) check)
91
92 # This is a hook to have 'make clean' also clean up the dosc and the tests
93 # dir. The extra check for the Makefiles being present is necessary because
94 # 'make distcheck' will make clean first in these directories _before_ it runs
95 # this hook.
96 clean-local:
97         @(if test -f tests/Makefile; then cd tests; $(MAKE) clean; fi)
98         @(if test -f docs/Makefile; then cd docs; $(MAKE) clean; fi)
99
100 #
101 # Build source and binary rpms. For rpm-3.0 and above, the ~/.rpmmacros
102 # must contain the following line:
103 # %_topdir /home/loic/local/rpm
104 # and that /home/loic/local/rpm contains the directory SOURCES, BUILD etc.
105 #
106 # cd /home/loic/local/rpm ; mkdir -p SOURCES BUILD RPMS/i386 SPECS SRPMS
107 #
108 # If additional configure flags are needed to build the package, add the
109 # following in ~/.rpmmacros
110 # %configure CFLAGS="%{optflags}" ./configure %{_target_platform} --prefix=%{_prefix} ${AM_CONFIGFLAGS}
111 # and run make rpm in the following way:
112 # AM_CONFIGFLAGS='--with-uri=/home/users/loic/local/RedHat-6.2' make rpm
113 #
114
115 rpms:
116         $(MAKE) RPMDIST=curl rpm
117         $(MAKE) RPMDIST=curl-ssl rpm
118
119 rpm:
120         RPM_TOPDIR=`rpm --showrc | $(PERL) -n -e 'print if(s/.*_topdir\s+(.*)/$$1/)'` ; \
121         cp $(srcdir)/packages/Linux/RPM/$(RPMDIST).spec $$RPM_TOPDIR/SPECS ; \
122         cp $(PACKAGE)-$(VERSION).tar.gz $$RPM_TOPDIR/SOURCES ; \
123         rpm -ba --clean --rmsource $$RPM_TOPDIR/SPECS/$(RPMDIST).spec ; \
124         mv $$RPM_TOPDIR/RPMS/i386/$(RPMDIST)-*.rpm . ; \
125         mv $$RPM_TOPDIR/SRPMS/$(RPMDIST)-*.src.rpm .
126
127 #
128 # Build a Solaris pkgadd format file
129 # run 'make pkgadd' once you've done './configure' and 'make' to make a Solaris pkgadd format
130 # file (which ends up back in this directory).
131 # The pkgadd file is in 'pkgtrans' format, so to install on Solaris, do
132 # pkgadd -d ./HAXXcurl-*
133 #
134
135 # gak - libtool requires an absoulte directory, hence the pwd below...
136 pkgadd:
137         umask 022 ; \
138         make install DESTDIR=`/bin/pwd`/packages/Solaris/root ; \
139         cat COPYING > $(srcdir)/packages/Solaris/copyright ; \
140         cd $(srcdir)/packages/Solaris && $(MAKE) package
141
142 #
143 # Build a cygwin binary tarball installation file
144 # resulting .tar.bz2 file will end up at packages/Win32/cygwin
145 cygwinbin:
146         $(MAKE) -C packages/Win32/cygwin cygwinbin
147
148 # We extend the standard install with a custom hook:
149 install-data-hook:
150         cd include && $(MAKE) install
151         cd docs && $(MAKE) install
152
153 # We extend the standard uninstall with a custom hook:
154 uninstall-hook:
155         cd include && $(MAKE) uninstall
156         cd docs && $(MAKE) uninstall
157
158 ca-bundle: lib/mk-ca-bundle.pl
159         @echo "generate a fresh ca-bundle.crt"
160         @perl $< -b -l -u lib/ca-bundle.crt
161
162 ca-firefox: lib/firefox-db2pem.sh
163         @echo "generate a fresh ca-bundle.crt"
164         ./lib/firefox-db2pem.sh lib/ca-bundle.crt
165
166 checksrc:
167         cd lib && $(MAKE) checksrc
168         cd src && $(MAKE) checksrc