• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#***************************************************************************
2#                                  _   _ ____  _
3#  Project                     ___| | | |  _ \| |
4#                             / __| | | | |_) | |
5#                            | (__| |_| |  _ <| |___
6#                             \___|\___/|_| \_\_____|
7#
8# Copyright (C) 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.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# SPDX-License-Identifier: curl
22#
23###########################################################################
24AUTOMAKE_OPTIONS = foreign nostdinc
25
26# remove targets if the command fails
27.DELETE_ON_ERROR:
28
29# Specify our include paths here, and do it relative to $(top_srcdir) and
30# $(top_builddir), to ensure that these paths which belong to the library
31# being currently built and tested are searched before the library which
32# might possibly already be installed in the system.
33#
34# $(top_srcdir)/include is for libcurl's external include files
35# $(top_builddir)/lib is for libcurl's generated lib/curl_config.h file
36# $(top_builddir)/src is for curl's generated src/curl_config.h file
37# $(top_srcdir)/lib for libcurl's lib/curl_setup.h and other "borrowed" files
38# $(top_srcdir)/src is for curl's src/tool_setup.h and "curl-private" files
39
40AM_CPPFLAGS = -I$(top_srcdir)/include        \
41              -I$(top_builddir)/lib          \
42              -I$(top_builddir)/src          \
43              -I$(top_srcdir)/lib            \
44              -I$(top_srcdir)/src
45
46bin_PROGRAMS = curl
47
48SUBDIRS = ../docs
49
50if USE_CPPFLAG_CURL_STATICLIB
51AM_CPPFLAGS += -DCURL_STATICLIB
52endif
53AM_CPPFLAGS += -DBUILDING_CURL
54
55include Makefile.inc
56
57# CURL_FILES comes from Makefile.inc
58curl_SOURCES = $(CURL_FILES)
59if HAVE_WINDRES
60curl_SOURCES += $(CURL_RCFILES)
61$(CURL_RCFILES): tool_version.h
62endif
63
64curl_LDFLAGS = $(AM_LDFLAGS) $(CURL_LDFLAGS_BIN)
65
66# This might hold -Werror
67CFLAGS += @CURL_CFLAG_EXTRAS@
68
69# Prevent LIBS from being used for all link targets
70LIBS = $(BLANK_AT_MAKETIME)
71
72if USE_EXPLICIT_LIB_DEPS
73curl_LDADD = $(top_builddir)/lib/libcurl.la @LIBCURL_LIBS@
74else
75curl_LDADD = $(top_builddir)/lib/libcurl.la @SSL_LIBS@ @ZLIB_LIBS@ @CURL_NETWORK_AND_TIME_LIBS@
76endif
77
78# if unit tests are enabled, build a static library to link them with
79if BUILD_UNITTESTS
80noinst_LTLIBRARIES = libcurltool.la
81libcurltool_la_CPPFLAGS = $(AM_CPPFLAGS) \
82                          -DCURL_STATICLIB -DUNITTESTS
83libcurltool_la_CFLAGS =
84libcurltool_la_LDFLAGS = -static $(LINKFLAGS)
85libcurltool_la_SOURCES = $(CURL_FILES)
86endif
87
88CLEANFILES = tool_hugehelp.c
89# Use the C locale to ensure that only ASCII characters appear in the
90# embedded text.
91NROFF=env LC_ALL=C @NROFF@ @MANOPT@ 2>/dev/null # figured out by the configure script
92
93EXTRA_DIST = mkhelp.pl \
94 Makefile.mk curl.rc Makefile.inc CMakeLists.txt .checksrc
95
96# Use absolute directory to disable VPATH
97MANPAGE=$(abs_top_builddir)/docs/curl.1
98MKHELP=$(top_srcdir)/src/mkhelp.pl
99HUGE=tool_hugehelp.c
100
101HUGECMD = $(HUGEIT_$(V))
102HUGEIT_0 = @echo "  HUGE    " $@;
103HUGEIT_1 =
104HUGEIT_ = $(HUGEIT_0)
105
106CHECKSRC = $(CS_$(V))
107CS_0 = @echo "  RUN     " $@;
108CS_1 =
109CS_ = $(CS_0)
110
111if USE_MANUAL
112# Here are the stuff to create a built-in manual
113
114$(MANPAGE):
115	cd $(top_builddir)/docs && $(MAKE)
116
117if HAVE_LIBZ
118# This generates the tool_hugehelp.c file in both uncompressed and
119# compressed formats.
120$(HUGE): $(MANPAGE) $(MKHELP)
121	$(HUGECMD) (echo '#include "tool_setup.h"' > $(HUGE);   \
122	echo '#ifndef HAVE_LIBZ' >> $(HUGE);                    \
123	$(NROFF) $(MANPAGE) | $(PERL) $(MKHELP) >> $(HUGE);     \
124	echo '#else' >> $(HUGE);                                \
125	$(NROFF) $(MANPAGE) | $(PERL) $(MKHELP) -c >> $(HUGE);  \
126	echo '#endif /* HAVE_LIBZ */' >> $(HUGE) )
127else # HAVE_LIBZ
128# This generates the tool_hugehelp.c file uncompressed only
129$(HUGE): $(MANPAGE) $(MKHELP)
130	$(HUGECMD)(echo '#include "tool_setup.h"' > $(HUGE);    \
131	$(NROFF) $(MANPAGE) | $(PERL) $(MKHELP) >> $(HUGE) )
132endif
133
134else # USE_MANUAL
135# built-in manual has been disabled, make a blank file
136$(HUGE):
137	echo '#include "tool_hugehelp.h"' >> $(HUGE)
138endif
139
140# ignore tool_hugehelp.c since it is generated source code and it plays
141# by slightly different rules!
142checksrc:
143	$(CHECKSRC)(@PERL@ $(top_srcdir)/scripts/checksrc.pl -D$(srcdir) \
144	-W$(srcdir)/tool_hugehelp.c $(srcdir)/*.[ch])
145
146if CURLDEBUG
147# for debug builds, we scan the sources on all regular make invokes
148all-local: checksrc
149endif
150
151# disable the tests that are mostly causing false positives
152TIDYFLAGS=-checks=-clang-analyzer-security.insecureAPI.strcpy,-clang-analyzer-optin.performance.Padding,-clang-analyzer-valist.Uninitialized,-clang-analyzer-core.NonNullParamChecker,-clang-analyzer-core.NullDereference
153
154TIDY:=clang-tidy
155
156tidy:
157	$(TIDY) $(CURL_CFILES) $(TIDYFLAGS) -- $(curl_CPPFLAGS) $(CPPFLAGS) -DHAVE_CONFIG_H
158
159listhelp:
160	(cd $(top_srcdir)/docs/cmdline-opts && make listhelp)
161
162if HAVE_WINDRES
163.rc.o:
164	$(RC) -I$(top_srcdir)/include -DCURL_EMBED_MANIFEST $(RCFLAGS) -i $< -o $@
165endif
166