mirror of
https://github.com/curl/curl.git
synced 2025-01-30 14:22:33 +08:00
784400806c
After this patch, we reduce the three copies of most `Makefile.m32` logic to one. This now resides in `lib/Makefile.m32`. It makes future updates easier, the code shorter, with a small amount of added complexity. `Makefile.m32` reduction: | | bytes | LOC total | blank | comment | code | |-------------------|-------:|----------:|-------:|---------:|------:| | 7.85.0 | 34772 | 1337 | 79 | 192 | 1066 | | before this patch | 17601 | 625 | 62 | 106 | 457 | | after this patch | 11680 | 392 | 52 | 104 | 236 | Details: - Change rules to create objects for the `v*` subdirs in the `lib` dir. This allows to use a shared compile rule and assumes that filenames are not (and will not be) colliding across these directories. `Makefile.m32` now also stores a list of these subdirs. They are changing rarely though. - Sync as much as possible between the three `Makefile.m32` scripts' rules and their source/target sections. - After this patch `CPPFLAGS` are all applied to the `src` sources once again. This matches the behaviour of cmake/autotools. Only zlib ones are actually required there. - Use `.rc` names from `Makefile.inc` instead of keeping a duplicate. - Change examples to link `libcurl.dll` by default. This makes building trivial, even as a cross-build: `CC=x86_64-w64-mingw32-gcc make -f Makefile.m32` To run them, you need to move/copy or add-to-path `libcurl.dll`. You can select static mode via `CFG=-static`. - List more of the `Makefile.m32` config variables. - Drop `.rc` support from examples. It made it fragile without much benefit. - Include a necessary system lib for the `externalsocket.c` example. - Exclude unnecessary systems libs when building in `-dyn` mode. Closes #9642
59 lines
1.7 KiB
Makefile
59 lines
1.7 KiB
Makefile
#***************************************************************************
|
|
# _ _ ____ _
|
|
# Project ___| | | | _ \| |
|
|
# / __| | | | |_) | |
|
|
# | (__| |_| | _ <| |___
|
|
# \___|\___/|_| \_\_____|
|
|
#
|
|
# Copyright (C) 1999 - 2022, Daniel Stenberg, <daniel@haxx.se>, et al.
|
|
#
|
|
# This software is licensed as described in the file COPYING, which
|
|
# you should have received as part of this distribution. The terms
|
|
# are also available at https://curl.se/docs/copyright.html.
|
|
#
|
|
# You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
|
# copies of the Software, and permit persons to whom the Software is
|
|
# furnished to do so, under the terms of the COPYING file.
|
|
#
|
|
# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
|
# KIND, either express or implied.
|
|
#
|
|
# SPDX-License-Identifier: curl
|
|
#
|
|
#***************************************************************************
|
|
|
|
# Build libcurl via lib/Makefile.m32 first.
|
|
|
|
PROOT := ../..
|
|
|
|
LDFLAGS += -L$(PROOT)/lib
|
|
LIBS += -lcurl
|
|
|
|
ifeq ($(findstring -static,$(CFG)),)
|
|
curl_DEPENDENCIES += $(PROOT)/lib/libcurl.dll.a
|
|
DYN := 1
|
|
else
|
|
curl_DEPENDENCIES := $(PROOT)/lib/libcurl.a
|
|
CPPFLAGS += -DCURL_STATICLIB
|
|
LDFLAGS += -static
|
|
endif
|
|
|
|
LIBS += -lws2_32
|
|
|
|
### Sources and targets
|
|
|
|
# Provides check_PROGRAMS
|
|
include Makefile.inc
|
|
|
|
TARGETS := $(patsubst %,%.exe,$(strip $(check_PROGRAMS) synctime))
|
|
TOCLEAN := $(TARGETS:.exe=.o)
|
|
|
|
### Local rules
|
|
|
|
%.exe: %.o $(curl_DEPENDENCIES)
|
|
$(CC) $(LDFLAGS) $(CURL_LDFLAGS_BIN) -o $@ $< $(LIBS)
|
|
|
|
### Global script
|
|
|
|
include $(PROOT)/lib/Makefile.m32
|