2020-02-20 04:28:05 +01:00
|
|
|
CXX = g++
|
|
|
|
CFLAGS = -Wall -pedantic-errors -std=c++17 -g #-O2
|
|
|
|
SRCDIR = src/main/cpp/src/
|
|
|
|
BUILDDIR = target/
|
|
|
|
INCDIR = src/main/cpp/inc/
|
2020-02-21 04:10:23 +01:00
|
|
|
INSTALLDIR = /usr/lib/
|
2020-02-20 12:21:43 +01:00
|
|
|
LDFLAGS = -I/usr/lib/jvm/java-8-openjdk-amd64/include/ -I/usr/lib/jvm/java-8-openjdk-amd64/include/linux/ -I$(INCDIR) -Iinc/ #-ldl
|
2020-02-20 04:28:05 +01:00
|
|
|
NAME = libplugin.so
|
|
|
|
|
|
|
|
SRCFILES = $(wildcard $(SRCDIR)*.cpp)
|
|
|
|
OBJFILES = $(patsubst $(SRCDIR)%, $(BUILDDIR)%, $(patsubst %.cpp,%.so,$(SRCFILES)))
|
|
|
|
|
2020-02-21 04:10:23 +01:00
|
|
|
plugins: $(INSTALLDIR)$(NAME)
|
|
|
|
bash testplugins/compile.sh
|
|
|
|
|
|
|
|
installplugins: plugins
|
|
|
|
bash testplugins/install.sh
|
|
|
|
|
|
|
|
install: $(INSTALLDIR)$(NAME)
|
|
|
|
|
|
|
|
$(INSTALLDIR)$(NAME): $(BUILDDIR)$(NAME)
|
|
|
|
cp $(BUILDDIR)$(NAME) $(INSTALLDIR)
|
|
|
|
|
2020-02-20 04:28:05 +01:00
|
|
|
all: createhfiles $(BUILDDIR)$(NAME)
|
|
|
|
|
|
|
|
$(BUILDDIR)%.so: $(SRCDIR)%.cpp $(BUILDDIR)
|
2020-02-20 12:21:43 +01:00
|
|
|
$(CXX) -fPIC -shared $(CFLAGS) $(SRCDIR)*.cpp -o $@ $(LDFLAGS)
|
2020-02-20 04:28:05 +01:00
|
|
|
|
|
|
|
$(BUILDDIR)%: $(SRCDIR)%.cpp $(BUILDDIR)
|
|
|
|
$(CXX) $(CFLAGS) $(SRCDIR)$*.cpp -o $@
|
|
|
|
|
|
|
|
clean:
|
2020-02-21 04:10:23 +01:00
|
|
|
$(RM) -r $(BUILDDIR)
|
|
|
|
$(RM) testserver/plugins/*.so testserver/plugins/CppPlugins/*.so testplugins/*/*.so
|
2020-02-20 04:28:05 +01:00
|
|
|
|
|
|
|
$(BUILDDIR):
|
|
|
|
mkdir -p $@
|
|
|
|
|
|
|
|
createhfiles:
|
|
|
|
rm -fr $(INCDIR)
|
|
|
|
javah -d $(INCDIR) -classpath target/classes/:$(HOME)/.m2/repository/org/bukkit/craftbukkit/1.7.10-R0.1-SNAPSHOT/craftbukkit-1.7.10-R0.1-SNAPSHOT.jar de.mrbesen.cppplugins.CppPlugin
|
|
|
|
|
2020-02-21 04:10:23 +01:00
|
|
|
.phony: createhfiles clean plugins
|