From de617fb0267854f2b6eb0293def29e1d4b35e95b Mon Sep 17 00:00:00 2001 From: Erik Ekman Date: Sun, 25 Jan 2009 16:28:17 +0000 Subject: [PATCH] Make crosscompiling easier --- Makefile | 9 +++++++-- src/Makefile | 6 +++--- src/osflags | 6 +++--- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index 2f2bd10..68eccad 100644 --- a/Makefile +++ b/Makefile @@ -14,8 +14,13 @@ MKDIR_FLAGS=-p RM=rm RM_FLAGS=-f +TARGETOS = `uname` + all: - @(cd src; $(MAKE) all) + @(cd src; $(MAKE) TARGETOS=$(TARGETOS) all) + +cross-mingw: + @(cd src; $(MAKE) TARGETOS=windows32 CC=i686-mingw32-gcc all) install: all $(MKDIR) $(MKDIR_FLAGS) $(DESTDIR)$(sbindir) @@ -35,7 +40,7 @@ uninstall: test: all @echo "!! The check library is required for compiling and running the tests" @echo "!! Get it at http://check.sf.net" - @(cd tests; $(MAKE) all) + @(cd tests; $(MAKE) TARGETOS=$(TARGETOS) all) clean: @echo "Cleaning..." diff --git a/src/Makefile b/src/Makefile index 73c42df..fe15d93 100644 --- a/src/Makefile +++ b/src/Makefile @@ -5,12 +5,12 @@ CLIENT = ../bin/iodine SERVEROBJS = iodined.o user.o fw_query.o SERVER = ../bin/iodined -OS = `uname | tr "a-z" "A-Z"` +OS = `echo $(TARGETOS) | tr "a-z" "A-Z"` ARCH = `uname -m` LIBPATH = -L. -LDFLAGS = -lz `sh osflags link` $(LIBPATH) -CFLAGS = -c -g -Wall -D$(OS) -pedantic `sh osflags cflags` +LDFLAGS = -lz `sh osflags $(TARGETOS) link` $(LIBPATH) +CFLAGS = -c -g -Wall -D$(OS) -pedantic `sh osflags $(TARGETOS) cflags` all: stateos $(CLIENT) $(SERVER) diff --git a/src/osflags b/src/osflags index d519695..0b9c3d3 100755 --- a/src/osflags +++ b/src/osflags @@ -1,9 +1,9 @@ #!/bin/sh -case $1 in +case $2 in link) - case `uname` in + case $1 in SunOS | solaris) echo '-lsocket -lnsl'; ;; @@ -19,7 +19,7 @@ link) esac ;; cflags) - case `uname` in + case $1 in BeOS) echo '-Dsocklen_t=int'; ;;