From 51a5b56701784e9d375789719a6a2fac41ce13e1 Mon Sep 17 00:00:00 2001 From: Jan Sembera Date: Sun, 10 Sep 2006 00:36:35 +0200 Subject: [PATCH] Initial rework of tree to support different architectures/OSes. --- Makefile | 20 +++++++++++++------- arch/Makefile | 5 +++++ attach.S => arch/attach-ia32-linux.S | 0 detach.S => arch/detach-ia32-linux.S | 0 getarch.sh | 14 ++++++++++++++ 5 files changed, 32 insertions(+), 7 deletions(-) create mode 100644 arch/Makefile rename attach.S => arch/attach-ia32-linux.S (100%) rename detach.S => arch/detach-ia32-linux.S (100%) create mode 100755 getarch.sh diff --git a/Makefile b/Makefile index c3dd93c..ce27f15 100644 --- a/Makefile +++ b/Makefile @@ -1,16 +1,15 @@ -CFLAGS=-Wall -g +ARCH=`./getarch.sh -arch` +OS=`./getarch.sh -os` +FULLARCH=$(ARCH)-$(OS) + +CFLAGS=-Wall -g -DARCH=$(ARCH) -DOS=$(OS) LIBS=-lutil LDFLAGS=$(LIBS) - EXE=blindtty retty - all: $(EXE) - blindtty: blindtty.o - - retty: retty.o retty.o: bc-attach.i bc-detach.i @@ -21,6 +20,13 @@ bc-attach.i: attach.o bc-detach.i: detach.o objdump -j .text -d $^ | ./bytecode.pl detach_code >$@ +attach.o: + make -f arch/Makefile attach-$(FULLARCH).o + mv attach-$(FULLARCH).o attach.o + +detach.o: + make -f arch/Makefile detach-$(FULLARCH).o + mv detach-$(FULLARCH).o detach.o clean: - rm -f *.o $(EXE) bc-attach.* bc-detach.* test + rm -f *.o $(EXE) bc-attach.* bc-detach.* test arch/*.o diff --git a/arch/Makefile b/arch/Makefile new file mode 100644 index 0000000..391c56d --- /dev/null +++ b/arch/Makefile @@ -0,0 +1,5 @@ +attach-ia32-linux.o: arch/attach-ia32-linux.o + mv arch/attach-ia32-linux.o attach-ia32-linux.o + +detach-ia32-linux.o: arch/detach-ia32-linux.o + mv arch/detach-ia32-linux.o detach-ia32-linux.o diff --git a/attach.S b/arch/attach-ia32-linux.S similarity index 100% rename from attach.S rename to arch/attach-ia32-linux.S diff --git a/detach.S b/arch/detach-ia32-linux.S similarity index 100% rename from detach.S rename to arch/detach-ia32-linux.S diff --git a/getarch.sh b/getarch.sh new file mode 100755 index 0000000..36fafad --- /dev/null +++ b/getarch.sh @@ -0,0 +1,14 @@ +#!/bin/sh + +ARCH=`uname -m` +if echo $ARCH | grep '^i.86$' >/dev/null 2>/dev/null; then + ARCH=ia32 +fi + +OS=`uname|tr [A-Z] [a-z]` + +if [ "x$1" = "x-os" ]; then + echo $OS +elif [ "x$1" = "x-arch" ]; then + echo $ARCH +fi -- 2.11.4.GIT