Some MinGW makefile tweaks.
Enable build without GNU tools and with MinGW64 compiler.
This commit is contained in:
@@ -19,15 +19,20 @@ ifndef OPENSSL_PATH
|
|||||||
OPENSSL_PATH = ../../openssl-0.9.8r
|
OPENSSL_PATH = ../../openssl-0.9.8r
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
# Edit the var below to set to your architecture or set environment var.
|
||||||
|
ifndef ARCH
|
||||||
|
ARCH = w32
|
||||||
|
endif
|
||||||
|
|
||||||
# Edit the path below to point to your Distribution folder.
|
# Edit the path below to point to your Distribution folder.
|
||||||
ifndef DISTDIR
|
ifndef DISTDIR
|
||||||
DISTDIR = libssh2-$(LIBSSH2_VERSION_STR)-bin-w32
|
DISTDIR = libssh2-$(LIBSSH2_VERSION_STR)-bin-$(ARCH)
|
||||||
endif
|
endif
|
||||||
DISTARC = $(DISTDIR).zip
|
DISTARC = $(DISTDIR).zip
|
||||||
|
|
||||||
# Edit the path below to point to your Development folder.
|
# Edit the path below to point to your Development folder.
|
||||||
ifndef DEVLDIR
|
ifndef DEVLDIR
|
||||||
DEVLDIR = libssh2-$(LIBSSH2_VERSION_STR)-dev-w32
|
DEVLDIR = libssh2-$(LIBSSH2_VERSION_STR)-dev-$(ARCH)
|
||||||
endif
|
endif
|
||||||
DEVLARC = $(DEVLDIR).zip
|
DEVLARC = $(DEVLDIR).zip
|
||||||
|
|
||||||
@@ -57,22 +62,38 @@ endif
|
|||||||
# Include the version info retrieved from libssh2.h
|
# Include the version info retrieved from libssh2.h
|
||||||
-include $(OBJDIR)/version.inc
|
-include $(OBJDIR)/version.inc
|
||||||
|
|
||||||
|
ifeq ($(findstring /sh,$(SHELL)),/sh)
|
||||||
|
CP = cp -afv
|
||||||
|
# RM = rm -f
|
||||||
|
MD = mkdir
|
||||||
|
RD = rm -fr
|
||||||
|
DL = '
|
||||||
|
DS = /
|
||||||
|
else
|
||||||
|
CP = copy
|
||||||
|
RM = del /q /f 2>NUL
|
||||||
|
MD = md
|
||||||
|
RD = rd /q /s 2>NUL
|
||||||
|
XX =
|
||||||
|
DS = $(XX)\$(XX)
|
||||||
|
endif
|
||||||
|
# Here you can find a native Win32 binary of the original awk:
|
||||||
|
# http://www.gknw.net/development/prgtools/awk-20070501.zip
|
||||||
|
AWK = awk
|
||||||
|
ZIP = zip -qzr9
|
||||||
|
|
||||||
# The following line defines your compiler.
|
# The following line defines your compiler.
|
||||||
ifdef METROWERKS
|
ifdef METROWERKS
|
||||||
CC = mwcc
|
CC = mwcc
|
||||||
else
|
else
|
||||||
CC = $(CROSSPREFIX)gcc
|
CC = $(CROSSPREFIX)gcc
|
||||||
endif
|
endif
|
||||||
CP = cp -afv
|
|
||||||
# RM = rm -f
|
|
||||||
MD = mkdir
|
|
||||||
# Here you can find a native Win32 binary of the original awk:
|
|
||||||
# http://www.gknw.net/development/prgtools/awk-20070501.zip
|
|
||||||
AWK = awk
|
|
||||||
ZIP = zip -qzr9
|
|
||||||
|
|
||||||
# Global flags for all compilers
|
# Global flags for all compilers
|
||||||
CFLAGS = $(OPT) -D$(DB) -DWIN32 -DLIBSSH2_WIN32 # -DHAVE_CONFIG_H
|
CFLAGS = $(OPT) -D$(DB) -DWIN32 -DLIBSSH2_WIN32 # -DHAVE_CONFIG_H
|
||||||
|
ifeq ($(ARCH),w64)
|
||||||
|
CFLAGS += -D_AMD64_
|
||||||
|
endif
|
||||||
|
|
||||||
ifeq ($(CC),mwcc)
|
ifeq ($(CC),mwcc)
|
||||||
LD = mwld
|
LD = mwld
|
||||||
@@ -120,14 +141,6 @@ endif
|
|||||||
|
|
||||||
CFLAGS += $(INCLUDES)
|
CFLAGS += $(INCLUDES)
|
||||||
|
|
||||||
ifeq ($(findstring /sh,$(SHELL)),/sh)
|
|
||||||
DL = '
|
|
||||||
DS = /
|
|
||||||
else
|
|
||||||
XX =
|
|
||||||
DS = $(XX)\$(XX)
|
|
||||||
endif
|
|
||||||
|
|
||||||
vpath %.c . ../src
|
vpath %.c . ../src
|
||||||
|
|
||||||
# include Makefile.inc to get CSOURCES define
|
# include Makefile.inc to get CSOURCES define
|
||||||
@@ -158,38 +171,38 @@ $(OBJDIR)/version.inc: ../include/libssh2.h $(OBJDIR)
|
|||||||
@$(AWK) -f ../get_ver.awk $< > $@
|
@$(AWK) -f ../get_ver.awk $< > $@
|
||||||
|
|
||||||
dist: all $(DISTDIR) $(DISTDIR)/readme.txt
|
dist: all $(DISTDIR) $(DISTDIR)/readme.txt
|
||||||
@-mkdir $(DISTDIR)$(DS)bin
|
@-$(MD) $(DISTDIR)$(DS)bin
|
||||||
@-$(CP) ../INSTALL $(DISTDIR)
|
@-$(CP) ..$(DS)INSTALL $(DISTDIR)
|
||||||
@-$(CP) ../LICENSE $(DISTDIR)
|
@-$(CP) ..$(DS)LICENSE $(DISTDIR)
|
||||||
@-$(CP) ../README $(DISTDIR)
|
@-$(CP) ..$(DS)README $(DISTDIR)
|
||||||
@$(CP) $(TARGET).dll $(DISTDIR)/bin
|
@$(CP) $(TARGET).dll $(DISTDIR)$(DS)bin
|
||||||
@echo Creating $(DISTARC)
|
@echo Creating $(DISTARC)
|
||||||
@$(ZIP) $(DISTARC) $(DISTDIR)/* < $(DISTDIR)/readme.txt
|
@$(ZIP) $(DISTARC) $(DISTDIR)/* < $(DISTDIR)/readme.txt
|
||||||
|
|
||||||
dev: all $(DEVLDIR) $(DEVLDIR)/readme.txt
|
dev: all $(DEVLDIR) $(DEVLDIR)/readme.txt
|
||||||
@-mkdir $(DEVLDIR)$(DS)bin
|
@-$(MD) $(DEVLDIR)$(DS)bin
|
||||||
@-mkdir $(DEVLDIR)$(DS)include
|
@-$(MD)$(DEVLDIR)$(DS)include
|
||||||
@-mkdir $(DEVLDIR)$(DS)win32
|
@-$(MD) $(DEVLDIR)$(DS)win32
|
||||||
@-$(CP) ../INSTALL $(DEVLDIR)
|
@-$(CP) ..$(DS)INSTALL $(DEVLDIR)
|
||||||
@-$(CP) ../LICENSE $(DEVLDIR)
|
@-$(CP) ..$(DS)LICENSE $(DEVLDIR)
|
||||||
@-$(CP) ../README $(DEVLDIR)
|
@-$(CP) ..$(DS)README $(DEVLDIR)
|
||||||
@$(CP) $(TARGET).dll $(DEVLDIR)/bin
|
@$(CP) $(TARGET).dll $(DEVLDIR)$(DS)bin
|
||||||
@$(CP) ../include/*.h $(DEVLDIR)/include
|
@$(CP) ..$(DS)include$(DS)*.h $(DEVLDIR)$(DS)include
|
||||||
@$(CP) libssh2_config.h $(DEVLDIR)/include
|
@$(CP) libssh2_config.h $(DEVLDIR)/include
|
||||||
@$(CP) *.$(LIBEXT) $(DEVLDIR)/win32
|
@$(CP) *.$(LIBEXT) $(DEVLDIR)/win32
|
||||||
@echo Creating $(DEVLARC)
|
@echo Creating $(DEVLARC)
|
||||||
@$(ZIP) $(DEVLARC) $(DEVLDIR)/* < $(DEVLDIR)/readme.txt
|
@$(ZIP) $(DEVLARC) $(DEVLDIR)/* < $(DEVLDIR)/readme.txt
|
||||||
|
|
||||||
distclean: clean
|
distclean: clean
|
||||||
-$(RM) -r $(DISTDIR)
|
-$(RD) $(DISTDIR)
|
||||||
-$(RM) $(DISTARC)
|
-$(RM) $(DISTARC)
|
||||||
|
|
||||||
devclean: clean
|
devclean: clean
|
||||||
-$(RM) -r $(DEVLDIR)
|
-$(RD) $(DEVLDIR)
|
||||||
-$(RM) $(DEVLARC)
|
-$(RM) $(DEVLARC)
|
||||||
|
|
||||||
objclean: all
|
objclean: all
|
||||||
-$(RM) -r $(OBJDIR)
|
-$(RD) $(OBJDIR)
|
||||||
|
|
||||||
testclean: clean
|
testclean: clean
|
||||||
$(MAKE) -C test -f Makefile.win32 clean
|
$(MAKE) -C test -f Makefile.win32 clean
|
||||||
@@ -197,7 +210,7 @@ testclean: clean
|
|||||||
clean:
|
clean:
|
||||||
# -$(RM) libssh2_config.h
|
# -$(RM) libssh2_config.h
|
||||||
-$(RM) $(TARGET).dll $(TARGET).$(LIBEXT) $(TARGET)dll.$(LIBEXT)
|
-$(RM) $(TARGET).dll $(TARGET).$(LIBEXT) $(TARGET)dll.$(LIBEXT)
|
||||||
-$(RM) -r $(OBJDIR)
|
-$(RD) $(OBJDIR)
|
||||||
|
|
||||||
$(OBJDIR):
|
$(OBJDIR):
|
||||||
@$(MD) $@
|
@$(MD) $@
|
||||||
|
@@ -14,7 +14,12 @@ endif
|
|||||||
|
|
||||||
# Edit the path below to point to the base of your OpenSSL package.
|
# Edit the path below to point to the base of your OpenSSL package.
|
||||||
ifndef OPENSSL_PATH
|
ifndef OPENSSL_PATH
|
||||||
OPENSSL_PATH = ../../../openssl-0.9.8q
|
OPENSSL_PATH = ../../../openssl-0.9.8r
|
||||||
|
endif
|
||||||
|
|
||||||
|
# Edit the var below to set to your architecture or set environment var.
|
||||||
|
ifndef ARCH
|
||||||
|
ARCH = w32
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Edit the var below to enable static linking of libssh2 and libz
|
# Edit the var below to enable static linking of libssh2 and libz
|
||||||
@@ -23,7 +28,7 @@ LINK_STATIC = 1
|
|||||||
# Edit the vars below to change target settings.
|
# Edit the vars below to change target settings.
|
||||||
TARGETS = scp.exe sftp.exe sftpdir.exe ssh2.exe
|
TARGETS = scp.exe sftp.exe sftpdir.exe ssh2.exe
|
||||||
VERSION = $(LIBSSH2_VERSION)
|
VERSION = $(LIBSSH2_VERSION)
|
||||||
COPYR = (c) 2004-2010 The libssh2 project and its contributors.
|
COPYR = (c) $(LIBSSH2_COPYRIGHT_STR)
|
||||||
WWWURL = http://www.libssh2.org/
|
WWWURL = http://www.libssh2.org/
|
||||||
DESCR = libssh2 $(subst .def,,$(notdir $@)) $(LIBSSH2_VERSION_STR)
|
DESCR = libssh2 $(subst .def,,$(notdir $@)) $(LIBSSH2_VERSION_STR)
|
||||||
#STACK = 64000
|
#STACK = 64000
|
||||||
@@ -45,6 +50,26 @@ endif
|
|||||||
# Include the version info retrieved from libssh2.h
|
# Include the version info retrieved from libssh2.h
|
||||||
-include $(OBJDIR)/version.inc
|
-include $(OBJDIR)/version.inc
|
||||||
|
|
||||||
|
ifeq ($(findstring /sh,$(SHELL)),/sh)
|
||||||
|
CP = cp -afv
|
||||||
|
# RM = rm -f
|
||||||
|
MD = mkdir
|
||||||
|
RD = rm -fr
|
||||||
|
DL = '
|
||||||
|
DS = /
|
||||||
|
else
|
||||||
|
CP = copy
|
||||||
|
RM = del /q /f 2>NUL
|
||||||
|
MD = md
|
||||||
|
RD = rd /q /s 2>NUL
|
||||||
|
XX =
|
||||||
|
DS = $(XX)\$(XX)
|
||||||
|
endif
|
||||||
|
# Here you can find a native Win32 binary of the original awk:
|
||||||
|
# http://www.gknw.net/development/prgtools/awk-20070501.zip
|
||||||
|
AWK = awk
|
||||||
|
ZIP = zip -qzr9
|
||||||
|
|
||||||
# The following line defines your compiler.
|
# The following line defines your compiler.
|
||||||
ifdef METROWERKS
|
ifdef METROWERKS
|
||||||
CC = mwcc
|
CC = mwcc
|
||||||
@@ -60,6 +85,9 @@ ZIP = zip -qzr9
|
|||||||
|
|
||||||
# Global flags for all compilers
|
# Global flags for all compilers
|
||||||
CFLAGS = $(OPT) -D$(DB) -DWIN32 -DLIBSSH2_WIN32 # -DHAVE_CONFIG_H
|
CFLAGS = $(OPT) -D$(DB) -DWIN32 -DLIBSSH2_WIN32 # -DHAVE_CONFIG_H
|
||||||
|
ifeq ($(ARCH),w64)
|
||||||
|
CFLAGS += -D_AMD64_
|
||||||
|
endif
|
||||||
CFLAGS += -DWINSOCK_VERSION=MAKEWORD(2,0)
|
CFLAGS += -DWINSOCK_VERSION=MAKEWORD(2,0)
|
||||||
|
|
||||||
ifeq ($(CC),mwcc)
|
ifeq ($(CC),mwcc)
|
||||||
@@ -115,13 +143,6 @@ endif
|
|||||||
|
|
||||||
CFLAGS += $(INCLUDES)
|
CFLAGS += $(INCLUDES)
|
||||||
|
|
||||||
ifeq ($(findstring /sh,$(SHELL)),/sh)
|
|
||||||
DL = '
|
|
||||||
DS = /
|
|
||||||
else
|
|
||||||
DS = \\
|
|
||||||
endif
|
|
||||||
|
|
||||||
vpath %.c ../../example
|
vpath %.c ../../example
|
||||||
|
|
||||||
.PRECIOUS: $(OBJDIR)/%.o $(OBJDIR)/%.rc $(OBJDIR)/%.res
|
.PRECIOUS: $(OBJDIR)/%.o $(OBJDIR)/%.rc $(OBJDIR)/%.res
|
||||||
@@ -140,13 +161,13 @@ $(OBJDIR)/version.inc: ../../include/libssh2.h $(OBJDIR)
|
|||||||
@$(AWK) -f ../../get_ver.awk $< > $@
|
@$(AWK) -f ../../get_ver.awk $< > $@
|
||||||
|
|
||||||
objclean:
|
objclean:
|
||||||
-$(RM) -r $(OBJDIR)
|
-$(RD) $(OBJDIR)
|
||||||
|
|
||||||
clean: objclean
|
clean: objclean
|
||||||
-$(RM) $(TARGETS)
|
-$(RM) $(TARGETS)
|
||||||
|
|
||||||
$(OBJDIR):
|
$(OBJDIR):
|
||||||
@mkdir $@
|
$(MD) $@
|
||||||
|
|
||||||
%.exe: $(OBJDIR)/%.o $(OBJDIR)/%.res
|
%.exe: $(OBJDIR)/%.o $(OBJDIR)/%.res
|
||||||
@echo Linking $@
|
@echo Linking $@
|
||||||
|
Reference in New Issue
Block a user