MinGW makefile tweaks.
Use GNU tools when compiling on Linux. Fixed dist and dev targets.
This commit is contained in:
parent
5c065bf1ff
commit
a1c0d97ff9
@ -57,29 +57,39 @@ else
|
|||||||
OBJDIR = debug
|
OBJDIR = debug
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Include the version info retrieved from libssh2.h
|
|
||||||
-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 2>NUL
|
|
||||||
RD = rd /q /s 2>NUL
|
|
||||||
XX =
|
|
||||||
DS = $(XX)\$(XX)
|
|
||||||
endif
|
|
||||||
# Here you can find a native Win32 binary of the original awk:
|
# Here you can find a native Win32 binary of the original awk:
|
||||||
# http://www.gknw.net/development/prgtools/awk-20100523.zip
|
# http://www.gknw.net/development/prgtools/awk-20100523.zip
|
||||||
AWK = awk
|
AWK = awk
|
||||||
ZIP = zip -qzr9
|
ZIP = zip -qzr9
|
||||||
|
|
||||||
|
# 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
|
||||||
|
|
||||||
# The following line defines your compiler.
|
# The following line defines your compiler.
|
||||||
ifdef METROWERKS
|
ifdef METROWERKS
|
||||||
CC = mwcc
|
CC = mwcc
|
||||||
@ -87,6 +97,9 @@ else
|
|||||||
CC = $(CROSSPREFIX)gcc
|
CC = $(CROSSPREFIX)gcc
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
# Include the version info retrieved from libssh2.h
|
||||||
|
-include $(OBJDIR)/version.inc
|
||||||
|
|
||||||
# Global flags for all compilers
|
# Global flags for all compilers
|
||||||
CFLAGS = $(OPT) -D$(DB) -DLIBSSH2_WIN32 # -DHAVE_CONFIG_H
|
CFLAGS = $(OPT) -D$(DB) -DLIBSSH2_WIN32 # -DHAVE_CONFIG_H
|
||||||
ifeq ($(ARCH),w64)
|
ifeq ($(ARCH),w64)
|
||||||
@ -191,68 +204,68 @@ $(OBJDIR)/%.o: %.c
|
|||||||
# @echo Compiling $<
|
# @echo Compiling $<
|
||||||
$(CC) $(CFLAGS) -c $< -o $@
|
$(CC) $(CFLAGS) -c $< -o $@
|
||||||
|
|
||||||
$(OBJDIR)/version.inc: ../include/libssh2.h $(OBJDIR)
|
$(OBJDIR)/version.inc: ../get_ver.awk ../include/libssh2.h $(OBJDIR)
|
||||||
@echo Creating $@
|
@echo Creating $@
|
||||||
@$(AWK) -f ../get_ver.awk $< > $@
|
@$(AWK) -f $^ > $@
|
||||||
|
|
||||||
dist: all $(DISTDIR) $(DISTDIR)/readme.txt
|
dist: all $(DISTDIR) $(DISTDIR)/readme.txt
|
||||||
@-$(MD) $(DISTDIR)$(DS)bin
|
@$(call MKDIR, $(DISTDIR)/bin)
|
||||||
@-$(CP) ..$(DS)AUTHORS $(DISTDIR)
|
@$(call CP, ../AUTHORS, $(DISTDIR))
|
||||||
@-$(CP) ..$(DS)COPYING $(DISTDIR)
|
@$(call CP, ../COPYING, $(DISTDIR))
|
||||||
@-$(CP) ..$(DS)INSTALL $(DISTDIR)
|
@$(call CP, ../INSTALL, $(DISTDIR))
|
||||||
@-$(CP) ..$(DS)README $(DISTDIR)
|
@$(call CP, ../README, $(DISTDIR))
|
||||||
@-$(CP) ..$(DS)RELEASE-NOTES $(DEVLDIR)
|
@$(call CP, ../RELEASE-NOTES, $(DISTDIR))
|
||||||
@$(CP) $(TARGET).dll $(DISTDIR)$(DS)bin
|
@$(call CP, $(TARGET).dll, $(DISTDIR)/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
|
||||||
@-$(MD) $(DEVLDIR)$(DS)bin
|
@$(call MKDIR, $(DEVLDIR)/bin)
|
||||||
@-$(MD)$(DEVLDIR)$(DS)include
|
@$(call MKDIR,$(DEVLDIR)/include)
|
||||||
@-$(MD) $(DEVLDIR)$(DS)win32
|
@$(call MKDIR, $(DEVLDIR)/win32)
|
||||||
@-$(CP) ..$(DS)AUTHORS $(DISTDIR)
|
@$(call CP, ../AUTHORS, $(DEVLDIR))
|
||||||
@-$(CP) ..$(DS)COPYING $(DISTDIR)
|
@$(call CP, ../COPYING, $(DEVLDIR))
|
||||||
@-$(CP) ..$(DS)INSTALL $(DEVLDIR)
|
@$(call CP, ../INSTALL, $(DEVLDIR))
|
||||||
@-$(CP) ..$(DS)README $(DEVLDIR)
|
@$(call CP, ../README, $(DEVLDIR))
|
||||||
@-$(CP) ..$(DS)RELEASE-NOTES $(DEVLDIR)
|
@$(call CP, ../RELEASE-NOTES, $(DEVLDIR))
|
||||||
@$(CP) $(TARGET).dll $(DEVLDIR)$(DS)bin
|
@$(call CP, $(TARGET).dll, $(DEVLDIR)/bin)
|
||||||
@$(CP) ..$(DS)include$(DS)*.h $(DEVLDIR)$(DS)include
|
@$(call CP, ../include/*.h, $(DEVLDIR)/include)
|
||||||
@$(CP) libssh2_config.h $(DEVLDIR)/include
|
@$(call CP, libssh2_config.h, $(DEVLDIR)/include)
|
||||||
@$(CP) *.$(LIBEXT) $(DEVLDIR)/win32
|
@$(call 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
|
||||||
-$(RD) $(DISTDIR)
|
$(call RMDIR, $(DISTDIR))
|
||||||
-$(RM) $(DISTARC)
|
$(call DEL, $(DISTARC))
|
||||||
|
|
||||||
devclean: clean
|
devclean: clean
|
||||||
-$(RD) $(DEVLDIR)
|
$(call RMDIR, $(DEVLDIR))
|
||||||
-$(RM) $(DEVLARC)
|
$(call DEL, $(DEVLARC))
|
||||||
|
|
||||||
objclean: all
|
objclean: all
|
||||||
-$(RD) $(OBJDIR)
|
$(call RMDIR, $(OBJDIR))
|
||||||
|
|
||||||
testclean: clean
|
testclean: clean
|
||||||
$(MAKE) -C test -f GNUmakefile clean
|
$(MAKE) -C test -f GNUmakefile clean
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
# -$(RM) libssh2_config.h
|
# $(call DEL, libssh2_config.h)
|
||||||
-$(RM) $(TARGET).dll $(TARGET).$(LIBEXT) $(TARGET)dll.$(LIBEXT)
|
$(call DEL, $(TARGET).dll $(TARGET).$(LIBEXT) $(TARGET)dll.$(LIBEXT))
|
||||||
-$(RD) $(OBJDIR)
|
$(call RMDIR, $(OBJDIR))
|
||||||
|
|
||||||
$(OBJDIR):
|
$(OBJDIR):
|
||||||
@$(MD) $@
|
@$(call MKDIR, $@)
|
||||||
|
|
||||||
$(DISTDIR):
|
$(DISTDIR):
|
||||||
@$(MD) $@
|
@$(call MKDIR, $@)
|
||||||
|
|
||||||
$(DEVLDIR):
|
$(DEVLDIR):
|
||||||
@$(MD) $@
|
@$(call MKDIR, $@)
|
||||||
|
|
||||||
$(TARGET).$(LIBEXT): $(OBJS)
|
$(TARGET).$(LIBEXT): $(OBJS)
|
||||||
@echo Creating $@
|
@echo Creating $@
|
||||||
@-$(RM) $@
|
@$(call DEL, $@)
|
||||||
@$(AR) $(ARFLAGS) $@ $^
|
@$(AR) $(ARFLAGS) $@ $^
|
||||||
ifdef RANLIB
|
ifdef RANLIB
|
||||||
@$(RANLIB) $@
|
@$(RANLIB) $@
|
||||||
@ -260,7 +273,7 @@ endif
|
|||||||
|
|
||||||
$(TARGET).dll $(TARGET)dll.a: $(OBJL)
|
$(TARGET).dll $(TARGET)dll.a: $(OBJL)
|
||||||
@echo Linking $@
|
@echo Linking $@
|
||||||
@-$(RM) $@
|
@$(call DEL, $@)
|
||||||
@$(LD) $(LDFLAGS) $^ -o $@ $(LIBPATH) $(LDLIBS)
|
@$(LD) $(LDFLAGS) $^ -o $@ $(LIBPATH) $(LDLIBS)
|
||||||
|
|
||||||
|
|
||||||
|
@ -48,29 +48,39 @@ else
|
|||||||
OBJDIR = debug
|
OBJDIR = debug
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Include the version info retrieved from libssh2.h
|
|
||||||
-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 2>NUL
|
|
||||||
RD = rd /q /s 2>NUL
|
|
||||||
XX =
|
|
||||||
DS = $(XX)\$(XX)
|
|
||||||
endif
|
|
||||||
# Here you can find a native Win32 binary of the original awk:
|
# Here you can find a native Win32 binary of the original awk:
|
||||||
# http://www.gknw.net/development/prgtools/awk-20100523.zip
|
# http://www.gknw.net/development/prgtools/awk-20100523.zip
|
||||||
AWK = awk
|
AWK = awk
|
||||||
ZIP = zip -qzr9
|
ZIP = zip -qzr9
|
||||||
|
|
||||||
|
# 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
|
||||||
|
|
||||||
# The following line defines your compiler.
|
# The following line defines your compiler.
|
||||||
ifdef METROWERKS
|
ifdef METROWERKS
|
||||||
CC = mwcc
|
CC = mwcc
|
||||||
@ -78,6 +88,9 @@ else
|
|||||||
CC = $(CROSSPREFIX)gcc
|
CC = $(CROSSPREFIX)gcc
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
# Include the version info retrieved from libssh2.h
|
||||||
|
-include $(OBJDIR)/version.inc
|
||||||
|
|
||||||
# Global flags for all compilers
|
# Global flags for all compilers
|
||||||
CFLAGS = $(OPT) -D$(DB) -DLIBSSH2_WIN32 # -DHAVE_CONFIG_H
|
CFLAGS = $(OPT) -D$(DB) -DLIBSSH2_WIN32 # -DHAVE_CONFIG_H
|
||||||
ifeq ($(ARCH),w64)
|
ifeq ($(ARCH),w64)
|
||||||
@ -182,17 +195,17 @@ $(OBJDIR)/version.inc: ../../include/libssh2.h $(OBJDIR)
|
|||||||
@$(AWK) -f ../../get_ver.awk $< > $@
|
@$(AWK) -f ../../get_ver.awk $< > $@
|
||||||
|
|
||||||
objclean:
|
objclean:
|
||||||
-$(RD) $(OBJDIR)
|
$(call RMDIR, $(OBJDIR))
|
||||||
|
|
||||||
clean: objclean
|
clean: objclean
|
||||||
-$(RM) $(TARGETS)
|
$(call DEL, $(TARGETS))
|
||||||
|
|
||||||
$(OBJDIR):
|
$(OBJDIR):
|
||||||
$(MD) $@
|
$(call MKDIR, $@)
|
||||||
|
|
||||||
%.exe: $(OBJDIR)/%.o $(OBJDIR)/%.res
|
%.exe: $(OBJDIR)/%.o $(OBJDIR)/%.res
|
||||||
@echo Linking $@
|
@echo Linking $@
|
||||||
@-$(RM) $@
|
@$(call DEL, $@)
|
||||||
$(LD) $(LDFLAGS) $^ -o $@ $(LIBPATH) $(LDLIBS)
|
$(LD) $(LDFLAGS) $^ -o $@ $(LIBPATH) $(LDLIBS)
|
||||||
|
|
||||||
$(OBJDIR)/%.res: $(OBJDIR)/%.rc
|
$(OBJDIR)/%.res: $(OBJDIR)/%.rc
|
||||||
|
Loading…
x
Reference in New Issue
Block a user