1#***************************************************************************
2#                                  _   _ ____  _
3#  Project                     ___| | | |  _ \| |
4#                             / __| | | | |_) | |
5#                            | (__| |_| |  _ <| |___
6#                             \___|\___/|_| \_\_____|
7#
8# Copyright (C) 1998 - 2020, 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.haxx.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###########################################################################
22AUTOMAKE_OPTIONS = foreign nostdinc
23
24CMAKE_DIST = CMakeLists.txt curl_config.h.cmake
25
26EXTRA_DIST = Makefile.m32 config-win32.h config-win32ce.h           \
27 config-plan9.h config-riscos.h config-mac.h curl_config.h.in       \
28 makefile.dj config-dos.h libcurl.plist libcurl.rc config-amigaos.h \
29 makefile.amiga Makefile.netware nwlib.c nwos.c config-win32ce.h    \
30 config-os400.h setup-os400.h config-symbian.h Makefile.Watcom      \
31 config-tpf.h mk-ca-bundle.pl mk-ca-bundle.vbs $(CMAKE_DIST)        \
32 firefox-db2pem.sh config-vxworks.h Makefile.vxworks checksrc.pl    \
33 setup-win32.h
34
35lib_LTLIBRARIES = libcurl.la
36
37if BUILD_UNITTESTS
38noinst_LTLIBRARIES = libcurlu.la
39else
40noinst_LTLIBRARIES =
41endif
42
43# This might hold -Werror
44CFLAGS += @CURL_CFLAG_EXTRAS@
45
46# Specify our include paths here, and do it relative to $(top_srcdir) and
47# $(top_builddir), to ensure that these paths which belong to the library
48# being currently built and tested are searched before the library which
49# might possibly already be installed in the system.
50#
51# $(top_srcdir)/include is for libcurl's external include files
52# $(top_builddir)/lib is for libcurl's generated lib/curl_config.h file
53# $(top_srcdir)/lib for libcurl's lib/curl_setup.h and other "private" files
54# $(top_builddir)/ares is for in-tree c-ares's generated ares_build.h file
55# $(top_srcdir)/ares is for in-tree c-ares's external include files
56
57AM_CPPFLAGS = -I$(top_srcdir)/include        \
58              -I$(top_builddir)/lib          \
59              -I$(top_srcdir)/lib
60
61if USE_EMBEDDED_ARES
62AM_CPPFLAGS += -I$(top_builddir)/ares        \
63               -I$(top_srcdir)/ares
64endif
65
66# Prevent LIBS from being used for all link targets
67LIBS = $(BLANK_AT_MAKETIME)
68
69VERSIONINFO=-version-info 10:0:6
70# This flag accepts an argument of the form current[:revision[:age]]. So,
71# passing -version-info 3:12:1 sets current to 3, revision to 12, and age to
72# 1.
73#
74# Here's the simplified rule guide on how to change -version-info:
75# (current version is C:R:A)
76#
77# 1. if there are only source changes, use C:R+1:A
78# 2. if interfaces were added use C+1:0:A+1
79# 3. if interfaces were removed, then use C+1:0:0
80#
81# For the full guide on libcurl ABI rules, see docs/libcurl/ABI
82
83AM_CPPFLAGS += -DBUILDING_LIBCURL
84AM_LDFLAGS =
85AM_CFLAGS =
86
87libcurl_la_CPPFLAGS_EXTRA =
88libcurl_la_LDFLAGS_EXTRA =
89libcurl_la_CFLAGS_EXTRA =
90
91if CURL_LT_SHLIB_USE_VERSION_INFO
92libcurl_la_LDFLAGS_EXTRA += $(VERSIONINFO)
93endif
94
95if CURL_LT_SHLIB_USE_NO_UNDEFINED
96libcurl_la_LDFLAGS_EXTRA += -no-undefined
97endif
98
99if CURL_LT_SHLIB_USE_MIMPURE_TEXT
100libcurl_la_LDFLAGS_EXTRA += -mimpure-text
101endif
102
103if CURL_LT_SHLIB_USE_VERSIONED_SYMBOLS
104libcurl_la_LDFLAGS_EXTRA += -Wl,--version-script=libcurl.vers
105else
106# if symbol-hiding is enabled, hide them!
107if DOING_CURL_SYMBOL_HIDING
108libcurl_la_LDFLAGS_EXTRA += -export-symbols-regex '^curl_.*'
109endif
110endif
111
112if USE_CPPFLAG_CURL_STATICLIB
113libcurl_la_CPPFLAGS_EXTRA += -DCURL_STATICLIB
114endif
115
116if DOING_CURL_SYMBOL_HIDING
117libcurl_la_CPPFLAGS_EXTRA += -DCURL_HIDDEN_SYMBOLS
118libcurl_la_CFLAGS_EXTRA += $(CFLAG_CURL_SYMBOL_HIDING)
119endif
120
121libcurl_la_CPPFLAGS = $(AM_CPPFLAGS) $(libcurl_la_CPPFLAGS_EXTRA)
122libcurl_la_LDFLAGS = $(AM_LDFLAGS) $(libcurl_la_LDFLAGS_EXTRA) $(LDFLAGS) $(LIBCURL_LIBS)
123libcurl_la_CFLAGS = $(AM_CFLAGS) $(libcurl_la_CFLAGS_EXTRA)
124
125libcurlu_la_CPPFLAGS = $(AM_CPPFLAGS) -DCURL_STATICLIB -DUNITTESTS
126libcurlu_la_LDFLAGS = $(AM_LDFLAGS) -static $(LIBCURL_LIBS)
127libcurlu_la_CFLAGS = $(AM_CFLAGS)
128
129# Makefile.inc provides the CSOURCES and HHEADERS defines
130include Makefile.inc
131
132libcurl_la_SOURCES = $(CSOURCES) $(HHEADERS)
133libcurlu_la_SOURCES = $(CSOURCES) $(HHEADERS)
134
135CHECKSRC = $(CS_$(V))
136CS_0 = @echo "  RUN     " $@;
137CS_1 =
138CS_ = $(CS_0)
139
140checksrc:
141	$(CHECKSRC)(@PERL@ $(srcdir)/checksrc.pl -D$(srcdir) -W$(srcdir)/curl_config.h \
142	$(srcdir)/*.[ch] $(srcdir)/vauth/*.[ch] $(srcdir)/vtls/*.[ch] $(srcdir)/vquic/*.[ch] $(srcdir)/vssh/*.[ch])
143
144if CURLDEBUG
145# for debug builds, we scan the sources on all regular make invokes
146all-local: checksrc
147endif
148
149# disable the tests that are mostly causing false positives
150TIDYFLAGS=-checks=-clang-analyzer-security.insecureAPI.strcpy,-clang-analyzer-optin.performance.Padding,-clang-analyzer-valist.Uninitialized,-clang-analyzer-core.NonNullParamChecker,-clang-analyzer-core.NullDereference -quiet
151
152TIDY:=clang-tidy
153
154tidy:
155	$(TIDY) $(CSOURCES) $(TIDYFLAGS) -- $(AM_CPPFLAGS) $(CPPFLAGS) -DHAVE_CONFIG_H
156