From db2189f3b9c7ef6e0f7503a64a80d959156a3e43 Mon Sep 17 00:00:00 2001 From: Ryan Dahl Date: Sat, 7 May 2011 21:40:46 -0700 Subject: [PATCH] Fixes #38. Use Luis's PREFIX trick. --- Makefile | 7 +++++-- config-mingw.mk | 9 ++++++--- config-unix.mk | 7 +++---- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index 16830f2d..9886ac91 100644 --- a/Makefile +++ b/Makefile @@ -28,11 +28,11 @@ endif all: oio.a test/run-tests test/run-benchmarks -test/run-tests: test/*.h test/run-tests.c $(RUNNER_SRC) test/runner-unix.c $(TESTS) oio.a +test/run-tests$(E): test/*.h test/run-tests.c $(RUNNER_SRC) test/runner-unix.c $(TESTS) oio.a $(CC) $(RUNNER_CFLAGS) $(RUNNER_LINKFLAGS) -o test/run-tests test/run-tests.c \ test/runner.c $(RUNNER_SRC) $(TESTS) oio.a -test/run-benchmarks: test/*.h test/run-benchmarks.c test/runner.c $(RUNNER_SRC) $(BENCHMARKS) oio.a +test/run-benchmarks$(E): test/*.h test/run-benchmarks.c test/runner.c $(RUNNER_SRC) $(BENCHMARKS) oio.a $(CC) $(RUNNER_CFLAGS) $(RUNNER_LINKFLAGS) -o test/run-benchmarks test/run-benchmarks.c \ test/runner.c $(RUNNER_SRC) $(BENCHMARKS) oio.a @@ -48,3 +48,6 @@ test: test/run-tests bench: test/run-benchmarks test/run-benchmarks + +clean: + $(RM) -f *.o *.a test/run-tests$(E) test/run-benchmarks$(E) diff --git a/config-mingw.mk b/config-mingw.mk index f825d57f..8104fd4d 100644 --- a/config-mingw.mk +++ b/config-mingw.mk @@ -18,6 +18,12 @@ # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS # IN THE SOFTWARE. +# Use make -f Makefile.gcc PREFIX=i686-w64-mingw32- +# for cross compilation +CC = $(PREFIX)gcc +AR = $(PREFIX)ar +E=.exe + CFLAGS=-g --std=gnu89 LINKFLAGS=-lm TESTS=test/echo-server.c test/test-*.c @@ -33,8 +39,5 @@ oio.a: oio-win.o oio-win.o: oio-win.c oio.h oio-win.h $(CC) $(CFLAGS) -c oio-win.c -o oio-win.o -clean: - $(RM) -f *.o *.a test/run-tests.exe test/run-benchmarks.exe - distclean: $(RM) -f *.o *.a diff --git a/config-unix.mk b/config-unix.mk index bd0cb85d..1024ed44 100644 --- a/config-unix.mk +++ b/config-unix.mk @@ -18,6 +18,9 @@ # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS # IN THE SOFTWARE. +CC = $(PREFIX)gcc +AR = $(PREFIX)ar +E= CFLAGS=--std=gnu89 -g LINKFLAGS=-lm TESTS=test/echo-server.c test/test-*.c @@ -39,10 +42,6 @@ ev/ev.o: ev/config.h ev/ev.c ev/config.h: cd ev && ./configure -clean: - $(RM) -f *.o *.a test/run-tests test/run-benchmarks - $(MAKE) -C ev clean - distclean: $(RM) -f *.o *.a $(MAKE) -C ev clean