[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[cdt-patch] Patch: multi-arch CDT build
|
We're interested in doing builds for Linux on non-x86 architectures.
Also, we need to be able to rebuild all the native code at one time.
I've updated all the native build code to make these things possible.
This patch is the first step in submitting all of this.
This patch changes org.eclipse.cdt.core.linux to conform to what I
think is a reasonable approach to building the native code for
Eclipse.
The basic idea is that each Makefile will take certain parameters:
JAVA_HOME, OS, ARCH, and WS. Then we derive the information we need
(e.g., -I option for JNI headers, or install directory for .so) from
these.
The next step is to add a `native.xml' where appropriate so that the
native builds can be driven by ant; I have code for that too.
The `mkdir's in the appended patch are there because the output
directory might not always exist. For instance, that was the case
when I built on ppc.
Tom
Index: ChangeLog
from Tom Tromey <tromey@xxxxxxxxxx>
* library/Makefile (OS): New macro.
(ARCH): Likewise.
(JDK_INCLUDES, JDK_OS_INCLUDES): Define; don't check to see if
they are set externally.
(INSTALL_DIR): New macro.
(LIB_NAME_FULL_SPAWNER): Use it.
(LIB_NAME_FULL_PTY): Likewise.
($(LIB_NAME_FULL_SPAWNER)): Make output directory.
($(LIB_NAME_FULL_PTY)): Likewise.
Index: library/Makefile
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core.linux/library/Makefile,v
retrieving revision 1.6
diff -u -r1.6 Makefile
--- library/Makefile 10 Oct 2002 19:45:03 -0000 1.6
+++ library/Makefile 30 Jan 2003 19:16:21 -0000
@@ -1,29 +1,28 @@
# makefile for libspawner.so
-# set JDK_INCLUDES if they are not already set in the environment
-# spit out a warning if the make script will be using the default values
-ifeq ($(JDK_INCLUDES),)
-$(warning JDK_INCLUDES not set in environment, using default: $(JDK_INCLUDES))
-endif
-
-ifeq ($(JDK_OS_INCLUDES),)
-$(warning JDK_OS_INCLUDES not set in environment, using default: $(JDK_OS_INCLUDES))
+ifeq ($(JAVA_HOME),)
+$(warning JAVA_HOME not set in environment)
endif
+# Defaults which can be overridden.
+OS = linux
+ARCH = x86
-JDK_INCLUDES=/usr/local/jdk/include
-JDK_OS_INCLUDES=/usr/local/jdk/include/linux
+JDK_INCLUDES= $(JAVA_HOME)/include
+JDK_OS_INCLUDES= $(JAVA_HOME)/include/$(OS)
CC=gcc
CPPFLAGS = -I. -I$(JDK_INCLUDES) -I$(JDK_OS_INCLUDES)
CFLAGS +=-fpic -D_REENTRANT
+INSTALL_DIR = ../os/$(OS)/$(ARCH)
+
LIB_NAME_SPAWNER = libspawner.so
-LIB_NAME_FULL_SPAWNER = ../os/linux/x86/libspawner.so
+LIB_NAME_FULL_SPAWNER = $(INSTALL_DIR)/libspawner.so
OBJS_SPAWNER=spawner.o io.o exec_unix.o pfind.o
LIB_NAME_PTY = libpty.so
-LIB_NAME_FULL_PTY = ../os/linux/x86/libpty.so
+LIB_NAME_FULL_PTY = $(INSTALL_DIR)/libpty.so
OBJS_PTY= openpty.o pty.o ptyio.o
OBJS = $(OBJS_SPAWNER) $(OBJS_PTY)
@@ -33,9 +32,11 @@
rebuild: clean all
$(LIB_NAME_FULL_SPAWNER) : $(OBJS_SPAWNER)
+ mkdir -p $(INSTALL_DIR)
$(CC) -g -shared -Wl,-soname,$(LIB_NAME_SPAWNER) -o $(LIB_NAME_FULL_SPAWNER) $(OBJS_SPAWNER) -lc
$(LIB_NAME_FULL_PTY): $(OBJS_PTY)
+ mkdir -p $(INSTALL_DIR)
$(CC) -g -shared -Wl,-soname,$(LIB_NAME_PTY) -o $(LIB_NAME_FULL_PTY) $(OBJS_PTY)
clean :