Imported Upstream version 7.59.0
[platform/upstream/curl.git] / src / Makefile.am
1 #***************************************************************************
2 #                                  _   _ ____  _
3 #  Project                     ___| | | |  _ \| |
4 #                             / __| | | | |_) | |
5 #                            | (__| |_| |  _ <| |___
6 #                             \___|\___/|_| \_\_____|
7 #
8 # Copyright (C) 1998 - 2017, 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 https://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 AUTOMAKE_OPTIONS = foreign nostdinc
23
24 # remove targets if the command fails
25 .DELETE_ON_ERROR:
26
27 # Specify our include paths here, and do it relative to $(top_srcdir) and
28 # $(top_builddir), to ensure that these paths which belong to the library
29 # being currently built and tested are searched before the library which
30 # might possibly already be installed in the system.
31 #
32 # $(top_srcdir)/include is for libcurl's external include files
33 # $(top_builddir)/lib is for libcurl's generated lib/curl_config.h file
34 # $(top_builddir)/src is for curl's generated src/curl_config.h file
35 # $(top_srcdir)/lib for libcurl's lib/curl_setup.h and other "borrowed" files
36 # $(top_srcdir)/src is for curl's src/tool_setup.h and "curl-private" files
37
38 AM_CPPFLAGS = -I$(top_srcdir)/include        \
39               -I$(top_builddir)/lib          \
40               -I$(top_builddir)/src          \
41               -I$(top_srcdir)/lib            \
42               -I$(top_srcdir)/src
43
44 bin_PROGRAMS = curl
45
46 SUBDIRS = ../docs
47
48 if USE_CPPFLAG_CURL_STATICLIB
49 AM_CPPFLAGS += -DCURL_STATICLIB
50 endif
51
52 include Makefile.inc
53
54 # CURL_FILES comes from Makefile.inc
55 curl_SOURCES = $(CURL_FILES)
56
57 # This might hold -Werror
58 CFLAGS += @CURL_CFLAG_EXTRAS@
59
60 # Prevent LIBS from being used for all link targets
61 LIBS = $(BLANK_AT_MAKETIME)
62
63 if USE_EXPLICIT_LIB_DEPS
64 curl_LDADD = $(top_builddir)/lib/libcurl.la @LIBMETALINK_LIBS@ @LIBCURL_LIBS@
65 else
66 curl_LDADD = $(top_builddir)/lib/libcurl.la @LIBMETALINK_LIBS@ @NSS_LIBS@ @SSL_LIBS@ @ZLIB_LIBS@ @CURL_NETWORK_AND_TIME_LIBS@
67 endif
68
69 curl_LDFLAGS = @LIBMETALINK_LDFLAGS@
70 curl_CPPFLAGS = $(AM_CPPFLAGS) $(LIBMETALINK_CPPFLAGS)
71
72 @CODE_COVERAGE_RULES@
73 curl_LDFLAGS += $(CODE_COVERAGE_LDFLAGS)
74 CFLAGS += $(CODE_COVERAGE_CFLAGS)
75
76 # if unit tests are enabled, build a static library to link them with
77 if BUILD_UNITTESTS
78 noinst_LTLIBRARIES = libcurltool.la
79 libcurltool_la_CPPFLAGS = $(LIBMETALINK_CPPFLAGS) $(AM_CPPFLAGS) \
80                           -DCURL_STATICLIB -DUNITTESTS
81 libcurltool_la_CFLAGS =
82 libcurltool_la_LDFLAGS = -static $(LINKFLAGS)
83 libcurltool_la_SOURCES = $(curl_SOURCES)
84 endif
85
86 CLEANFILES = tool_hugehelp.c
87 # Use the C locale to ensure that only ASCII characters appear in the
88 # embedded text.
89 NROFF=env LC_ALL=C @NROFF@ @MANOPT@ # figured out by the configure script
90
91 EXTRA_DIST = mkhelp.pl makefile.dj Makefile.b32         \
92  Makefile.m32 macos/curl.mcp.xml.sit.hqx macos/MACINSTALL.TXT           \
93  macos/src/curl_GUSIConfig.cpp macos/src/macos_main.cpp makefile.amiga  \
94  curl.rc Makefile.netware Makefile.inc Makefile.Watcom CMakeLists.txt
95
96 # Use absolute directory to disable VPATH
97 MANPAGE=$(abs_top_builddir)/docs/curl.1
98 README=$(top_srcdir)/docs/MANUAL
99 MKHELP=$(top_srcdir)/src/mkhelp.pl
100 HUGE=tool_hugehelp.c
101
102 if USE_MANUAL
103 # Here are the stuff to create a built-in manual
104
105 $(MANPAGE):
106         cd $(top_builddir)/docs && $(MAKE)
107
108 if HAVE_LIBZ
109 # This generates the tool_hugehelp.c file in both uncompressed and
110 # compressed formats.
111 $(HUGE): $(MANPAGE) $(README) $(MKHELP)
112         echo '#include "tool_setup.h"' > $(HUGE)
113         echo '#ifndef HAVE_LIBZ' >> $(HUGE)
114         $(NROFF) $(MANPAGE) | $(PERL) $(MKHELP) $(README) >> $(HUGE)
115         echo '#else' >> $(HUGE)
116         $(NROFF) $(MANPAGE) | $(PERL) $(MKHELP) -c $(README) >> $(HUGE)
117         echo '#endif /* HAVE_LIBZ */' >> $(HUGE)
118 else # HAVE_LIBZ
119 # This generates the tool_hugehelp.c file uncompressed only
120 $(HUGE): $(MANPAGE) $(README) $(MKHELP)
121         echo '#include "tool_setup.h"' > $(HUGE)
122         $(NROFF) $(MANPAGE) | $(PERL) $(MKHELP) $(README) >> $(HUGE)
123 endif
124
125 else # USE_MANUAL
126 # built-in manual has been disabled, make a blank file
127 $(HUGE):
128         echo "/* built-in manual is disabled, blank function */" > $(HUGE)
129         echo '#include "tool_hugehelp.h"' >> $(HUGE)
130         echo "void hugehelp(void) {}" >>$(HUGE)
131 endif
132
133 # ignore tool_hugehelp.c since it is generated source code and it plays
134 # by slightly different rules!
135 checksrc:
136         @PERL@ $(top_srcdir)/lib/checksrc.pl -D$(srcdir)        \
137         -W$(srcdir)/tool_hugehelp.c $(srcdir)/*.[ch]
138
139 if CURLDEBUG
140 # for debug builds, we scan the sources on all regular make invokes
141 all-local: checksrc
142 endif