aboutsummaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rw-r--r--plugins/gpulib/Makefile19
-rw-r--r--plugins/gpulib/gpulib.mak5
-rw-r--r--plugins/spunull/Makefile16
3 files changed, 33 insertions, 7 deletions
diff --git a/plugins/gpulib/Makefile b/plugins/gpulib/Makefile
index 2739e5c..4a45aa2 100644
--- a/plugins/gpulib/Makefile
+++ b/plugins/gpulib/Makefile
@@ -23,15 +23,28 @@ OBJS += cspace.o
endif
CFLAGS += $(PLUGIN_CFLAGS)
+# need to compile to another dir, same files are compiled
+# into main binary without PIC
+OBJS2 = $(patsubst %.o,obj/%.o,$(OBJS))
+
TARGET = gpulib.$(EXT)
-all: ../../config.mak $(TARGET)
+all: ../../config.mak obj $(TARGET)
-$(TARGET): $(OBJS)
+$(TARGET): $(OBJS2)
$(AR) crs $@ $^
+obj/%.o: %.c
+ $(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $^
+
+obj/%.o: %.s
+ $(AS) $(ASFLAGS) -o $@ $^
+
clean:
- $(RM) $(TARGET) $(OBJS)
+ $(RM) $(TARGET) $(OBJS2)
+
+obj:
+ mkdir -p $@
../../config.mak:
@echo "Please run ./configure before running make!"
diff --git a/plugins/gpulib/gpulib.mak b/plugins/gpulib/gpulib.mak
index 48e73cb..349a0c8 100644
--- a/plugins/gpulib/gpulib.mak
+++ b/plugins/gpulib/gpulib.mak
@@ -25,6 +25,9 @@ endif
CC_STANDLALONE = $(CC)
CC_GPULIB = $(CC)
+WD = $(shell pwd)
+PLUGINDIR = $(shell basename $(WD))
+
all: ../../config.mak $(TARGETS)
ifdef BIN_STANDLALONE
@@ -33,6 +36,7 @@ CC_STANDLALONE = $(CXX)
endif
$(BIN_STANDLALONE)$(EXT): $(SRC) $(SRC_STANDALONE) $(GPULIB_A)
$(CC_STANDLALONE) -o $@ $(CFLAGS) $(LDFLAGS) $^ $(LDLIBS) $(LDLIBS_STANDALONE)
+ ln -fs $(PLUGINDIR)/$@ ../
endif
ifdef BIN_GPULIB
@@ -41,6 +45,7 @@ CC_GPULIB = $(CXX)
endif
$(BIN_GPULIB)$(EXT): $(SRC) $(SRC_GPULIB) $(GPULIB_A)
$(CC_GPULIB) -o $@ $(CFLAGS) $(LDFLAGS) $^ $(LDLIBS) $(LDLIBS_GPULIB)
+ ln -fs $(PLUGINDIR)/$@ ../
endif
$(GPULIB_A):
diff --git a/plugins/spunull/Makefile b/plugins/spunull/Makefile
index eb81cab..dcd25ea 100644
--- a/plugins/spunull/Makefile
+++ b/plugins/spunull/Makefile
@@ -1,12 +1,20 @@
-all: ../../config.mak spunull.so
-
include ../../config.mak
-spunull.so: spunull.c
+ifneq "$(ARCH)" "arm"
+ EXT = .$(ARCH)
+endif
+TARGET = spunull.so$(EXT)
+WD = $(shell pwd)
+PLUGINDIR = $(shell basename $(WD))
+
+all: ../../config.mak $(TARGET)
+
+$(TARGET): spunull.c
$(CC) $(CFLAGS) -shared -fPIC -ggdb -O2 -o $@ $^
+ ln -fs $(PLUGINDIR)/$(TARGET) ../
clean:
- $(RM) spunull.so
+ $(RM) $(TARGET)
../../config.mak:
@echo "Please run ./configure before running make!"