Makefile.am 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  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. # remove targets if the command fails
  26. .DELETE_ON_ERROR:
  27. # Specify our include paths here, and do it relative to $(top_srcdir) and
  28. # $(top_builddir), to ensure that these paths which belong to the library
  29. # being currently built and tested are searched before the library which
  30. # might possibly already be installed in the system.
  31. #
  32. # $(top_srcdir)/include is for libcurl's external include files
  33. # $(top_builddir)/lib is for libcurl's generated lib/curl_config.h file
  34. # $(top_builddir)/src is for curl's generated src/curl_config.h file
  35. # $(top_srcdir)/lib for libcurl's lib/curl_setup.h and other "borrowed" files
  36. # $(top_srcdir)/src is for curl's src/tool_setup.h and "curl-private" files
  37. AM_CPPFLAGS = -I$(top_srcdir)/include \
  38. -I$(top_builddir)/lib \
  39. -I$(top_builddir)/src \
  40. -I$(top_srcdir)/lib \
  41. -I$(top_srcdir)/src
  42. bin_PROGRAMS = curl
  43. SUBDIRS = ../docs
  44. if USE_CPPFLAG_CURL_STATICLIB
  45. AM_CPPFLAGS += -DCURL_STATICLIB
  46. endif
  47. include Makefile.inc
  48. # CURL_FILES comes from Makefile.inc
  49. curl_SOURCES = $(CURL_FILES)
  50. if HAVE_WINDRES
  51. curl_SOURCES += $(CURL_RCFILES)
  52. $(CURL_RCFILES): tool_version.h
  53. endif
  54. # This might hold -Werror
  55. CFLAGS += @CURL_CFLAG_EXTRAS@
  56. # Prevent LIBS from being used for all link targets
  57. LIBS = $(BLANK_AT_MAKETIME)
  58. if USE_EXPLICIT_LIB_DEPS
  59. curl_LDADD = $(top_builddir)/lib/libcurl.la @LIBCURL_LIBS@
  60. else
  61. curl_LDADD = $(top_builddir)/lib/libcurl.la @NSS_LIBS@ @SSL_LIBS@ @ZLIB_LIBS@ @CURL_NETWORK_AND_TIME_LIBS@
  62. endif
  63. # if unit tests are enabled, build a static library to link them with
  64. if BUILD_UNITTESTS
  65. noinst_LTLIBRARIES = libcurltool.la
  66. libcurltool_la_CPPFLAGS = $(AM_CPPFLAGS) \
  67. -DCURL_STATICLIB -DUNITTESTS
  68. libcurltool_la_CFLAGS =
  69. libcurltool_la_LDFLAGS = -static $(LINKFLAGS)
  70. libcurltool_la_SOURCES = $(CURL_FILES)
  71. endif
  72. CLEANFILES = tool_hugehelp.c
  73. # Use the C locale to ensure that only ASCII characters appear in the
  74. # embedded text.
  75. NROFF=env LC_ALL=C @NROFF@ @MANOPT@ # figured out by the configure script
  76. EXTRA_DIST = mkhelp.pl \
  77. Makefile.mk curl.rc Makefile.inc CMakeLists.txt
  78. # Use absolute directory to disable VPATH
  79. MANPAGE=$(abs_top_builddir)/docs/curl.1
  80. MKHELP=$(top_srcdir)/src/mkhelp.pl
  81. HUGE=tool_hugehelp.c
  82. HUGECMD = $(HUGEIT_$(V))
  83. HUGEIT_0 = @echo " HUGE " $@;
  84. HUGEIT_1 =
  85. HUGEIT_ = $(HUGEIT_0)
  86. CHECKSRC = $(CS_$(V))
  87. CS_0 = @echo " RUN " $@;
  88. CS_1 =
  89. CS_ = $(CS_0)
  90. if USE_MANUAL
  91. # Here are the stuff to create a built-in manual
  92. $(MANPAGE):
  93. cd $(top_builddir)/docs && $(MAKE)
  94. if HAVE_LIBZ
  95. # This generates the tool_hugehelp.c file in both uncompressed and
  96. # compressed formats.
  97. $(HUGE): $(MANPAGE) $(MKHELP)
  98. $(HUGECMD) (echo '#include "tool_setup.h"' > $(HUGE); \
  99. echo '#ifndef HAVE_LIBZ' >> $(HUGE); \
  100. $(NROFF) $(MANPAGE) | $(PERL) $(MKHELP) >> $(HUGE); \
  101. echo '#else' >> $(HUGE); \
  102. $(NROFF) $(MANPAGE) | $(PERL) $(MKHELP) -c >> $(HUGE); \
  103. echo '#endif /* HAVE_LIBZ */' >> $(HUGE) )
  104. else # HAVE_LIBZ
  105. # This generates the tool_hugehelp.c file uncompressed only
  106. $(HUGE): $(MANPAGE) $(MKHELP)
  107. $(HUGECMD)(echo '#include "tool_setup.h"' > $(HUGE); \
  108. $(NROFF) $(MANPAGE) | $(PERL) $(MKHELP) >> $(HUGE) )
  109. endif
  110. else # USE_MANUAL
  111. # built-in manual has been disabled, make a blank file
  112. $(HUGE):
  113. echo '#include "tool_hugehelp.h"' >> $(HUGE)
  114. endif
  115. # ignore tool_hugehelp.c since it is generated source code and it plays
  116. # by slightly different rules!
  117. checksrc:
  118. $(CHECKSRC)(@PERL@ $(top_srcdir)/scripts/checksrc.pl -D$(srcdir) \
  119. -W$(srcdir)/tool_hugehelp.c $(srcdir)/*.[ch])
  120. if CURLDEBUG
  121. # for debug builds, we scan the sources on all regular make invokes
  122. all-local: checksrc
  123. endif
  124. # disable the tests that are mostly causing false positives
  125. TIDYFLAGS=-checks=-clang-analyzer-security.insecureAPI.strcpy,-clang-analyzer-optin.performance.Padding,-clang-analyzer-valist.Uninitialized,-clang-analyzer-core.NonNullParamChecker,-clang-analyzer-core.NullDereference
  126. TIDY:=clang-tidy
  127. tidy:
  128. $(TIDY) $(CURL_CFILES) $(TIDYFLAGS) -- $(curl_CPPFLAGS) $(CPPFLAGS) -DHAVE_CONFIG_H
  129. listhelp:
  130. (cd $(top_srcdir)/docs/cmdline-opts && ./gen.pl listhelp *.d) > tool_listhelp.c
  131. if HAVE_WINDRES
  132. .rc.o:
  133. $(RC) -I$(top_srcdir)/include -DCURL_EMBED_MANIFEST $(RCFLAGS) -i $< -o $@
  134. endif