1
1
Use GNU tools when compiling on Linux.
Fixed dist and dev targets.
Этот коммит содержится в:
Guenter Knauf 2012-06-12 01:03:14 +02:00
родитель 5c065bf1ff
Коммит a1c0d97ff9
2 изменённых файлов: 100 добавлений и 74 удалений

Просмотреть файл

@ -57,29 +57,39 @@ else
OBJDIR = debug
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:
# http://www.gknw.net/development/prgtools/awk-20100523.zip
AWK = awk
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.
ifdef METROWERKS
CC = mwcc
@ -87,6 +97,9 @@ else
CC = $(CROSSPREFIX)gcc
endif
# Include the version info retrieved from libssh2.h
-include $(OBJDIR)/version.inc
# Global flags for all compilers
CFLAGS = $(OPT) -D$(DB) -DLIBSSH2_WIN32 # -DHAVE_CONFIG_H
ifeq ($(ARCH),w64)
@ -191,68 +204,68 @@ $(OBJDIR)/%.o: %.c
# @echo Compiling $<
$(CC) $(CFLAGS) -c $< -o $@
$(OBJDIR)/version.inc: ../include/libssh2.h $(OBJDIR)
$(OBJDIR)/version.inc: ../get_ver.awk ../include/libssh2.h $(OBJDIR)
@echo Creating $@
@$(AWK) -f ../get_ver.awk $< > $@
@$(AWK) -f $^ > $@
dist: all $(DISTDIR) $(DISTDIR)/readme.txt
@-$(MD) $(DISTDIR)$(DS)bin
@-$(CP) ..$(DS)AUTHORS $(DISTDIR)
@-$(CP) ..$(DS)COPYING $(DISTDIR)
@-$(CP) ..$(DS)INSTALL $(DISTDIR)
@-$(CP) ..$(DS)README $(DISTDIR)
@-$(CP) ..$(DS)RELEASE-NOTES $(DEVLDIR)
@$(CP) $(TARGET).dll $(DISTDIR)$(DS)bin
@$(call MKDIR, $(DISTDIR)/bin)
@$(call CP, ../AUTHORS, $(DISTDIR))
@$(call CP, ../COPYING, $(DISTDIR))
@$(call CP, ../INSTALL, $(DISTDIR))
@$(call CP, ../README, $(DISTDIR))
@$(call CP, ../RELEASE-NOTES, $(DISTDIR))
@$(call CP, $(TARGET).dll, $(DISTDIR)/bin)
@echo Creating $(DISTARC)
@$(ZIP) $(DISTARC) $(DISTDIR)/* < $(DISTDIR)/readme.txt
dev: all $(DEVLDIR) $(DEVLDIR)/readme.txt
@-$(MD) $(DEVLDIR)$(DS)bin
@-$(MD)$(DEVLDIR)$(DS)include
@-$(MD) $(DEVLDIR)$(DS)win32
@-$(CP) ..$(DS)AUTHORS $(DISTDIR)
@-$(CP) ..$(DS)COPYING $(DISTDIR)
@-$(CP) ..$(DS)INSTALL $(DEVLDIR)
@-$(CP) ..$(DS)README $(DEVLDIR)
@-$(CP) ..$(DS)RELEASE-NOTES $(DEVLDIR)
@$(CP) $(TARGET).dll $(DEVLDIR)$(DS)bin
@$(CP) ..$(DS)include$(DS)*.h $(DEVLDIR)$(DS)include
@$(CP) libssh2_config.h $(DEVLDIR)/include
@$(CP) *.$(LIBEXT) $(DEVLDIR)/win32
@$(call MKDIR, $(DEVLDIR)/bin)
@$(call MKDIR,$(DEVLDIR)/include)
@$(call MKDIR, $(DEVLDIR)/win32)
@$(call CP, ../AUTHORS, $(DEVLDIR))
@$(call CP, ../COPYING, $(DEVLDIR))
@$(call CP, ../INSTALL, $(DEVLDIR))
@$(call CP, ../README, $(DEVLDIR))
@$(call CP, ../RELEASE-NOTES, $(DEVLDIR))
@$(call CP, $(TARGET).dll, $(DEVLDIR)/bin)
@$(call CP, ../include/*.h, $(DEVLDIR)/include)
@$(call CP, libssh2_config.h, $(DEVLDIR)/include)
@$(call CP, *.$(LIBEXT), $(DEVLDIR)/win32)
@echo Creating $(DEVLARC)
@$(ZIP) $(DEVLARC) $(DEVLDIR)/* < $(DEVLDIR)/readme.txt
distclean: clean
-$(RD) $(DISTDIR)
-$(RM) $(DISTARC)
$(call RMDIR, $(DISTDIR))
$(call DEL, $(DISTARC))
devclean: clean
-$(RD) $(DEVLDIR)
-$(RM) $(DEVLARC)
$(call RMDIR, $(DEVLDIR))
$(call DEL, $(DEVLARC))
objclean: all
-$(RD) $(OBJDIR)
$(call RMDIR, $(OBJDIR))
testclean: clean
$(MAKE) -C test -f GNUmakefile clean
clean:
# -$(RM) libssh2_config.h
-$(RM) $(TARGET).dll $(TARGET).$(LIBEXT) $(TARGET)dll.$(LIBEXT)
-$(RD) $(OBJDIR)
# $(call DEL, libssh2_config.h)
$(call DEL, $(TARGET).dll $(TARGET).$(LIBEXT) $(TARGET)dll.$(LIBEXT))
$(call RMDIR, $(OBJDIR))
$(OBJDIR):
@$(MD) $@
@$(call MKDIR, $@)
$(DISTDIR):
@$(MD) $@
@$(call MKDIR, $@)
$(DEVLDIR):
@$(MD) $@
@$(call MKDIR, $@)
$(TARGET).$(LIBEXT): $(OBJS)
@echo Creating $@
@-$(RM) $@
@$(call DEL, $@)
@$(AR) $(ARFLAGS) $@ $^
ifdef RANLIB
@$(RANLIB) $@
@ -260,7 +273,7 @@ endif
$(TARGET).dll $(TARGET)dll.a: $(OBJL)
@echo Linking $@
@-$(RM) $@
@$(call DEL, $@)
@$(LD) $(LDFLAGS) $^ -o $@ $(LIBPATH) $(LDLIBS)

Просмотреть файл

@ -48,29 +48,39 @@ else
OBJDIR = debug
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:
# http://www.gknw.net/development/prgtools/awk-20100523.zip
AWK = awk
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.
ifdef METROWERKS
CC = mwcc
@ -78,6 +88,9 @@ else
CC = $(CROSSPREFIX)gcc
endif
# Include the version info retrieved from libssh2.h
-include $(OBJDIR)/version.inc
# Global flags for all compilers
CFLAGS = $(OPT) -D$(DB) -DLIBSSH2_WIN32 # -DHAVE_CONFIG_H
ifeq ($(ARCH),w64)
@ -182,17 +195,17 @@ $(OBJDIR)/version.inc: ../../include/libssh2.h $(OBJDIR)
@$(AWK) -f ../../get_ver.awk $< > $@
objclean:
-$(RD) $(OBJDIR)
$(call RMDIR, $(OBJDIR))
clean: objclean
-$(RM) $(TARGETS)
$(call DEL, $(TARGETS))
$(OBJDIR):
$(MD) $@
$(call MKDIR, $@)
%.exe: $(OBJDIR)/%.o $(OBJDIR)/%.res
@echo Linking $@
@-$(RM) $@
@$(call DEL, $@)
$(LD) $(LDFLAGS) $^ -o $@ $(LIBPATH) $(LDLIBS)
$(OBJDIR)/%.res: $(OBJDIR)/%.rc