Makefile.mk 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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. # See usage in lib/Makefile.mk
  25. PROOT := ..
  26. ### Common
  27. include $(PROOT)/lib/Makefile.mk
  28. ### Local
  29. CPPFLAGS += -I$(PROOT)/lib
  30. LDFLAGS += -L$(PROOT)/lib
  31. LIBS := -lcurl $(LIBS)
  32. ### Sources and targets
  33. # Provides CURL_CFILES, CURLX_CFILES
  34. include Makefile.inc
  35. TARGETS := curl$(BIN_EXT)
  36. CURL_CFILES += $(notdir $(CURLX_CFILES))
  37. curl_OBJECTS := $(patsubst %.c,$(OBJ_DIR)/%.o,$(strip $(CURL_CFILES)))
  38. ifdef MAP
  39. CURL_MAP := curl.map
  40. LDFLAGS += -Wl,-Map,$(CURL_MAP)
  41. TOVCLEAN := $(CURL_MAP)
  42. endif
  43. vpath %.c $(PROOT)/lib
  44. TOCLEAN := $(curl_OBJECTS)
  45. ### Rules
  46. ifneq ($(wildcard tool_hugehelp.c.cvs),)
  47. PERL ?= perl
  48. NROFF ?= groff
  49. TOCLEAN += tool_hugehelp.c
  50. ifneq ($(shell $(call WHICH, $(NROFF))),)
  51. $(PROOT)/docs/curl.1: $(wildcard $(PROOT)/docs/cmdline-opts/*.d)
  52. cd $(PROOT)/docs/cmdline-opts && \
  53. $(PERL) gen.pl mainpage $(notdir $^) > ../curl.1
  54. # Necessary for the generated tools_hugehelp.c
  55. CPPFLAGS += -DUSE_MANUAL
  56. ifdef ZLIB
  57. _MKHELPOPT += -c
  58. endif
  59. tool_hugehelp.c: $(PROOT)/docs/curl.1 mkhelp.pl
  60. $(NROFF) -man -Tascii $(MANOPT) $< | \
  61. $(PERL) mkhelp.pl $(_MKHELPOPT) $< > $@
  62. else
  63. tool_hugehelp.c:
  64. @echo Creating $@
  65. @$(call COPY, $@.cvs, $@)
  66. endif
  67. endif
  68. $(TARGETS): $(curl_OBJECTS) $(PROOT)/lib/libcurl.a
  69. $(CC) $(LDFLAGS) -o $@ $(curl_OBJECTS) $(LIBS)
  70. all: $(OBJ_DIR) $(TARGETS)