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 48if BUILD_DOCS 49SUBDIRS = ../docs 50endif 51 52if USE_CPPFLAG_CURL_STATICLIB 53AM_CPPFLAGS += -DCURL_STATICLIB 54endif 55AM_CPPFLAGS += -DBUILDING_CURL 56 57include Makefile.inc 58 59# CURL_FILES comes from Makefile.inc 60curl_SOURCES = $(CURL_FILES) 61if HAVE_WINDRES 62curl_SOURCES += $(CURL_RCFILES) 63$(CURL_RCFILES): tool_version.h 64endif 65 66curl_LDFLAGS = $(AM_LDFLAGS) $(CURL_LDFLAGS_BIN) 67 68# This might hold -Werror 69CFLAGS += @CURL_CFLAG_EXTRAS@ 70 71# Prevent LIBS from being used for all link targets 72LIBS = $(BLANK_AT_MAKETIME) 73 74if USE_EXPLICIT_LIB_DEPS 75curl_LDADD = $(top_builddir)/lib/libcurl.la @LIBCURL_LIBS@ 76else 77curl_LDADD = $(top_builddir)/lib/libcurl.la @SSL_LIBS@ @ZLIB_LIBS@ @CURL_NETWORK_AND_TIME_LIBS@ 78endif 79 80# if unit tests are enabled, build a static library to link them with 81if BUILD_UNITTESTS 82noinst_LTLIBRARIES = libcurltool.la 83libcurltool_la_CPPFLAGS = $(AM_CPPFLAGS) \ 84 -DCURL_STATICLIB -DUNITTESTS 85libcurltool_la_CFLAGS = 86libcurltool_la_LDFLAGS = -static $(LINKFLAGS) 87libcurltool_la_SOURCES = $(CURL_FILES) 88endif 89 90CLEANFILES = tool_hugehelp.c 91# Use the C locale to ensure that only ASCII characters appear in the 92# embedded text. 93NROFF=env LC_ALL=C @NROFF@ @MANOPT@ 2>/dev/null # figured out by the configure script 94 95EXTRA_DIST = mkhelp.pl \ 96 Makefile.mk curl.rc Makefile.inc CMakeLists.txt .checksrc 97 98# Use absolute directory to disable VPATH 99ASCIIPAGE=$(top_builddir)/docs/cmdline-opts/curl.txt 100MKHELP=$(top_srcdir)/src/mkhelp.pl 101HUGE=tool_hugehelp.c 102 103HUGECMD = $(HUGEIT_$(V)) 104HUGEIT_0 = @echo " HUGE " $@; 105HUGEIT_1 = 106HUGEIT_ = $(HUGEIT_0) 107 108CHECKSRC = $(CS_$(V)) 109CS_0 = @echo " RUN " $@; 110CS_1 = 111CS_ = $(CS_0) 112 113if USE_MANUAL 114# Here are the stuff to create a built-in manual 115 116$(ASCIIPAGE): 117 cd $(top_builddir)/docs && $(MAKE) 118 119if HAVE_LIBZ 120# This generates the tool_hugehelp.c file in both uncompressed and 121# compressed formats. 122$(HUGE): $(ASCIIPAGE) $(MKHELP) 123 $(HUGECMD) (echo '#include "tool_setup.h"' > $(HUGE); \ 124 echo '#ifndef HAVE_LIBZ' >> $(HUGE); \ 125 $(PERL) $(MKHELP) < $(ASCIIPAGE) >> $(HUGE); \ 126 echo '#else' >> $(HUGE); \ 127 $(PERL) $(MKHELP) -c < $(ASCIIPAGE) >> $(HUGE); \ 128 echo '#endif /* HAVE_LIBZ */' >> $(HUGE) ) 129else # HAVE_LIBZ 130# This generates the tool_hugehelp.c file uncompressed only 131$(HUGE): $(ASCIIPAGE) $(MKHELP) 132 $(HUGECMD)(echo '#include "tool_setup.h"' > $(HUGE); \ 133 $(PERL) $(MKHELP) < $(ASCIIPAGE) >> $(HUGE) ) 134endif 135 136else # USE_MANUAL 137# built-in manual has been disabled, make a blank file 138$(HUGE): 139 echo '#include "tool_hugehelp.h"' >> $(HUGE) 140endif 141 142# ignore tool_hugehelp.c since it is generated source code and it plays 143# by slightly different rules! 144checksrc: 145 $(CHECKSRC)(@PERL@ $(top_srcdir)/scripts/checksrc.pl -D$(srcdir) \ 146 -W$(srcdir)/tool_hugehelp.c $(srcdir)/*.[ch]) 147 148if CURLDEBUG 149# for debug builds, we scan the sources on all regular make invokes 150all-local: checksrc 151endif 152 153# disable the tests that are mostly causing false positives 154TIDYFLAGS=-checks=-clang-analyzer-security.insecureAPI.strcpy,-clang-analyzer-optin.performance.Padding,-clang-analyzer-valist.Uninitialized,-clang-analyzer-core.NonNullParamChecker,-clang-analyzer-core.NullDereference 155 156TIDY:=clang-tidy 157 158tidy: 159 $(TIDY) $(CURL_CFILES) $(TIDYFLAGS) -- $(curl_CPPFLAGS) $(CPPFLAGS) -DHAVE_CONFIG_H 160 161listhelp: 162 (cd $(top_srcdir)/docs/cmdline-opts && make listhelp) 163 164if HAVE_WINDRES 165.rc.o: 166 $(RC) -I$(top_srcdir)/include -DCURL_EMBED_MANIFEST $(RCFLAGS) -i $< -o $@ 167endif 168