Fix building on MSYS2

This commit is contained in:
2015-12-12 15:30:39 +01:00
parent 3857ae0e48
commit 111e473f35
2 changed files with 32 additions and 19 deletions

View File

@@ -1,12 +1,13 @@
ifneq (,$(findstring MINGW,$(shell uname -s))) IsMinGW=$(findstring MSYS,$(shell uname -s)) $(findstring MINGW,$(shell uname -s))
ifneq (,$(IsMinGW))
RES_APP = filesync.exe RES_APP = filesync.exe
BUILDDIR = build-mingw BUILDDIR = build-mingw
else else
RES_APP = filesync RES_APP = filesync
BUILDDIR = build-linux BUILDDIR = build-linux
endif endif
VERBOSE_BUILD=false
CC = gcc CC = gcc
RM = rm -f RM = rm -f
@@ -39,8 +40,16 @@ CFLAGS = -g
LIBS = -lm LIBS = -lm
DO_CC=@$(ECHO) "CC: $@" ;\ ifeq ($(VERBOSE_BUILD),true)
$(CC) $(CFLAGS) -o $@ -c $< DO_CC=$(CC) $(CFLAGS) -o $@ -c $<
DO_CXX=$(CXX) $(CFLAGS) -o $@ -c $<
else
DO_CC=@$(ECHO) "CC: $@" ;\
$(CC) $(CFLAGS) -o $@ -c $<
DO_CXX=@$(ECHO) "CXX: $@" ;\
$(CXX) $(CFLAGS) -o $@ -c $<
endif
all: $(RES_APP) all: $(RES_APP)

View File

@@ -1,20 +1,24 @@
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <time.h>
#ifdef WIN32 #ifdef WIN32
# include <direct.h> # define _WIN32_WINNT 0x0501
# define _WIN32_WINNT 0x0501 # include <direct.h>
# include <windows.h> # include <windows.h>
# include <io.h> # include <io.h>
# include <stdio.h> # include <stdio.h>
# include <signal.h> # include <signal.h>
# include <fcntl.h> # include <fcntl.h>
# include <sys/types.h>
# include <sys/stat.h>
# include <time.h>
#else #else
# include <utime.h> # include <stdio.h>
# include <dirent.h> # include <string.h>
# include <unistd.h> # include <sys/types.h>
# include <sys/stat.h>
# include <time.h>
# include <utime.h>
# include <dirent.h>
# include <unistd.h>
#endif #endif
#include "util.h" #include "util.h"