blob: 950a7ba2290de32be1fbcf163a5a4d5527dae8dd [file] [log] [blame]
lh9ed821d2023-04-07 01:36:19 -07001#***************************************************************************
2# _ _ ____ _
3# Project ___| | | | _ \| |
4# / __| | | | |_) | |
5# | (__| |_| | _ <| |___
6# \___|\___/|_| \_\_____|
7#
8# Copyright (C) 1998 - 2017, 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
24# remove targets if the command fails
25.DELETE_ON_ERROR:
26
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_builddir)/include/curl for generated curlbuild.h included from curl.h
33# $(top_builddir)/include for generated curlbuild.h inc. from lib/curl_setup.h
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
40AM_CPPFLAGS = -I$(top_builddir)/include/curl \
41 -I$(top_builddir)/include \
42 -I$(top_srcdir)/include \
43 -I$(top_builddir)/lib \
44 -I$(top_builddir)/src \
45 -I$(top_srcdir)/lib \
46 -I$(top_srcdir)/src
47
48bin_PROGRAMS = curl
49
50if USE_CPPFLAG_CURL_STATICLIB
51AM_CPPFLAGS += -DCURL_STATICLIB
52endif
53
54include Makefile.inc
55
56# CURL_FILES comes from Makefile.inc
57curl_SOURCES = $(CURL_FILES)
58
59# This might hold -Werror
60CFLAGS += @CURL_CFLAG_EXTRAS@
61
62# Prevent LIBS from being used for all link targets
63LIBS = $(BLANK_AT_MAKETIME)
64
65if USE_EXPLICIT_LIB_DEPS
66curl_LDADD = $(top_builddir)/lib/libcurl.la @LIBMETALINK_LIBS@ @LIBCURL_LIBS@
67else
68curl_LDADD = $(top_builddir)/lib/libcurl.la @LIBMETALINK_LIBS@ @NSS_LIBS@ @SSL_LIBS@ @ZLIB_LIBS@ @CURL_NETWORK_AND_TIME_LIBS@
69endif
70
71curl_LDFLAGS = @LIBMETALINK_LDFLAGS@
72curl_CPPFLAGS = $(AM_CPPFLAGS) $(LIBMETALINK_CPPFLAGS)
73
74@CODE_COVERAGE_RULES@
75curl_LDFLAGS += $(CODE_COVERAGE_LDFLAGS)
76CFLAGS += $(CODE_COVERAGE_CFLAGS)
77
78# if unit tests are enabled, build a static library to link them with
79if BUILD_UNITTESTS
80noinst_LTLIBRARIES = libcurltool.la
81libcurltool_la_CPPFLAGS = $(LIBMETALINK_CPPFLAGS) $(AM_CPPFLAGS) \
82 -DCURL_STATICLIB -DUNITTESTS
83libcurltool_la_CFLAGS =
84libcurltool_la_LDFLAGS = -static $(LINKFLAGS)
85libcurltool_la_SOURCES = $(curl_SOURCES)
86endif
87
88BUILT_SOURCES = tool_hugehelp.c
89CLEANFILES = tool_hugehelp.c
90# Use the C locale to ensure that only ASCII characters appear in the
91# embedded text.
92NROFF=env LC_ALL=C @NROFF@ @MANOPT@ # figured out by the configure script
93
94EXTRA_DIST = mkhelp.pl makefile.dj Makefile.b32 \
95 Makefile.m32 macos/curl.mcp.xml.sit.hqx macos/MACINSTALL.TXT \
96 macos/src/curl_GUSIConfig.cpp macos/src/macos_main.cpp makefile.amiga \
97 curl.rc Makefile.netware Makefile.inc Makefile.Watcom CMakeLists.txt
98
99# Use absolute directory to disable VPATH
100MANPAGE=$(abs_top_builddir)/docs/curl.1
101README=$(top_srcdir)/docs/MANUAL
102MKHELP=$(top_srcdir)/src/mkhelp.pl
103HUGE=tool_hugehelp.c
104
105if USE_MANUAL
106# Here are the stuff to create a built-in manual
107
108$(MANPAGE):
109 cd $(top_builddir)/docs && $(MAKE)
110
111if HAVE_LIBZ
112# This generates the tool_hugehelp.c file in both uncompressed and
113# compressed formats.
114$(HUGE): $(MANPAGE) $(README) $(MKHELP)
115 echo '#include "tool_setup.h"' > $(HUGE)
116 echo '#ifndef HAVE_LIBZ' >> $(HUGE)
117 $(NROFF) $(MANPAGE) | $(PERL) $(MKHELP) $(README) >> $(HUGE)
118 echo '#else' >> $(HUGE)
119 $(NROFF) $(MANPAGE) | $(PERL) $(MKHELP) -c $(README) >> $(HUGE)
120 echo '#endif /* HAVE_LIBZ */' >> $(HUGE)
121else # HAVE_LIBZ
122# This generates the tool_hugehelp.c file uncompressed only
123$(HUGE): $(MANPAGE) $(README) mkhelp.pl
124 echo '#include "tool_setup.h"' > $(HUGE)
125 $(NROFF) $(MANPAGE) | $(PERL) $(MKHELP) $(README) >> $(HUGE)
126endif
127
128else # USE_MANUAL
129# built-in manual has been disabled, make a blank file
130$(HUGE):
131 echo "/* built-in manual is disabled, blank function */" > $(HUGE)
132 echo '#include "tool_hugehelp.h"' >> $(HUGE)
133 echo "void hugehelp(void) {}" >>$(HUGE)
134endif
135
136# ignore tool_hugehelp.c since it is generated source code and it plays
137# by slightly different rules!
138checksrc:
139 @PERL@ $(top_srcdir)/lib/checksrc.pl -D$(srcdir) \
140 -W$(srcdir)/tool_hugehelp.c $(srcdir)/*.[ch]
141
142if CURLDEBUG
143# for debug builds, we scan the sources on all regular make invokes
144all-local: checksrc
145endif