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