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