Make crosscompiling easier

This commit is contained in:
Erik Ekman 2009-01-25 16:28:17 +00:00 committed by Erik Ekman
parent 937eaa8007
commit de617fb026
3 changed files with 13 additions and 8 deletions

View File

@ -14,8 +14,13 @@ MKDIR_FLAGS=-p
RM=rm RM=rm
RM_FLAGS=-f RM_FLAGS=-f
TARGETOS = `uname`
all: 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 install: all
$(MKDIR) $(MKDIR_FLAGS) $(DESTDIR)$(sbindir) $(MKDIR) $(MKDIR_FLAGS) $(DESTDIR)$(sbindir)
@ -35,7 +40,7 @@ uninstall:
test: all test: all
@echo "!! The check library is required for compiling and running the tests" @echo "!! The check library is required for compiling and running the tests"
@echo "!! Get it at http://check.sf.net" @echo "!! Get it at http://check.sf.net"
@(cd tests; $(MAKE) all) @(cd tests; $(MAKE) TARGETOS=$(TARGETOS) all)
clean: clean:
@echo "Cleaning..." @echo "Cleaning..."

View File

@ -5,12 +5,12 @@ CLIENT = ../bin/iodine
SERVEROBJS = iodined.o user.o fw_query.o SERVEROBJS = iodined.o user.o fw_query.o
SERVER = ../bin/iodined SERVER = ../bin/iodined
OS = `uname | tr "a-z" "A-Z"` OS = `echo $(TARGETOS) | tr "a-z" "A-Z"`
ARCH = `uname -m` ARCH = `uname -m`
LIBPATH = -L. LIBPATH = -L.
LDFLAGS = -lz `sh osflags link` $(LIBPATH) LDFLAGS = -lz `sh osflags $(TARGETOS) link` $(LIBPATH)
CFLAGS = -c -g -Wall -D$(OS) -pedantic `sh osflags cflags` CFLAGS = -c -g -Wall -D$(OS) -pedantic `sh osflags $(TARGETOS) cflags`
all: stateos $(CLIENT) $(SERVER) all: stateos $(CLIENT) $(SERVER)

View File

@ -1,9 +1,9 @@
#!/bin/sh #!/bin/sh
case $1 in case $2 in
link) link)
case `uname` in case $1 in
SunOS | solaris) SunOS | solaris)
echo '-lsocket -lnsl'; echo '-lsocket -lnsl';
;; ;;
@ -19,7 +19,7 @@ link)
esac esac
;; ;;
cflags) cflags)
case `uname` in case $1 in
BeOS) BeOS)
echo '-Dsocklen_t=int'; echo '-Dsocklen_t=int';
;; ;;