aboutsummaryrefslogtreecommitdiff
path: root/src/Makefile.m32
diff options
context:
space:
mode:
authorGuenter Knauf <lists@gknw.net>2012-07-03 12:56:41 +0200
committerGuenter Knauf <lists@gknw.net>2012-07-03 12:56:41 +0200
commit1ba5712f8823a3cb587cb75d2053a16daa9cdfe6 (patch)
tree75fbf5085e5662afc48253dcbb57278e1912a9bd /src/Makefile.m32
parent32b4896107204a372838607d431adab631a1ddca (diff)
MinGW makefile tweaks for running from sh.
Added function macros to make path converting easier. Added CROSSPREFIX to all compile tools.
Diffstat (limited to 'src/Makefile.m32')
-rw-r--r--src/Makefile.m3263
1 files changed, 44 insertions, 19 deletions
diff --git a/src/Makefile.m32 b/src/Makefile.m32
index e74a4188d..8cecfc31c 100644
--- a/src/Makefile.m32
+++ b/src/Makefile.m32
@@ -59,24 +59,49 @@ ifndef ARCH
ARCH = w32
endif
-CC = gcc
-CFLAGS = -g -O2 -Wall
-CFLAGS += -fno-strict-aliasing
+CC = $(CROSSPREFIX)gcc
+CFLAGS = -g -O2 -Wall
+CFLAGS += -fno-strict-aliasing
ifeq ($(ARCH),w64)
-CFLAGS += -D_AMD64_
+CFLAGS += -D_AMD64_
endif
# comment LDFLAGS below to keep debug info
-LDFLAGS = -s
-RC = windres
-RCFLAGS = --include-dir=$(PROOT)/include -O COFF -i
-
-RM = del /q /f 2>NUL
-CP = copy
+LDFLAGS = -s
+RC = $(CROSSPREFIX)windres
+RCFLAGS = --include-dir=$(PROOT)/include -O COFF -i
# We may need these someday
# PERL = perl
# 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!
@@ -123,7 +148,7 @@ endif
ifeq ($(findstring -metalink,$(CFG)),-metalink)
METALINK = 1
endif
-ifeq ($(findstring -schannel,$(CFG)),-schannel)
+ifeq ($(findstring -winssl,$(CFG)),-winssl)
SCHANNEL = 1
SSPI = 1
endif
@@ -194,9 +219,9 @@ ifdef METALINK
endif
ifdef SSPI
CFLAGS += -DUSE_WINDOWS_SSPI
-ifdef SCHANNEL
- CFLAGS += -DUSE_SCHANNEL
-endif
+ ifdef SCHANNEL
+ CFLAGS += -DUSE_SCHANNEL
+ endif
endif
ifdef SPNEGO
CFLAGS += -DHAVE_SPNEGO
@@ -239,7 +264,7 @@ RESOURCE = curl.res
all: $(curl_PROGRAMS)
curl.exe: $(RESOURCE) $(curl_OBJECTS) $(curl_DEPENDENCIES)
- -$(RM) $@
+ $(call DEL, $@)
$(CC) $(LDFLAGS) -o $@ $< $(curl_OBJECTS) $(curl_LDADD)
# We don't have nroff normally under win32
@@ -249,7 +274,7 @@ curl.exe: $(RESOURCE) $(curl_OBJECTS) $(curl_DEPENDENCIES)
hugehelp.c:
@echo Creating $@
- @$(CP) hugehelp.c.cvs $@
+ @$(call COPY, $@.cvs, $@)
%.o: %.c
$(CC) $(INCLUDES) $(CFLAGS) -c $<
@@ -259,10 +284,10 @@ hugehelp.c:
clean:
ifeq "$(wildcard hugehelp.c.cvs)" "hugehelp.c.cvs"
- -$(RM) hugehelp.c
+ @$(call DEL, hugehelp.c)
endif
- -$(RM) $(curl_OBJECTS) $(curlx_OBJECTS) $(RESOURCE)
+ @$(call DEL, $(curl_OBJECTS) $(curlx_OBJECTS) $(RESOURCE))
distclean vclean: clean
- -$(RM) $(curl_PROGRAMS)
+ @$(call DEL, $(curl_PROGRAMS))