Makefile.am (7620B)
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 ########################################################################### 24 AUTOMAKE_OPTIONS = foreign nostdinc 25 26 # remove targets if the command fails 27 .DELETE_ON_ERROR: 28 29 # Get CURL_CFILES, CURL_HFILES, CURLX_CFILES, CURLX_HFILES, CURL_RCFILES variables 30 include Makefile.inc 31 32 EXTRA_DIST = CMakeLists.txt .checksrc mk-file-embed.pl mkhelp.pl $(CURL_RCFILES) 33 34 # Specify our include paths here, and do it relative to $(top_srcdir) and 35 # $(top_builddir), to ensure that these paths which belong to the library 36 # being currently built and tested are searched before the library which 37 # might possibly already be installed in the system. 38 # 39 # $(top_srcdir)/include is for libcurl's external include files 40 # $(top_builddir)/lib is for libcurl's generated lib/curl_config.h file 41 # $(top_srcdir)/lib for libcurl's lib/curl_setup.h and other "borrowed" files 42 # $(srcdir) for generated sources to find included sources 43 44 AM_CPPFLAGS = -I$(top_srcdir)/include \ 45 -I$(top_builddir)/lib \ 46 -I$(top_srcdir)/lib \ 47 -I$(srcdir) 48 49 bin_PROGRAMS = curl 50 51 curlinfo_SOURCES = curlinfo.c 52 noinst_PROGRAMS = curlinfo 53 54 if USE_CPPFLAG_CURL_STATICLIB 55 AM_CPPFLAGS += -DCURL_STATICLIB 56 endif 57 if DEBUGBUILD 58 AM_CPPFLAGS += -DDEBUGBUILD 59 endif 60 if CURLDEBUG 61 AM_CPPFLAGS += -DCURLDEBUG 62 endif 63 64 AM_LDFLAGS = 65 if USE_UNICODE 66 UNICODEFLAG = -municode 67 endif 68 69 curl_cfiles_gen = 70 curl_hfiles_gen = 71 CLEANFILES = 72 73 if USE_CPPFLAG_CURL_STATICLIB 74 curlx_csrc = 75 curlx_hsrc = 76 else 77 # These are part of the libcurl static lib. Add them here when linking shared. 78 curlx_csrc = $(CURLX_CFILES) 79 curlx_hsrc = $(CURLX_HFILES) 80 endif 81 82 if USE_UNITY 83 curltool_unity.c: $(top_srcdir)/scripts/mk-unity.pl $(CURL_CFILES) $(curl_cfiles_gen) $(curlx_csrc) 84 @PERL@ $(top_srcdir)/scripts/mk-unity.pl --include $(CURL_CFILES) $(curl_cfiles_gen) $(curlx_csrc) > curltool_unity.c 85 86 nodist_curl_SOURCES = curltool_unity.c 87 curl_SOURCES = 88 CLEANFILES += curltool_unity.c 89 else 90 curl_SOURCES = $(CURL_CFILES) $(CURL_HFILES) $(curl_cfiles_gen) $(curl_hfiles_gen) $(curlx_csrc) $(curlx_hsrc) 91 endif 92 if HAVE_WINDRES 93 curl_SOURCES += $(CURL_RCFILES) 94 $(CURL_RCFILES): tool_version.h 95 endif 96 97 curl_LDFLAGS = $(AM_LDFLAGS) $(CURL_LDFLAGS_BIN) $(UNICODEFLAG) 98 99 # This might hold -Werror 100 CFLAGS += @CURL_CFLAG_EXTRAS@ 101 102 # Prevent LIBS from being used for all link targets 103 LIBS = $(BLANK_AT_MAKETIME) 104 105 curl_LDADD = $(top_builddir)/lib/libcurl.la @LIBCURL_PC_LIBS_PRIVATE@ 106 107 # if unit tests are enabled, build a static library to link them with 108 if BUILD_UNITTESTS 109 noinst_LTLIBRARIES = libcurltool.la 110 libcurltool_la_CPPFLAGS = $(AM_CPPFLAGS) -DCURL_STATICLIB -DUNITTESTS 111 libcurltool_la_CFLAGS = 112 libcurltool_la_LDFLAGS = -static $(LIBCURL_PC_LIBS_PRIVATE) 113 if USE_UNITY 114 libcurltool_unity.c: $(top_srcdir)/scripts/mk-unity.pl $(CURL_CFILES) $(curlx_csrc) 115 @PERL@ $(top_srcdir)/scripts/mk-unity.pl --include $(CURL_CFILES) $(curlx_csrc) > libcurltool_unity.c 116 117 nodist_libcurltool_la_SOURCES = libcurltool_unity.c 118 libcurltool_la_SOURCES = 119 CLEANFILES += libcurltool_unity.c 120 else 121 libcurltool_la_SOURCES = $(CURL_CFILES) $(CURL_HFILES) $(curlx_csrc) $(curlx_hsrc) 122 endif 123 endif 124 125 # Use absolute directory to disable VPATH 126 ASCIIPAGE=$(top_builddir)/docs/cmdline-opts/curl.txt 127 MKHELP=$(top_srcdir)/src/mkhelp.pl 128 HUGE=tool_hugehelp.c 129 130 HUGECMD = $(HUGEIT_$(V)) 131 HUGEIT_0 = @echo " HUGE " $@; 132 HUGEIT_1 = 133 HUGEIT_ = $(HUGEIT_0) 134 135 curl_CPPFLAGS = $(AM_CPPFLAGS) 136 137 if USE_MANUAL 138 # Here are the stuff to create a built-in manual 139 curl_CPPFLAGS += -DUSE_MANUAL 140 141 $(ASCIIPAGE): 142 cd $(top_builddir)/docs && $(MAKE) 143 144 if HAVE_LIBZ 145 # This generates the tool_hugehelp.c file in both uncompressed and 146 # compressed formats. 147 $(HUGE): $(ASCIIPAGE) $(MKHELP) 148 $(HUGECMD)( \ 149 echo '/* !checksrc! disable COPYRIGHT all */' > $(HUGE); \ 150 echo '/* !checksrc! disable INCLUDEDUP all */' >> $(HUGE); \ 151 echo '/* !checksrc! disable LONGLINE all */' >> $(HUGE); \ 152 echo '#include "tool_setup.h"' >> $(HUGE); \ 153 echo '#ifndef HAVE_LIBZ' >> $(HUGE); \ 154 $(PERL) $(MKHELP) < $(ASCIIPAGE) >> $(HUGE); \ 155 echo '#else' >> $(HUGE); \ 156 $(PERL) $(MKHELP) -c < $(ASCIIPAGE) >> $(HUGE); \ 157 echo '#endif /* HAVE_LIBZ */' >> $(HUGE) ) 158 else # HAVE_LIBZ 159 # This generates the tool_hugehelp.c file uncompressed only 160 $(HUGE): $(ASCIIPAGE) $(MKHELP) 161 $(HUGECMD)( \ 162 echo '/* !checksrc! disable COPYRIGHT all */' > $(HUGE); \ 163 echo '#include "tool_setup.h"' >> $(HUGE); \ 164 $(PERL) $(MKHELP) < $(ASCIIPAGE) >> $(HUGE) ) 165 endif 166 167 else # USE_MANUAL 168 # built-in manual has been disabled, make a blank file 169 $(HUGE): 170 echo '/* !checksrc! disable COPYRIGHT all */' > $(HUGE); \ 171 echo '#include "tool_hugehelp.h"' >> $(HUGE) 172 endif 173 174 curl_cfiles_gen += $(HUGE) 175 curl_hfiles_gen += tool_hugehelp.h 176 CLEANFILES += $(HUGE) 177 178 CA_EMBED_CSOURCE = tool_ca_embed.c 179 curl_cfiles_gen += $(CA_EMBED_CSOURCE) 180 CLEANFILES += $(CA_EMBED_CSOURCE) 181 if CURL_CA_EMBED_SET 182 curl_CPPFLAGS += -DCURL_CA_EMBED 183 MK_FILE_EMBED = $(top_srcdir)/src/mk-file-embed.pl 184 $(CA_EMBED_CSOURCE): $(MK_FILE_EMBED) $(CURL_CA_EMBED) 185 $(PERL) $(MK_FILE_EMBED) --var curl_ca_embed < $(CURL_CA_EMBED) > $(CA_EMBED_CSOURCE) 186 else 187 $(CA_EMBED_CSOURCE): 188 echo '/* !checksrc! disable COPYRIGHT all */' > $(CA_EMBED_CSOURCE) 189 echo 'extern const void *curl_ca_embed; const void *curl_ca_embed;' >> $(CA_EMBED_CSOURCE) 190 endif 191 192 CHECKSRC = $(CS_$(V)) 193 CS_0 = @echo " RUN " $@; 194 CS_1 = 195 CS_ = $(CS_0) 196 197 # ignore generated C files since they play by slightly different rules! 198 checksrc: 199 $(CHECKSRC)(@PERL@ $(top_srcdir)/scripts/checksrc.pl -D$(srcdir) $(CURL_CFILES) $(CURL_HFILES)) 200 201 if NOT_CURL_CI 202 if DEBUGBUILD 203 # for debug builds, we scan the sources on all regular make invokes 204 all-local: checksrc 205 endif 206 endif 207 208 # disable the tests that are mostly causing false positives 209 TIDYFLAGS := -checks=-clang-analyzer-security.insecureAPI.bzero,-clang-analyzer-security.insecureAPI.strcpy,-clang-analyzer-optin.performance.Padding,-clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling -quiet 210 if CURL_WERROR 211 TIDYFLAGS += --warnings-as-errors=* 212 endif 213 214 TIDY := clang-tidy 215 216 tidy: $(HUGE) $(CA_EMBED_CSOURCE) 217 (_curl_cfiles=`echo ' $(CURL_CFILES)' | sed -e 's/ +/ /g' -e 's| | $(srcdir)/|g'`; \ 218 $(TIDY) $$_curl_cfiles $(curl_cfiles_gen) $(TIDYFLAGS) $(CURL_CLANG_TIDYFLAGS) -- $(curl_CPPFLAGS) $(CPPFLAGS) $(AM_CPPFLAGS) -DHAVE_CONFIG_H) 219 220 listhelp: 221 (cd $(top_srcdir)/docs/cmdline-opts && make listhelp) 222 223 if HAVE_WINDRES 224 .rc.o: 225 $(RC) -I$(top_srcdir)/include $(RCFLAGS) -i $< -o $@ 226 endif 227 228 dist-hook: 229 rm -f $(distdir)/$(CA_EMBED_CSOURCE)