MinGW makefile tweaks for running from sh.
Added function macros to make path converting easier. Added CROSSPREFIX to all compile tools.
This commit is contained in:
@@ -75,7 +75,7 @@ ifndef ARCH
|
|||||||
ARCH = w32
|
ARCH = w32
|
||||||
endif
|
endif
|
||||||
|
|
||||||
CC = gcc
|
CC = $(CROSSPREFIX)gcc
|
||||||
CFLAGS = -g -O2 -Wall
|
CFLAGS = -g -O2 -Wall
|
||||||
CFLAGS += -fno-strict-aliasing
|
CFLAGS += -fno-strict-aliasing
|
||||||
ifeq ($(ARCH),w64)
|
ifeq ($(ARCH),w64)
|
||||||
@@ -83,11 +83,36 @@ CFLAGS += -D_AMD64_
|
|||||||
endif
|
endif
|
||||||
# comment LDFLAGS below to keep debug info
|
# comment LDFLAGS below to keep debug info
|
||||||
LDFLAGS = -s
|
LDFLAGS = -s
|
||||||
RC = windres
|
RC = $(CROSSPREFIX)windres
|
||||||
RCFLAGS = --include-dir=$(PROOT)/include -O COFF -i
|
RCFLAGS = --include-dir=$(PROOT)/include -O COFF -i
|
||||||
|
|
||||||
RM = del /q /f 2>NUL
|
# Platform-dependent helper tool macros
|
||||||
CP = copy
|
ifeq ($(findstring /sh,$(SHELL)),/sh)
|
||||||
|
DEL = rm -f $1
|
||||||
|
RMDIR = rm -fr $1
|
||||||
|
MKDIR = mkdir -p $1
|
||||||
|
COPY = -cp -afv $1 $2
|
||||||
|
#COPYR = -cp -afr $1/* $2
|
||||||
|
COPYR = -rsync -aC $1/* $2
|
||||||
|
TOUCH = touch $1
|
||||||
|
CAT = cat
|
||||||
|
ECHONL = echo ""
|
||||||
|
DL = '
|
||||||
|
else
|
||||||
|
ifeq "$(OS)" "Windows_NT"
|
||||||
|
DEL = -del 2>NUL /q /f $(subst /,\,$1)
|
||||||
|
RMDIR = -rd 2>NUL /q /s $(subst /,\,$1)
|
||||||
|
else
|
||||||
|
DEL = -del 2>NUL $(subst /,\,$1)
|
||||||
|
RMDIR = -deltree 2>NUL /y $(subst /,\,$1)
|
||||||
|
endif
|
||||||
|
MKDIR = -md 2>NUL $(subst /,\,$1)
|
||||||
|
COPY = -copy 2>NUL /y $(subst /,\,$1) $(subst /,\,$2)
|
||||||
|
COPYR = -xcopy 2>NUL /q /y /e $(subst /,\,$1) $(subst /,\,$2)
|
||||||
|
TOUCH = copy 2>&1>NUL /b $(subst /,\,$1) +,,
|
||||||
|
CAT = type
|
||||||
|
ECHONL = $(ComSpec) /c echo.
|
||||||
|
endif
|
||||||
|
|
||||||
########################################################
|
########################################################
|
||||||
## Nothing more to do below this line!
|
## Nothing more to do below this line!
|
||||||
@@ -132,6 +157,13 @@ endif
|
|||||||
ifeq ($(findstring -ipv6,$(CFG)),-ipv6)
|
ifeq ($(findstring -ipv6,$(CFG)),-ipv6)
|
||||||
IPV6 = 1
|
IPV6 = 1
|
||||||
endif
|
endif
|
||||||
|
ifeq ($(findstring -metalink,$(CFG)),-metalink)
|
||||||
|
METALINK = 1
|
||||||
|
endif
|
||||||
|
ifeq ($(findstring -winssl,$(CFG)),-winssl)
|
||||||
|
SCHANNEL = 1
|
||||||
|
SSPI = 1
|
||||||
|
endif
|
||||||
|
|
||||||
INCLUDES = -I. -I$(PROOT) -I$(PROOT)/include -I$(PROOT)/lib
|
INCLUDES = -I. -I$(PROOT) -I$(PROOT)/include -I$(PROOT)/lib
|
||||||
|
|
||||||
@@ -194,6 +226,9 @@ endif
|
|||||||
endif
|
endif
|
||||||
ifdef SSPI
|
ifdef SSPI
|
||||||
CFLAGS += -DUSE_WINDOWS_SSPI
|
CFLAGS += -DUSE_WINDOWS_SSPI
|
||||||
|
ifdef SCHANNEL
|
||||||
|
CFLAGS += -DUSE_SCHANNEL
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
ifdef SPNEGO
|
ifdef SPNEGO
|
||||||
CFLAGS += -DHAVE_SPNEGO
|
CFLAGS += -DHAVE_SPNEGO
|
||||||
@@ -225,6 +260,8 @@ include Makefile.inc
|
|||||||
check_PROGRAMS := $(patsubst %,%.exe,$(strip $(check_PROGRAMS)))
|
check_PROGRAMS := $(patsubst %,%.exe,$(strip $(check_PROGRAMS)))
|
||||||
check_PROGRAMS += ftpuploadresume.exe synctime.exe
|
check_PROGRAMS += ftpuploadresume.exe synctime.exe
|
||||||
|
|
||||||
|
.PRECIOUS: %.o
|
||||||
|
|
||||||
|
|
||||||
all: $(check_PROGRAMS)
|
all: $(check_PROGRAMS)
|
||||||
|
|
||||||
@@ -238,8 +275,8 @@ all: $(check_PROGRAMS)
|
|||||||
$(RC) $(RCFLAGS) $< -o $@
|
$(RC) $(RCFLAGS) $< -o $@
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
-$(RM) $(check_PROGRAMS:.exe=.o)
|
@$(call DEL, $(check_PROGRAMS:.exe=.o))
|
||||||
|
|
||||||
distclean vclean: clean
|
distclean vclean: clean
|
||||||
-$(RM) $(check_PROGRAMS)
|
@$(call DEL, $(check_PROGRAMS))
|
||||||
|
|
||||||
|
@@ -55,7 +55,7 @@ ifndef ARCH
|
|||||||
ARCH = w32
|
ARCH = w32
|
||||||
endif
|
endif
|
||||||
|
|
||||||
CC = gcc
|
CC = $(CROSSPREFIX)gcc
|
||||||
CFLAGS = -g -O2 -Wall
|
CFLAGS = -g -O2 -Wall
|
||||||
CFLAGS += -fno-strict-aliasing
|
CFLAGS += -fno-strict-aliasing
|
||||||
ifeq ($(ARCH),w64)
|
ifeq ($(ARCH),w64)
|
||||||
@@ -63,14 +63,39 @@ CFLAGS += -D_AMD64_
|
|||||||
endif
|
endif
|
||||||
# comment LDFLAGS below to keep debug info
|
# comment LDFLAGS below to keep debug info
|
||||||
LDFLAGS = -s
|
LDFLAGS = -s
|
||||||
AR = ar
|
AR = $(CROSSPREFIX)ar
|
||||||
RANLIB = ranlib
|
RANLIB = $(CROSSPREFIX)ranlib
|
||||||
RC = windres
|
RC = $(CROSSPREFIX)windres
|
||||||
RCFLAGS = --include-dir=$(PROOT)/include -DDEBUGBUILD=0 -O COFF -i
|
RCFLAGS = --include-dir=$(PROOT)/include -DDEBUGBUILD=0 -O COFF -i
|
||||||
STRIP = strip -g
|
STRIP = strip -g
|
||||||
|
|
||||||
RM = del /q /f 2>NUL
|
# Platform-dependent helper tool macros
|
||||||
CP = copy
|
ifeq ($(findstring /sh,$(SHELL)),/sh)
|
||||||
|
DEL = rm -f $1
|
||||||
|
RMDIR = rm -fr $1
|
||||||
|
MKDIR = mkdir -p $1
|
||||||
|
COPY = -cp -afv $1 $2
|
||||||
|
#COPYR = -cp -afr $1/* $2
|
||||||
|
COPYR = -rsync -aC $1/* $2
|
||||||
|
TOUCH = touch $1
|
||||||
|
CAT = cat
|
||||||
|
ECHONL = echo ""
|
||||||
|
DL = '
|
||||||
|
else
|
||||||
|
ifeq "$(OS)" "Windows_NT"
|
||||||
|
DEL = -del 2>NUL /q /f $(subst /,\,$1)
|
||||||
|
RMDIR = -rd 2>NUL /q /s $(subst /,\,$1)
|
||||||
|
else
|
||||||
|
DEL = -del 2>NUL $(subst /,\,$1)
|
||||||
|
RMDIR = -deltree 2>NUL /y $(subst /,\,$1)
|
||||||
|
endif
|
||||||
|
MKDIR = -md 2>NUL $(subst /,\,$1)
|
||||||
|
COPY = -copy 2>NUL /y $(subst /,\,$1) $(subst /,\,$2)
|
||||||
|
COPYR = -xcopy 2>NUL /q /y /e $(subst /,\,$1) $(subst /,\,$2)
|
||||||
|
TOUCH = copy 2>&1>NUL /b $(subst /,\,$1) +,,
|
||||||
|
CAT = type
|
||||||
|
ECHONL = $(ComSpec) /c echo.
|
||||||
|
endif
|
||||||
|
|
||||||
########################################################
|
########################################################
|
||||||
## Nothing more to do below this line!
|
## Nothing more to do below this line!
|
||||||
@@ -115,7 +140,7 @@ endif
|
|||||||
ifeq ($(findstring -ipv6,$(CFG)),-ipv6)
|
ifeq ($(findstring -ipv6,$(CFG)),-ipv6)
|
||||||
IPV6 = 1
|
IPV6 = 1
|
||||||
endif
|
endif
|
||||||
ifeq ($(findstring -schannel,$(CFG)),-schannel)
|
ifeq ($(findstring -winssl,$(CFG)),-winssl)
|
||||||
SCHANNEL = 1
|
SCHANNEL = 1
|
||||||
SSPI = 1
|
SSPI = 1
|
||||||
endif
|
endif
|
||||||
@@ -185,9 +210,9 @@ endif
|
|||||||
endif
|
endif
|
||||||
ifdef SSPI
|
ifdef SSPI
|
||||||
CFLAGS += -DUSE_WINDOWS_SSPI
|
CFLAGS += -DUSE_WINDOWS_SSPI
|
||||||
ifdef SCHANNEL
|
ifdef SCHANNEL
|
||||||
CFLAGS += -DUSE_SCHANNEL
|
CFLAGS += -DUSE_SCHANNEL
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
ifdef SPNEGO
|
ifdef SPNEGO
|
||||||
CFLAGS += -DHAVE_SPNEGO
|
CFLAGS += -DHAVE_SPNEGO
|
||||||
@@ -231,7 +256,7 @@ RESOURCE = libcurl.res
|
|||||||
all: $(libcurl_a_LIBRARY) $(libcurl_dll_LIBRARY)
|
all: $(libcurl_a_LIBRARY) $(libcurl_dll_LIBRARY)
|
||||||
|
|
||||||
$(libcurl_a_LIBRARY): $(libcurl_a_OBJECTS) $(libcurl_a_DEPENDENCIES)
|
$(libcurl_a_LIBRARY): $(libcurl_a_OBJECTS) $(libcurl_a_DEPENDENCIES)
|
||||||
-$(RM) $@
|
@$(call DEL, $@)
|
||||||
$(AR) cru $@ $(libcurl_a_OBJECTS)
|
$(AR) cru $@ $(libcurl_a_OBJECTS)
|
||||||
$(RANLIB) $@
|
$(RANLIB) $@
|
||||||
$(STRIP) $@
|
$(STRIP) $@
|
||||||
@@ -239,7 +264,7 @@ $(libcurl_a_LIBRARY): $(libcurl_a_OBJECTS) $(libcurl_a_DEPENDENCIES)
|
|||||||
# remove the last line above to keep debug info
|
# remove the last line above to keep debug info
|
||||||
|
|
||||||
$(libcurl_dll_LIBRARY): $(libcurl_a_OBJECTS) $(RESOURCE) $(libcurl_dll_DEPENDENCIES)
|
$(libcurl_dll_LIBRARY): $(libcurl_a_OBJECTS) $(RESOURCE) $(libcurl_dll_DEPENDENCIES)
|
||||||
-$(RM) $@
|
@$(call DEL, $@)
|
||||||
$(CC) $(LDFLAGS) -shared -Wl,--out-implib,$(libcurl_dll_a_LIBRARY) \
|
$(CC) $(LDFLAGS) -shared -Wl,--out-implib,$(libcurl_dll_a_LIBRARY) \
|
||||||
-o $@ $(libcurl_a_OBJECTS) $(RESOURCE) $(DLL_LIBS)
|
-o $@ $(libcurl_a_OBJECTS) $(RESOURCE) $(DLL_LIBS)
|
||||||
|
|
||||||
@@ -251,17 +276,18 @@ $(libcurl_dll_LIBRARY): $(libcurl_a_OBJECTS) $(RESOURCE) $(libcurl_dll_DEPENDENC
|
|||||||
|
|
||||||
clean:
|
clean:
|
||||||
ifeq "$(wildcard $(PROOT)/include/curl/curlbuild.h.dist)" "$(PROOT)/include/curl/curlbuild.h.dist"
|
ifeq "$(wildcard $(PROOT)/include/curl/curlbuild.h.dist)" "$(PROOT)/include/curl/curlbuild.h.dist"
|
||||||
-$(RM) $(subst /,\,$(PROOT)/include/curl/curlbuild.h)
|
@$(call DEL, $(PROOT)/include/curl/curlbuild.h)
|
||||||
endif
|
endif
|
||||||
-$(RM) $(libcurl_a_OBJECTS) $(RESOURCE)
|
@$(call DEL, $(libcurl_a_OBJECTS) $(RESOURCE))
|
||||||
|
|
||||||
distclean vclean: clean
|
distclean vclean: clean
|
||||||
-$(RM) $(libcurl_a_LIBRARY) $(libcurl_dll_LIBRARY) $(libcurl_dll_a_LIBRARY)
|
@$(call DEL, $(libcurl_a_LIBRARY) $(libcurl_dll_LIBRARY) $(libcurl_dll_a_LIBRARY))
|
||||||
|
|
||||||
|
$(PROOT)/include/curl/curlbuild.h:
|
||||||
|
@echo Creating $@
|
||||||
|
@$(call COPY, $@.dist, $@)
|
||||||
|
|
||||||
$(LIBCARES_PATH)/libcares.a:
|
$(LIBCARES_PATH)/libcares.a:
|
||||||
$(MAKE) -C $(LIBCARES_PATH) -f Makefile.m32
|
$(MAKE) -C $(LIBCARES_PATH) -f Makefile.m32
|
||||||
|
|
||||||
$(PROOT)/include/curl/curlbuild.h:
|
|
||||||
@echo Creating $@
|
|
||||||
@$(CP) $(subst /,\,$@).dist $(subst /,\,$@)
|
|
||||||
|
|
||||||
|
@@ -59,7 +59,7 @@ ifndef ARCH
|
|||||||
ARCH = w32
|
ARCH = w32
|
||||||
endif
|
endif
|
||||||
|
|
||||||
CC = gcc
|
CC = $(CROSSPREFIX)gcc
|
||||||
CFLAGS = -g -O2 -Wall
|
CFLAGS = -g -O2 -Wall
|
||||||
CFLAGS += -fno-strict-aliasing
|
CFLAGS += -fno-strict-aliasing
|
||||||
ifeq ($(ARCH),w64)
|
ifeq ($(ARCH),w64)
|
||||||
@@ -67,16 +67,41 @@ CFLAGS += -D_AMD64_
|
|||||||
endif
|
endif
|
||||||
# comment LDFLAGS below to keep debug info
|
# comment LDFLAGS below to keep debug info
|
||||||
LDFLAGS = -s
|
LDFLAGS = -s
|
||||||
RC = windres
|
RC = $(CROSSPREFIX)windres
|
||||||
RCFLAGS = --include-dir=$(PROOT)/include -O COFF -i
|
RCFLAGS = --include-dir=$(PROOT)/include -O COFF -i
|
||||||
|
|
||||||
RM = del /q /f 2>NUL
|
|
||||||
CP = copy
|
|
||||||
|
|
||||||
# We may need these someday
|
# We may need these someday
|
||||||
# PERL = perl
|
# PERL = perl
|
||||||
# NROFF = nroff
|
# NROFF = nroff
|
||||||
|
|
||||||
|
# Platform-dependent helper tool macros
|
||||||
|
ifeq ($(findstring /sh,$(SHELL)),/sh)
|
||||||
|
DEL = rm -f $1
|
||||||
|
RMDIR = rm -fr $1
|
||||||
|
MKDIR = mkdir -p $1
|
||||||
|
COPY = -cp -afv $1 $2
|
||||||
|
#COPYR = -cp -afr $1/* $2
|
||||||
|
COPYR = -rsync -aC $1/* $2
|
||||||
|
TOUCH = touch $1
|
||||||
|
CAT = cat
|
||||||
|
ECHONL = echo ""
|
||||||
|
DL = '
|
||||||
|
else
|
||||||
|
ifeq "$(OS)" "Windows_NT"
|
||||||
|
DEL = -del 2>NUL /q /f $(subst /,\,$1)
|
||||||
|
RMDIR = -rd 2>NUL /q /s $(subst /,\,$1)
|
||||||
|
else
|
||||||
|
DEL = -del 2>NUL $(subst /,\,$1)
|
||||||
|
RMDIR = -deltree 2>NUL /y $(subst /,\,$1)
|
||||||
|
endif
|
||||||
|
MKDIR = -md 2>NUL $(subst /,\,$1)
|
||||||
|
COPY = -copy 2>NUL /y $(subst /,\,$1) $(subst /,\,$2)
|
||||||
|
COPYR = -xcopy 2>NUL /q /y /e $(subst /,\,$1) $(subst /,\,$2)
|
||||||
|
TOUCH = copy 2>&1>NUL /b $(subst /,\,$1) +,,
|
||||||
|
CAT = type
|
||||||
|
ECHONL = $(ComSpec) /c echo.
|
||||||
|
endif
|
||||||
|
|
||||||
########################################################
|
########################################################
|
||||||
## Nothing more to do below this line!
|
## Nothing more to do below this line!
|
||||||
|
|
||||||
@@ -123,7 +148,7 @@ endif
|
|||||||
ifeq ($(findstring -metalink,$(CFG)),-metalink)
|
ifeq ($(findstring -metalink,$(CFG)),-metalink)
|
||||||
METALINK = 1
|
METALINK = 1
|
||||||
endif
|
endif
|
||||||
ifeq ($(findstring -schannel,$(CFG)),-schannel)
|
ifeq ($(findstring -winssl,$(CFG)),-winssl)
|
||||||
SCHANNEL = 1
|
SCHANNEL = 1
|
||||||
SSPI = 1
|
SSPI = 1
|
||||||
endif
|
endif
|
||||||
@@ -194,9 +219,9 @@ ifdef METALINK
|
|||||||
endif
|
endif
|
||||||
ifdef SSPI
|
ifdef SSPI
|
||||||
CFLAGS += -DUSE_WINDOWS_SSPI
|
CFLAGS += -DUSE_WINDOWS_SSPI
|
||||||
ifdef SCHANNEL
|
ifdef SCHANNEL
|
||||||
CFLAGS += -DUSE_SCHANNEL
|
CFLAGS += -DUSE_SCHANNEL
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
ifdef SPNEGO
|
ifdef SPNEGO
|
||||||
CFLAGS += -DHAVE_SPNEGO
|
CFLAGS += -DHAVE_SPNEGO
|
||||||
@@ -239,7 +264,7 @@ RESOURCE = curl.res
|
|||||||
all: $(curl_PROGRAMS)
|
all: $(curl_PROGRAMS)
|
||||||
|
|
||||||
curl.exe: $(RESOURCE) $(curl_OBJECTS) $(curl_DEPENDENCIES)
|
curl.exe: $(RESOURCE) $(curl_OBJECTS) $(curl_DEPENDENCIES)
|
||||||
-$(RM) $@
|
$(call DEL, $@)
|
||||||
$(CC) $(LDFLAGS) -o $@ $< $(curl_OBJECTS) $(curl_LDADD)
|
$(CC) $(LDFLAGS) -o $@ $< $(curl_OBJECTS) $(curl_LDADD)
|
||||||
|
|
||||||
# We don't have nroff normally under win32
|
# We don't have nroff normally under win32
|
||||||
@@ -249,7 +274,7 @@ curl.exe: $(RESOURCE) $(curl_OBJECTS) $(curl_DEPENDENCIES)
|
|||||||
|
|
||||||
hugehelp.c:
|
hugehelp.c:
|
||||||
@echo Creating $@
|
@echo Creating $@
|
||||||
@$(CP) hugehelp.c.cvs $@
|
@$(call COPY, $@.cvs, $@)
|
||||||
|
|
||||||
%.o: %.c
|
%.o: %.c
|
||||||
$(CC) $(INCLUDES) $(CFLAGS) -c $<
|
$(CC) $(INCLUDES) $(CFLAGS) -c $<
|
||||||
@@ -259,10 +284,10 @@ hugehelp.c:
|
|||||||
|
|
||||||
clean:
|
clean:
|
||||||
ifeq "$(wildcard hugehelp.c.cvs)" "hugehelp.c.cvs"
|
ifeq "$(wildcard hugehelp.c.cvs)" "hugehelp.c.cvs"
|
||||||
-$(RM) hugehelp.c
|
@$(call DEL, hugehelp.c)
|
||||||
endif
|
endif
|
||||||
-$(RM) $(curl_OBJECTS) $(curlx_OBJECTS) $(RESOURCE)
|
@$(call DEL, $(curl_OBJECTS) $(curlx_OBJECTS) $(RESOURCE))
|
||||||
|
|
||||||
distclean vclean: clean
|
distclean vclean: clean
|
||||||
-$(RM) $(curl_PROGRAMS)
|
@$(call DEL, $(curl_PROGRAMS))
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user