summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore2
-rw-r--r--Makefile4
-rw-r--r--Makefile.defs43
-rw-r--r--Makefile.lib22
-rw-r--r--Makefile.shared15
-rw-r--r--src/Makefile4
-rw-r--r--src/cl_driver_defs.c (renamed from src/cl_driver.c)0
-rw-r--r--src/cl_kernel.h2
-rw-r--r--src/cl_program.h2
-rw-r--r--src/intel/Makefile4
-rw-r--r--src/sim/Makefile4
-rw-r--r--src/sim/sim_driver.c4
-rw-r--r--src/sim/sim_simulator.h2
-rw-r--r--src/x11/Makefile4
14 files changed, 107 insertions, 5 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 00000000..bae14b58
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,2 @@
+*.o
+*.so*
diff --git a/Makefile b/Makefile
new file mode 100644
index 00000000..8a759214
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,4 @@
+TOP=.
+SUBDIRS=src src/sim src/intel src/x11
+
+include $(TOP)/Makefile.shared
diff --git a/Makefile.defs b/Makefile.defs
new file mode 100644
index 00000000..749198bd
--- /dev/null
+++ b/Makefile.defs
@@ -0,0 +1,43 @@
+GEN_BACKEND=$(TOP)/../gen-backend
+
+LIB_BACKEND=$(GEN_BACKEND)/libgbe.so
+INC_BACKEND=$(GEN_BACKEND)/src/backend
+
+DRM_LIBS=$(shell pkg-config libdrm_intel --libs)
+DRM_CFLAGS=$(shell pkg-config libdrm_intel --cflags)
+
+XEXT_LIBS=$(shell pkg-config x11 xfixes xext --libs)
+XEXT_CFLAGS=$(shell pkg-config x11 xfixes xext --cflags)
+
+LLVM_LIBS=$(shell llvm-config-3.0 --libs)
+LLVM_CFLAGS=$(shell llvm-config-3.0 --cflags)
+LLVM_CXXFLAGS=$(shell llvm-config-3.0 --cxxflags)
+
+LOCAL_CFLAGS=-Wall -funroll-loops -Wstrict-aliasing -fstrict-aliasing \
+ -msse2 -msse3 -mssse3 -msse4.1 -ffast-math -fPIC -Wall \
+ -DNDEBUG -DGBE_DEBUG=0 -I$(TOP)/src -I$(TOP)/include \
+ -I$(INC_BACKEND) $(DRM_CFLAGS) $(XEXT_CFLAGS)
+
+LOCAL_LIBS=$(DRM_LIBS) $(XEXT_LIBS) $(LLVM_LIBS)
+
+LOCAL_CXXFLAGS=$(LOCAL_CFLAGS) -std=c++0x -fno-rtti -Wno-invalid-offsetof
+
+CXXFLAGS=$(LOCAL_CXXFLAGS) $(LLVM_CXXFLAGS)
+
+CFLAGS=$(LOCAL_CFLAGS) $(LLVM_CFLAGS)
+
+INC=$(shell for i in $(SUBDIRS); do ls $$i/*.h* 2>/dev/null; done)
+
+C_SRC=$(shell for i in $(SUBDIRS); do ls $$i/*.c 2>/dev/null; done)
+CPP_SRC=$(shell for i in $(SUBDIRS); do ls $$i/*.cpp 2>/dev/null; done)
+
+OBJ=$(C_SRC:.c=.o) $(CPP_SRC:.cpp=.o)
+
+LIBBASE=libcl.so
+MAJOR=0
+MINOR=0
+REVISION=1
+
+VERSION=$(MAJOR).$(MINOR).$(REVISION)
+LIBMAJOR=$(LIBBASE).$(MAJOR)
+LIB=$(LIBMAJOR).$(MINOR).$(REVISION)
diff --git a/Makefile.lib b/Makefile.lib
new file mode 100644
index 00000000..2cce1a3f
--- /dev/null
+++ b/Makefile.lib
@@ -0,0 +1,22 @@
+TOP=.
+SUBDIRS=src src/sim src/intel src/x11
+include Makefile.defs
+
+LIBS=-Wl,--no-undefined $(LIB_BACKEND) $(LOCAL_LIBS) -ldl -lpthread
+
+all: $(LIB) $(LIBMAJOR) $(LIBBASE)
+
+$(LIB): $(OBJ)
+ $(CXX) $(CXXFLAGS) -shared -o $@ $(OBJ) $(LIBS)
+
+$(LIBMAJOR): $(LIB)
+ rm -f $@
+ ln -s $(LIB) $@
+
+$(LIBBASE): $(LIBMAJOR)
+ rm -f $@
+ ln -s $(LIBMAJOR) $@
+
+clean:
+ rm -f $(LIB) $(LIBMAJOR) $(LIBBASE)
+
diff --git a/Makefile.shared b/Makefile.shared
new file mode 100644
index 00000000..4b048d5c
--- /dev/null
+++ b/Makefile.shared
@@ -0,0 +1,15 @@
+include $(TOP)/Makefile.defs
+
+all: $(LIB)
+
+$(OBJ): $(INC)
+
+clean:
+ rm -f $(OBJ)
+ +cd $(TOP) && make -f Makefile.lib clean
+
+$(LIB): $(OBJ)
+ +cd $(TOP) && make -f Makefile.lib
+
+list-obj:
+ @echo $(OBJ)
diff --git a/src/Makefile b/src/Makefile
new file mode 100644
index 00000000..88aeda9b
--- /dev/null
+++ b/src/Makefile
@@ -0,0 +1,4 @@
+TOP=..
+SUBDIRS=. sim intel x11
+
+include $(TOP)/Makefile.shared
diff --git a/src/cl_driver.c b/src/cl_driver_defs.c
index 66d805d8..66d805d8 100644
--- a/src/cl_driver.c
+++ b/src/cl_driver_defs.c
diff --git a/src/cl_kernel.h b/src/cl_kernel.h
index 3d37bcde..0347d0af 100644
--- a/src/cl_kernel.h
+++ b/src/cl_kernel.h
@@ -22,7 +22,7 @@
#include "cl_internals.h"
#include "cl_driver.h"
-#include "gen/program.h"
+#include "program.h"
#include "CL/cl.h"
#include <stdint.h>
diff --git a/src/cl_program.h b/src/cl_program.h
index fc33c79c..38386563 100644
--- a/src/cl_program.h
+++ b/src/cl_program.h
@@ -21,7 +21,7 @@
#define __CL_PROGRAM_H__
#include "cl_internals.h"
-#include "gen/program.h"
+#include "program.h"
#include "CL/cl.h"
#include <stdint.h>
diff --git a/src/intel/Makefile b/src/intel/Makefile
new file mode 100644
index 00000000..c8f77f93
--- /dev/null
+++ b/src/intel/Makefile
@@ -0,0 +1,4 @@
+TOP=../..
+SUBDIRS=.
+
+include $(TOP)/Makefile.shared
diff --git a/src/sim/Makefile b/src/sim/Makefile
new file mode 100644
index 00000000..c8f77f93
--- /dev/null
+++ b/src/sim/Makefile
@@ -0,0 +1,4 @@
+TOP=../..
+SUBDIRS=.
+
+include $(TOP)/Makefile.shared
diff --git a/src/sim/sim_driver.c b/src/sim/sim_driver.c
index 49a9e893..25a85a7e 100644
--- a/src/sim/sim_driver.c
+++ b/src/sim/sim_driver.c
@@ -23,8 +23,8 @@
#include "sim/sim_driver.h"
#include "CL/cl.h"
#include "cl_driver.h"
-#include "gen/program.h"
-#include "gen/simulator.h"
+#include "program.h"
+#include "sim/simulator.h"
#include "sim/sim_simulator.h"
#include <stdlib.h>
diff --git a/src/sim/sim_simulator.h b/src/sim/sim_simulator.h
index 55e84fa2..ff0623f3 100644
--- a/src/sim/sim_simulator.h
+++ b/src/sim/sim_simulator.h
@@ -20,7 +20,7 @@
#ifndef __SIM_SIMULATOR_H__
#define __SIM_SIMULATOR_H__
-#include "gen/simulator.h"
+#include "sim/simulator.h"
/* Allocate and initialize a new Gen simulator that run the c++ backend code */
extern gbe_simulator sim_simulator_new(void);
diff --git a/src/x11/Makefile b/src/x11/Makefile
new file mode 100644
index 00000000..c8f77f93
--- /dev/null
+++ b/src/x11/Makefile
@@ -0,0 +1,4 @@
+TOP=../..
+SUBDIRS=.
+
+include $(TOP)/Makefile.shared