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 26CMAKE_DIST = CMakeLists.txt curl_config.h.cmake 27 28CHECKSRC_DIST = .checksrc vauth/.checksrc vquic/.checksrc vssh/.checksrc \ 29 vtls/.checksrc 30 31EXTRA_DIST = config-mac.h config-os400.h config-plan9.h config-riscos.h \ 32 config-win32.h curl_config.h.in libcurl.rc libcurl.def \ 33 $(CMAKE_DIST) Makefile.soname optiontable.pl $(CHECKSRC_DIST) 34 35lib_LTLIBRARIES = libcurl.la 36 37if BUILD_UNITTESTS 38noinst_LTLIBRARIES = libcurlu.la 39else 40noinst_LTLIBRARIES = 41endif 42 43# This might hold -Werror 44CFLAGS += @CURL_CFLAG_EXTRAS@ 45 46# Specify our include paths here, and do it relative to $(top_srcdir) and 47# $(top_builddir), to ensure that these paths which belong to the library 48# being currently built and tested are searched before the library which 49# might possibly already be installed in the system. 50# 51# $(top_srcdir)/include is for libcurl's external include files 52# $(top_builddir)/lib is for libcurl's generated lib/curl_config.h file 53# $(top_srcdir)/lib for libcurl's lib/curl_setup.h and other "private" files 54 55AM_CPPFLAGS = -I$(top_srcdir)/include \ 56 -I$(top_builddir)/lib \ 57 -I$(top_srcdir)/lib 58 59# Prevent LIBS from being used for all link targets 60LIBS = $(BLANK_AT_MAKETIME) 61 62include Makefile.soname 63 64AM_CPPFLAGS += -DBUILDING_LIBCURL 65AM_LDFLAGS = 66AM_CFLAGS = 67 68# Makefile.inc provides the CSOURCES and HHEADERS defines 69include Makefile.inc 70 71if USE_UNITY 72# Keep these separate to avoid duplicate definitions when linking libtests 73# in static mode. 74curl_EXCLUDE = curl_threads.c timediff.c warnless.c 75if DEBUGBUILD 76# We must compile these sources separately to avoid memdebug.h redefinitions 77# applying to them. 78curl_EXCLUDE += memdebug.c curl_multibyte.c 79endif 80libcurl_unity.c: $(top_srcdir)/scripts/mk-unity.pl $(CSOURCES) 81 @PERL@ $(top_srcdir)/scripts/mk-unity.pl $(srcdir) $(CSOURCES) --exclude $(curl_EXCLUDE) > libcurl_unity.c 82 83nodist_libcurl_la_SOURCES = libcurl_unity.c 84libcurl_la_SOURCES = $(curl_EXCLUDE) 85nodist_libcurlu_la_SOURCES = libcurl_unity.c 86libcurlu_la_SOURCES = $(curl_EXCLUDE) 87CLEANFILES = libcurl_unity.c 88else 89libcurl_la_SOURCES = $(CSOURCES) $(HHEADERS) 90libcurlu_la_SOURCES = $(CSOURCES) $(HHEADERS) 91endif 92 93libcurl_la_CPPFLAGS_EXTRA = 94libcurl_la_LDFLAGS_EXTRA = 95libcurl_la_CFLAGS_EXTRA = 96 97if CURL_LT_SHLIB_USE_VERSION_INFO 98libcurl_la_LDFLAGS_EXTRA += $(VERSIONINFO) 99endif 100 101if CURL_LT_SHLIB_USE_NO_UNDEFINED 102libcurl_la_LDFLAGS_EXTRA += -no-undefined 103endif 104 105if CURL_LT_SHLIB_USE_MIMPURE_TEXT 106libcurl_la_LDFLAGS_EXTRA += -mimpure-text 107endif 108 109if CURL_LT_SHLIB_USE_VERSIONED_SYMBOLS 110libcurl_la_LDFLAGS_EXTRA += -Wl,--version-script=libcurl.vers 111else 112# if symbol-hiding is enabled, hide them! 113if DOING_CURL_SYMBOL_HIDING 114libcurl_la_LDFLAGS_EXTRA += -export-symbols-regex '^curl_.*' 115endif 116endif 117 118if USE_CPPFLAG_CURL_STATICLIB 119libcurl_la_CPPFLAGS_EXTRA += -DCURL_STATICLIB 120else 121if HAVE_WINDRES 122libcurl_la_SOURCES += $(LIB_RCFILES) 123$(LIB_RCFILES): $(top_srcdir)/include/curl/curlver.h 124endif 125endif 126 127if DOING_CURL_SYMBOL_HIDING 128libcurl_la_CPPFLAGS_EXTRA += -DCURL_HIDDEN_SYMBOLS 129libcurl_la_CFLAGS_EXTRA += $(CFLAG_CURL_SYMBOL_HIDING) 130endif 131 132libcurl_la_CPPFLAGS = $(AM_CPPFLAGS) $(libcurl_la_CPPFLAGS_EXTRA) 133libcurl_la_LDFLAGS = $(AM_LDFLAGS) $(libcurl_la_LDFLAGS_EXTRA) $(CURL_LDFLAGS_LIB) $(LIBCURL_PC_LIBS_PRIVATE) 134libcurl_la_CFLAGS = $(AM_CFLAGS) $(libcurl_la_CFLAGS_EXTRA) 135 136libcurlu_la_CPPFLAGS = $(AM_CPPFLAGS) -DCURL_STATICLIB -DUNITTESTS 137libcurlu_la_LDFLAGS = $(AM_LDFLAGS) -static $(LIBCURL_PC_LIBS_PRIVATE) 138libcurlu_la_CFLAGS = $(AM_CFLAGS) 139 140CHECKSRC = $(CS_$(V)) 141CS_0 = @echo " RUN " $@; 142CS_1 = 143CS_ = $(CS_0) 144 145checksrc: 146 $(CHECKSRC)(@PERL@ $(top_srcdir)/scripts/checksrc.pl -D$(srcdir) \ 147 -W$(srcdir)/libcurl_unity.c -W$(srcdir)/curl_config.h $(srcdir)/*.[ch] \ 148 $(srcdir)/vauth/*.[ch] $(srcdir)/vtls/*.[ch] $(srcdir)/vquic/*.[ch] \ 149 $(srcdir)/vssh/*.[ch]) 150 151if DEBUGBUILD 152# for debug builds, we scan the sources on all regular make invokes 153all-local: checksrc 154endif 155 156# disable the tests that are mostly causing false positives 157TIDYFLAGS := -checks=-clang-analyzer-security.insecureAPI.strcpy,-clang-analyzer-optin.performance.Padding,-clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling -quiet 158if CURL_WERROR 159TIDYFLAGS += --warnings-as-errors=* 160endif 161 162TIDY := clang-tidy 163 164tidy: 165 $(TIDY) $(CSOURCES) $(TIDYFLAGS) $(CURL_CLANG_TIDYFLAGS) -- $(AM_CPPFLAGS) $(CPPFLAGS) -DHAVE_CONFIG_H 166 167optiontable: 168 perl optiontable.pl < $(top_srcdir)/include/curl/curl.h > easyoptions.c 169 170if HAVE_WINDRES 171.rc.lo: 172 $(LIBTOOL) --tag=RC --mode=compile $(RC) -I$(top_srcdir)/include $(RCFLAGS) -i $< -o $@ 173endif 174