Add support for Windows/Cygwin

This commit is based on Tom Hall's patch.
This commit is contained in:
Michel Machado 2014-05-14 09:44:36 -04:00
parent 05eceb342d
commit a41f4a0c08
4 changed files with 18 additions and 3 deletions

View File

@ -12,5 +12,12 @@ mac:
gcc -o f3write utils.o f3write.o -lm
gcc -o f3read utils.o f3read.o
cygwin:
gcc -Wall -Wno-char-subscripts -DCYGWIN -c utils.c
gcc -Wall -Wno-char-subscripts -DCYGWIN -c f3write.c
gcc -Wall -Wno-char-subscripts -DCYGWIN -c f3read.c
gcc -o f3write utils.o f3write.o -lm
gcc -o f3read utils.o f3read.o
clean:
rm -f *.o f3write f3read

4
README
View File

@ -6,6 +6,10 @@ make linux
make mac
### Compile on Windows with Cygwin
make cygwin
### Use example
./f3write /media/5EBD-5C80/

View File

@ -141,7 +141,7 @@ void print_header(FILE *f, char *name)
"\n", name);
}
#ifdef APPLE_MAC
#if defined(APPLE_MAC) || defined (CYGWIN)
#include <stdio.h>
#include <stdint.h>
@ -216,4 +216,4 @@ int lrand48_r(struct drand48_data *buffer, long int *result)
return __nrand48_r(buffer->__x, buffer, result);
}
#endif /* APPLE_MAC */
#endif /* APPLE_MAC or CYGWIN */

View File

@ -64,6 +64,10 @@ static inline int posix_fadvise(int fd, off_t offset, off_t len, int advice)
}
}
#endif /* APPLE_MAC */
#if defined(APPLE_MAC) || defined(CYGWIN)
/*
* The following functions were copied from GNU Library C to make F3
* more portable.
@ -89,6 +93,6 @@ extern int srand48_r(long int __seedval, struct drand48_data *__buffer)
extern int lrand48_r(struct drand48_data *__restrict __buffer,
long int *__restrict __result) __attribute__ ((nonnull(1, 2)));
#endif /* APPLE_MAC */
#endif /* APPLE_MAC or CYGWIN */
#endif /* HEADER_UTILS_H */