• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
25# See usage in lib/Makefile.mk
26
27PROOT := ..
28
29### Common
30
31include $(PROOT)/lib/Makefile.mk
32
33### Local
34
35RCFLAGS  += -DCURL_EMBED_MANIFEST
36CPPFLAGS += -I$(PROOT)/lib
37LDFLAGS  += -L$(PROOT)/lib
38LIBS     := -lcurl $(LIBS)
39
40ifdef WIN32
41  ifneq ($(findstring -dyn,$(CFG)),)
42    DYN := 1
43  endif
44endif
45
46ifdef DYN
47  curl_DEPENDENCIES := $(PROOT)/lib/libcurl$(CURL_DLL_SUFFIX).dll
48  curl_DEPENDENCIES += $(PROOT)/lib/libcurl.dll.a
49else
50  curl_DEPENDENCIES := $(PROOT)/lib/libcurl.a
51  ifdef WIN32
52    CPPFLAGS += -DCURL_STATICLIB
53    LDFLAGS += -static
54  endif
55endif
56
57### Sources and targets
58
59# Provides CURL_CFILES, CURLX_CFILES, CURL_RCFILES
60include Makefile.inc
61
62TARGETS := curl$(BIN_EXT)
63
64CURL_CFILES += $(notdir $(CURLX_CFILES))
65
66curl_OBJECTS := $(patsubst %.c,$(OBJ_DIR)/%.o,$(strip $(CURL_CFILES)))
67ifdef WIN32
68curl_OBJECTS += $(patsubst %.rc,$(OBJ_DIR)/%.res,$(strip $(CURL_RCFILES)))
69endif
70ifdef MAP
71CURL_MAP := curl.map
72CURL_LDFLAGS_BIN += -Wl,-Map,$(CURL_MAP)
73TOVCLEAN := $(CURL_MAP)
74endif
75vpath %.c $(PROOT)/lib
76
77TOCLEAN := $(curl_OBJECTS)
78
79### Rules
80
81ifneq ($(wildcard tool_hugehelp.c.cvs),)
82PERL  ?= perl
83NROFF ?= groff
84
85TOCLEAN += tool_hugehelp.c
86
87ifneq ($(shell $(call WHICH, $(NROFF))),)
88$(PROOT)/docs/curl.1: $(wildcard $(PROOT)/docs/cmdline-opts/*.d)
89	cd $(PROOT)/docs/cmdline-opts && \
90	$(PERL) gen.pl mainpage $(notdir $^) > ../curl.1
91
92# Necessary for the generated tools_hugehelp.c
93CPPFLAGS += -DUSE_MANUAL
94
95ifdef ZLIB
96_MKHELPOPT += -c
97endif
98tool_hugehelp.c: $(PROOT)/docs/curl.1 mkhelp.pl
99	$(NROFF) -man -Tascii $(MANOPT) $< | \
100	$(PERL) mkhelp.pl $(_MKHELPOPT) $< > $@
101else
102tool_hugehelp.c:
103	@echo Creating $@
104	@$(call COPY, $@.cvs, $@)
105endif
106endif
107
108$(TARGETS): $(curl_OBJECTS) $(curl_DEPENDENCIES)
109	$(CC) $(LDFLAGS) $(CURL_LDFLAGS_BIN) -o $@ $(curl_OBJECTS) $(LIBS)
110
111all: $(OBJ_DIR) $(TARGETS)
112