1*6236dae4SAndroid Build Coastguard Worker#*************************************************************************** 2*6236dae4SAndroid Build Coastguard Worker# _ _ ____ _ 3*6236dae4SAndroid Build Coastguard Worker# Project ___| | | | _ \| | 4*6236dae4SAndroid Build Coastguard Worker# / __| | | | |_) | | 5*6236dae4SAndroid Build Coastguard Worker# | (__| |_| | _ <| |___ 6*6236dae4SAndroid Build Coastguard Worker# \___|\___/|_| \_\_____| 7*6236dae4SAndroid Build Coastguard Worker# 8*6236dae4SAndroid Build Coastguard Worker# Copyright (C) Daniel Stenberg, <[email protected]>, et al. 9*6236dae4SAndroid Build Coastguard Worker# 10*6236dae4SAndroid Build Coastguard Worker# This software is licensed as described in the file COPYING, which 11*6236dae4SAndroid Build Coastguard Worker# you should have received as part of this distribution. The terms 12*6236dae4SAndroid Build Coastguard Worker# are also available at https://curl.se/docs/copyright.html. 13*6236dae4SAndroid Build Coastguard Worker# 14*6236dae4SAndroid Build Coastguard Worker# You may opt to use, copy, modify, merge, publish, distribute and/or sell 15*6236dae4SAndroid Build Coastguard Worker# copies of the Software, and permit persons to whom the Software is 16*6236dae4SAndroid Build Coastguard Worker# furnished to do so, under the terms of the COPYING file. 17*6236dae4SAndroid Build Coastguard Worker# 18*6236dae4SAndroid Build Coastguard Worker# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 19*6236dae4SAndroid Build Coastguard Worker# KIND, either express or implied. 20*6236dae4SAndroid Build Coastguard Worker# 21*6236dae4SAndroid Build Coastguard Worker# SPDX-License-Identifier: curl 22*6236dae4SAndroid Build Coastguard Worker# 23*6236dae4SAndroid Build Coastguard Worker########################################################################### 24*6236dae4SAndroid Build Coastguard WorkerAUTOMAKE_OPTIONS = foreign nostdinc 25*6236dae4SAndroid Build Coastguard Worker 26*6236dae4SAndroid Build Coastguard Worker# remove targets if the command fails 27*6236dae4SAndroid Build Coastguard Worker.DELETE_ON_ERROR: 28*6236dae4SAndroid Build Coastguard Worker 29*6236dae4SAndroid Build Coastguard WorkerEXTRA_DIST = mk-file-embed.pl mkhelp.pl \ 30*6236dae4SAndroid Build Coastguard Worker Makefile.mk curl.rc Makefile.inc CMakeLists.txt .checksrc 31*6236dae4SAndroid Build Coastguard Worker 32*6236dae4SAndroid Build Coastguard Worker# Specify our include paths here, and do it relative to $(top_srcdir) and 33*6236dae4SAndroid Build Coastguard Worker# $(top_builddir), to ensure that these paths which belong to the library 34*6236dae4SAndroid Build Coastguard Worker# being currently built and tested are searched before the library which 35*6236dae4SAndroid Build Coastguard Worker# might possibly already be installed in the system. 36*6236dae4SAndroid Build Coastguard Worker# 37*6236dae4SAndroid Build Coastguard Worker# $(top_srcdir)/include is for libcurl's external include files 38*6236dae4SAndroid Build Coastguard Worker# $(top_builddir)/lib is for libcurl's generated lib/curl_config.h file 39*6236dae4SAndroid Build Coastguard Worker# $(top_builddir)/src is for curl's generated src/curl_config.h file 40*6236dae4SAndroid Build Coastguard Worker# $(top_srcdir)/lib for libcurl's lib/curl_setup.h and other "borrowed" files 41*6236dae4SAndroid Build Coastguard Worker# $(top_srcdir)/src is for curl's src/tool_setup.h and "curl-private" files 42*6236dae4SAndroid Build Coastguard Worker 43*6236dae4SAndroid Build Coastguard WorkerAM_CPPFLAGS = -I$(top_srcdir)/include \ 44*6236dae4SAndroid Build Coastguard Worker -I$(top_builddir)/lib \ 45*6236dae4SAndroid Build Coastguard Worker -I$(top_builddir)/src \ 46*6236dae4SAndroid Build Coastguard Worker -I$(top_srcdir)/lib \ 47*6236dae4SAndroid Build Coastguard Worker -I$(top_srcdir)/src 48*6236dae4SAndroid Build Coastguard Worker 49*6236dae4SAndroid Build Coastguard Workerbin_PROGRAMS = curl 50*6236dae4SAndroid Build Coastguard Worker 51*6236dae4SAndroid Build Coastguard Workerif USE_CPPFLAG_CURL_STATICLIB 52*6236dae4SAndroid Build Coastguard WorkerAM_CPPFLAGS += -DCURL_STATICLIB 53*6236dae4SAndroid Build Coastguard Workerendif 54*6236dae4SAndroid Build Coastguard WorkerAM_CPPFLAGS += -DBUILDING_CURL 55*6236dae4SAndroid Build Coastguard Worker 56*6236dae4SAndroid Build Coastguard WorkerAM_LDFLAGS = 57*6236dae4SAndroid Build Coastguard Workerif USE_UNICODE 58*6236dae4SAndroid Build Coastguard WorkerAM_LDFLAGS += -municode 59*6236dae4SAndroid Build Coastguard Workerendif 60*6236dae4SAndroid Build Coastguard Worker 61*6236dae4SAndroid Build Coastguard Workerinclude Makefile.inc 62*6236dae4SAndroid Build Coastguard Worker 63*6236dae4SAndroid Build Coastguard WorkerCLEANFILES = 64*6236dae4SAndroid Build Coastguard Worker 65*6236dae4SAndroid Build Coastguard Workerif USE_UNITY 66*6236dae4SAndroid Build Coastguard Workercurl_EXCLUDE = 67*6236dae4SAndroid Build Coastguard Workerif DEBUGBUILD 68*6236dae4SAndroid Build Coastguard Worker# We must compile this source separately to avoid memdebug.h redefinitions 69*6236dae4SAndroid Build Coastguard Worker# applying to them. 70*6236dae4SAndroid Build Coastguard Workercurl_EXCLUDE += ../lib/curl_multibyte.c 71*6236dae4SAndroid Build Coastguard Workerendif 72*6236dae4SAndroid Build Coastguard Workerif USE_CPPFLAG_CURL_STATICLIB 73*6236dae4SAndroid Build Coastguard Workercurl_CURLX = $(CURLTOOL_LIBCURL_CFILES) 74*6236dae4SAndroid Build Coastguard Workerelse 75*6236dae4SAndroid Build Coastguard Workercurl_CURLX = $(CURLX_CFILES) 76*6236dae4SAndroid Build Coastguard Workerendif 77*6236dae4SAndroid Build Coastguard Workercurltool_unity.c: $(top_srcdir)/scripts/mk-unity.pl $(CURL_CFILES) $(curl_CURLX) 78*6236dae4SAndroid Build Coastguard Worker @PERL@ $(top_srcdir)/scripts/mk-unity.pl $(srcdir) $(CURL_CFILES) $(curl_CURLX) --exclude $(curl_EXCLUDE) > curltool_unity.c 79*6236dae4SAndroid Build Coastguard Worker 80*6236dae4SAndroid Build Coastguard Workernodist_curl_SOURCES = curltool_unity.c 81*6236dae4SAndroid Build Coastguard Workercurl_SOURCES = $(curl_EXCLUDE) 82*6236dae4SAndroid Build Coastguard WorkerCLEANFILES += curltool_unity.c 83*6236dae4SAndroid Build Coastguard Workerelse 84*6236dae4SAndroid Build Coastguard Worker# CURL_FILES comes from Makefile.inc 85*6236dae4SAndroid Build Coastguard Workercurl_SOURCES = $(CURL_FILES) 86*6236dae4SAndroid Build Coastguard Workerendif 87*6236dae4SAndroid Build Coastguard Workerif HAVE_WINDRES 88*6236dae4SAndroid Build Coastguard Workercurl_SOURCES += $(CURL_RCFILES) 89*6236dae4SAndroid Build Coastguard Worker$(CURL_RCFILES): tool_version.h 90*6236dae4SAndroid Build Coastguard Workerendif 91*6236dae4SAndroid Build Coastguard Worker 92*6236dae4SAndroid Build Coastguard Workercurl_LDFLAGS = $(AM_LDFLAGS) $(CURL_LDFLAGS_BIN) 93*6236dae4SAndroid Build Coastguard Worker 94*6236dae4SAndroid Build Coastguard Worker# This might hold -Werror 95*6236dae4SAndroid Build Coastguard WorkerCFLAGS += @CURL_CFLAG_EXTRAS@ 96*6236dae4SAndroid Build Coastguard Worker 97*6236dae4SAndroid Build Coastguard Worker# Prevent LIBS from being used for all link targets 98*6236dae4SAndroid Build Coastguard WorkerLIBS = $(BLANK_AT_MAKETIME) 99*6236dae4SAndroid Build Coastguard Worker 100*6236dae4SAndroid Build Coastguard Workercurl_LDADD = $(top_builddir)/lib/libcurl.la @LIBCURL_PC_LIBS_PRIVATE@ 101*6236dae4SAndroid Build Coastguard Worker 102*6236dae4SAndroid Build Coastguard Worker# if unit tests are enabled, build a static library to link them with 103*6236dae4SAndroid Build Coastguard Workerif BUILD_UNITTESTS 104*6236dae4SAndroid Build Coastguard Workernoinst_LTLIBRARIES = libcurltool.la 105*6236dae4SAndroid Build Coastguard Workerlibcurltool_la_CPPFLAGS = $(AM_CPPFLAGS) -DCURL_STATICLIB -DUNITTESTS 106*6236dae4SAndroid Build Coastguard Workerlibcurltool_la_CFLAGS = 107*6236dae4SAndroid Build Coastguard Workerlibcurltool_la_LDFLAGS = -static $(LINKFLAGS) 108*6236dae4SAndroid Build Coastguard Workerif USE_UNITY 109*6236dae4SAndroid Build Coastguard Workerlibcurltool_unity.c: $(top_srcdir)/scripts/mk-unity.pl $(CURL_CFILES) $(CURLTOOL_LIBCURL_CFILES) 110*6236dae4SAndroid Build Coastguard Worker @PERL@ $(top_srcdir)/scripts/mk-unity.pl $(srcdir) $(CURL_CFILES) $(CURLTOOL_LIBCURL_CFILES) --exclude $(curl_EXCLUDE) > libcurltool_unity.c 111*6236dae4SAndroid Build Coastguard Worker 112*6236dae4SAndroid Build Coastguard Workernodist_libcurltool_la_SOURCES = libcurltool_unity.c 113*6236dae4SAndroid Build Coastguard Workerlibcurltool_la_SOURCES = $(curl_EXCLUDE) 114*6236dae4SAndroid Build Coastguard WorkerCLEANFILES += libcurltool_unity.c 115*6236dae4SAndroid Build Coastguard Workerelse 116*6236dae4SAndroid Build Coastguard Workerlibcurltool_la_SOURCES = $(CURL_FILES) 117*6236dae4SAndroid Build Coastguard Workerendif 118*6236dae4SAndroid Build Coastguard Workerendif 119*6236dae4SAndroid Build Coastguard Worker 120*6236dae4SAndroid Build Coastguard Worker# Use absolute directory to disable VPATH 121*6236dae4SAndroid Build Coastguard WorkerASCIIPAGE=$(top_builddir)/docs/cmdline-opts/curl.txt 122*6236dae4SAndroid Build Coastguard WorkerMKHELP=$(top_srcdir)/src/mkhelp.pl 123*6236dae4SAndroid Build Coastguard WorkerHUGE=tool_hugehelp.c 124*6236dae4SAndroid Build Coastguard Worker 125*6236dae4SAndroid Build Coastguard WorkerHUGECMD = $(HUGEIT_$(V)) 126*6236dae4SAndroid Build Coastguard WorkerHUGEIT_0 = @echo " HUGE " $@; 127*6236dae4SAndroid Build Coastguard WorkerHUGEIT_1 = 128*6236dae4SAndroid Build Coastguard WorkerHUGEIT_ = $(HUGEIT_0) 129*6236dae4SAndroid Build Coastguard Worker 130*6236dae4SAndroid Build Coastguard Workerif USE_MANUAL 131*6236dae4SAndroid Build Coastguard Worker# Here are the stuff to create a built-in manual 132*6236dae4SAndroid Build Coastguard WorkerAM_CPPFLAGS += -DUSE_MANUAL 133*6236dae4SAndroid Build Coastguard Worker 134*6236dae4SAndroid Build Coastguard Worker$(ASCIIPAGE): 135*6236dae4SAndroid Build Coastguard Worker cd $(top_builddir)/docs && $(MAKE) 136*6236dae4SAndroid Build Coastguard Worker 137*6236dae4SAndroid Build Coastguard Workerif HAVE_LIBZ 138*6236dae4SAndroid Build Coastguard Worker# This generates the tool_hugehelp.c file in both uncompressed and 139*6236dae4SAndroid Build Coastguard Worker# compressed formats. 140*6236dae4SAndroid Build Coastguard Worker$(HUGE): $(ASCIIPAGE) $(MKHELP) 141*6236dae4SAndroid Build Coastguard Worker $(HUGECMD) (echo '#include "tool_setup.h"' > $(HUGE); \ 142*6236dae4SAndroid Build Coastguard Worker echo '#ifndef HAVE_LIBZ' >> $(HUGE); \ 143*6236dae4SAndroid Build Coastguard Worker $(PERL) $(MKHELP) < $(ASCIIPAGE) >> $(HUGE); \ 144*6236dae4SAndroid Build Coastguard Worker echo '#else' >> $(HUGE); \ 145*6236dae4SAndroid Build Coastguard Worker $(PERL) $(MKHELP) -c < $(ASCIIPAGE) >> $(HUGE); \ 146*6236dae4SAndroid Build Coastguard Worker echo '#endif /* HAVE_LIBZ */' >> $(HUGE) ) 147*6236dae4SAndroid Build Coastguard Workerelse # HAVE_LIBZ 148*6236dae4SAndroid Build Coastguard Worker# This generates the tool_hugehelp.c file uncompressed only 149*6236dae4SAndroid Build Coastguard Worker$(HUGE): $(ASCIIPAGE) $(MKHELP) 150*6236dae4SAndroid Build Coastguard Worker $(HUGECMD)(echo '#include "tool_setup.h"' > $(HUGE); \ 151*6236dae4SAndroid Build Coastguard Worker $(PERL) $(MKHELP) < $(ASCIIPAGE) >> $(HUGE) ) 152*6236dae4SAndroid Build Coastguard Workerendif 153*6236dae4SAndroid Build Coastguard Worker 154*6236dae4SAndroid Build Coastguard Workerelse # USE_MANUAL 155*6236dae4SAndroid Build Coastguard Worker# built-in manual has been disabled, make a blank file 156*6236dae4SAndroid Build Coastguard Worker$(HUGE): 157*6236dae4SAndroid Build Coastguard Worker echo '#include "tool_hugehelp.h"' >> $(HUGE) 158*6236dae4SAndroid Build Coastguard Workerendif 159*6236dae4SAndroid Build Coastguard Worker 160*6236dae4SAndroid Build Coastguard WorkerCLEANFILES += $(HUGE) 161*6236dae4SAndroid Build Coastguard Worker 162*6236dae4SAndroid Build Coastguard WorkerCA_EMBED_CSOURCE = tool_ca_embed.c 163*6236dae4SAndroid Build Coastguard WorkerCURL_CFILES += $(CA_EMBED_CSOURCE) 164*6236dae4SAndroid Build Coastguard WorkerCLEANFILES += $(CA_EMBED_CSOURCE) 165*6236dae4SAndroid Build Coastguard Workerif CURL_CA_EMBED_SET 166*6236dae4SAndroid Build Coastguard WorkerAM_CPPFLAGS += -DCURL_CA_EMBED 167*6236dae4SAndroid Build Coastguard WorkerMK_FILE_EMBED = $(top_srcdir)/src/mk-file-embed.pl 168*6236dae4SAndroid Build Coastguard Worker$(CA_EMBED_CSOURCE): $(MK_FILE_EMBED) $(CURL_CA_EMBED) 169*6236dae4SAndroid Build Coastguard Worker $(PERL) $(MK_FILE_EMBED) --var curl_ca_embed < $(CURL_CA_EMBED) > $(CA_EMBED_CSOURCE) 170*6236dae4SAndroid Build Coastguard Workerelse 171*6236dae4SAndroid Build Coastguard Worker$(CA_EMBED_CSOURCE): 172*6236dae4SAndroid Build Coastguard Worker echo 'extern const void *curl_ca_embed; const void *curl_ca_embed;' > $(CA_EMBED_CSOURCE) 173*6236dae4SAndroid Build Coastguard Workerendif 174*6236dae4SAndroid Build Coastguard Worker 175*6236dae4SAndroid Build Coastguard WorkerCHECKSRC = $(CS_$(V)) 176*6236dae4SAndroid Build Coastguard WorkerCS_0 = @echo " RUN " $@; 177*6236dae4SAndroid Build Coastguard WorkerCS_1 = 178*6236dae4SAndroid Build Coastguard WorkerCS_ = $(CS_0) 179*6236dae4SAndroid Build Coastguard Worker 180*6236dae4SAndroid Build Coastguard Worker# ignore generated C files since they play by slightly different rules! 181*6236dae4SAndroid Build Coastguard Workerchecksrc: 182*6236dae4SAndroid Build Coastguard Worker $(CHECKSRC)(@PERL@ $(top_srcdir)/scripts/checksrc.pl -D$(srcdir) \ 183*6236dae4SAndroid Build Coastguard Worker -W$(srcdir)/$(HUGE) \ 184*6236dae4SAndroid Build Coastguard Worker -W$(srcdir)/$(CA_EMBED_CSOURCE) \ 185*6236dae4SAndroid Build Coastguard Worker $(srcdir)/*.[ch]) 186*6236dae4SAndroid Build Coastguard Worker 187*6236dae4SAndroid Build Coastguard Workerif DEBUGBUILD 188*6236dae4SAndroid Build Coastguard Worker# for debug builds, we scan the sources on all regular make invokes 189*6236dae4SAndroid Build Coastguard Workerall-local: checksrc 190*6236dae4SAndroid Build Coastguard Workerendif 191*6236dae4SAndroid Build Coastguard Worker 192*6236dae4SAndroid Build Coastguard Worker# disable the tests that are mostly causing false positives 193*6236dae4SAndroid Build Coastguard WorkerTIDYFLAGS=-checks=-clang-analyzer-security.insecureAPI.strcpy,-clang-analyzer-optin.performance.Padding,-clang-analyzer-valist.Uninitialized,-clang-analyzer-core.NonNullParamChecker,-clang-analyzer-core.NullDereference 194*6236dae4SAndroid Build Coastguard Worker 195*6236dae4SAndroid Build Coastguard WorkerTIDY:=clang-tidy 196*6236dae4SAndroid Build Coastguard Worker 197*6236dae4SAndroid Build Coastguard Workertidy: 198*6236dae4SAndroid Build Coastguard Worker $(TIDY) $(CURL_CFILES) $(TIDYFLAGS) -- $(curl_CPPFLAGS) $(CPPFLAGS) -DHAVE_CONFIG_H 199*6236dae4SAndroid Build Coastguard Worker 200*6236dae4SAndroid Build Coastguard Workerlisthelp: 201*6236dae4SAndroid Build Coastguard Worker (cd $(top_srcdir)/docs/cmdline-opts && make listhelp) 202*6236dae4SAndroid Build Coastguard Worker 203*6236dae4SAndroid Build Coastguard Workerif HAVE_WINDRES 204*6236dae4SAndroid Build Coastguard Worker.rc.o: 205*6236dae4SAndroid Build Coastguard Worker $(RC) -I$(top_srcdir)/include -DCURL_EMBED_MANIFEST $(RCFLAGS) -i $< -o $@ 206*6236dae4SAndroid Build Coastguard Workerendif 207*6236dae4SAndroid Build Coastguard Worker 208*6236dae4SAndroid Build Coastguard Workerdist-hook: 209*6236dae4SAndroid Build Coastguard Worker rm -f $(distdir)/$(CA_EMBED_CSOURCE) 210