Makefile.am 5.5 KB

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