• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#***************************************************************************
2#                                  _   _ ____  _
3#  Project                     ___| | | |  _ \| |
4#                             / __| | | | |_) | |
5#                            | (__| |_| |  _ <| |___
6#                             \___|\___/|_| \_\_____|
7#
8# Copyright (C) 1998 - 2020, 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###########################################################################
22AUTOMAKE_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
38AM_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
44bin_PROGRAMS = curl
45
46SUBDIRS = ../docs
47
48if USE_CPPFLAG_CURL_STATICLIB
49AM_CPPFLAGS += -DCURL_STATICLIB
50endif
51
52include Makefile.inc
53
54# CURL_FILES comes from Makefile.inc
55curl_SOURCES = $(CURL_FILES)
56
57# This might hold -Werror
58CFLAGS += @CURL_CFLAG_EXTRAS@
59
60# Prevent LIBS from being used for all link targets
61LIBS = $(BLANK_AT_MAKETIME)
62
63if USE_EXPLICIT_LIB_DEPS
64curl_LDADD = $(top_builddir)/lib/libcurl.la @LIBMETALINK_LIBS@ @LIBCURL_LIBS@
65else
66curl_LDADD = $(top_builddir)/lib/libcurl.la @LIBMETALINK_LIBS@ @NSS_LIBS@ @SSL_LIBS@ @ZLIB_LIBS@ @CURL_NETWORK_AND_TIME_LIBS@
67endif
68
69curl_LDFLAGS = @LIBMETALINK_LDFLAGS@
70curl_CPPFLAGS = $(AM_CPPFLAGS) $(LIBMETALINK_CPPFLAGS)
71
72# if unit tests are enabled, build a static library to link them with
73if BUILD_UNITTESTS
74noinst_LTLIBRARIES = libcurltool.la
75libcurltool_la_CPPFLAGS = $(LIBMETALINK_CPPFLAGS) $(AM_CPPFLAGS) \
76                          -DCURL_STATICLIB -DUNITTESTS
77libcurltool_la_CFLAGS =
78libcurltool_la_LDFLAGS = -static $(LINKFLAGS)
79libcurltool_la_SOURCES = $(curl_SOURCES)
80endif
81
82CLEANFILES = tool_hugehelp.c
83# Use the C locale to ensure that only ASCII characters appear in the
84# embedded text.
85NROFF=env LC_ALL=C @NROFF@ @MANOPT@ # figured out by the configure script
86
87EXTRA_DIST = mkhelp.pl makefile.dj                                     \
88 Makefile.m32 macos/curl.mcp.xml.sit.hqx macos/MACINSTALL.TXT          \
89 macos/src/curl_GUSIConfig.cpp macos/src/macos_main.cpp makefile.amiga \
90 curl.rc Makefile.netware Makefile.inc CMakeLists.txt
91
92# Use absolute directory to disable VPATH
93MANPAGE=$(abs_top_builddir)/docs/curl.1
94MKHELP=$(top_srcdir)/src/mkhelp.pl
95HUGE=tool_hugehelp.c
96
97HUGECMD = $(HUGEIT_$(V))
98HUGEIT_0 = @echo "  HUGE    " $@;
99HUGEIT_1 =
100HUGEIT_ = $(HUGEIT_0)
101
102CHECKSRC = $(CS_$(V))
103CS_0 = @echo "  RUN     " $@;
104CS_1 =
105CS_ = $(CS_0)
106
107if USE_MANUAL
108# Here are the stuff to create a built-in manual
109
110$(MANPAGE):
111	cd $(top_builddir)/docs && $(MAKE)
112
113if HAVE_LIBZ
114# This generates the tool_hugehelp.c file in both uncompressed and
115# compressed formats.
116$(HUGE): $(MANPAGE) $(MKHELP)
117	$(HUGECMD) (echo '#include "tool_setup.h"' > $(HUGE);   \
118	echo '#ifndef HAVE_LIBZ' >> $(HUGE);                    \
119	$(NROFF) $(MANPAGE) | $(PERL) $(MKHELP) >> $(HUGE);     \
120	echo '#else' >> $(HUGE);                                \
121	$(NROFF) $(MANPAGE) | $(PERL) $(MKHELP) -c >> $(HUGE);  \
122	echo '#endif /* HAVE_LIBZ */' >> $(HUGE) )
123else # HAVE_LIBZ
124# This generates the tool_hugehelp.c file uncompressed only
125$(HUGE): $(MANPAGE) $(MKHELP)
126	$(HUGECMD)(echo '#include "tool_setup.h"' > $(HUGE);    \
127	$(NROFF) $(MANPAGE) | $(PERL) $(MKHELP) >> $(HUGE) )
128endif
129
130else # USE_MANUAL
131# built-in manual has been disabled, make a blank file
132$(HUGE):
133	$(HUGECMD)(echo "/* built-in manual is disabled, blank function */" > $(HUGE); \
134	echo '#include "tool_hugehelp.h"' >> $(HUGE); \
135	echo "void hugehelp(void) {}" >>$(HUGE) )
136endif
137
138# ignore tool_hugehelp.c since it is generated source code and it plays
139# by slightly different rules!
140checksrc:
141	$(CHECKSRC)(@PERL@ $(top_srcdir)/lib/checksrc.pl -D$(srcdir)        \
142	-W$(srcdir)/tool_hugehelp.c $(srcdir)/*.[ch])
143
144if CURLDEBUG
145# for debug builds, we scan the sources on all regular make invokes
146all-local: checksrc
147endif
148
149# disable the tests that are mostly causing false positives
150TIDYFLAGS=-checks=-clang-analyzer-security.insecureAPI.strcpy,-clang-analyzer-optin.performance.Padding,-clang-analyzer-valist.Uninitialized,-clang-analyzer-core.NonNullParamChecker,-clang-analyzer-core.NullDereference
151
152TIDY:=clang-tidy
153
154tidy:
155	$(TIDY) $(CURL_CFILES) $(TIDYFLAGS) -- $(curl_CPPFLAGS) $(CPPFLAGS) -DHAVE_CONFIG_H
156