51 lines
1.3 KiB
Makefile
51 lines
1.3 KiB
Makefile
CXX = g++
|
|
CFLAGS = -Wall -pedantic-errors -std=c++17 -g #-O2
|
|
SRCDIR = src/main/cpp/src/
|
|
BUILDDIR = target/
|
|
INCDIR = $(BUILDDIR)inc/
|
|
INSTALLDIR = /usr/lib/
|
|
LDFLAGS = -I/usr/lib/jvm/java-8-openjdk-amd64/include/ -I/usr/lib/jvm/java-8-openjdk-amd64/include/linux/ -I$(INCDIR) -Isrc/main/cpp/inc/ #-ldl
|
|
NAME = libplugin.so
|
|
SERVER = testerver/
|
|
|
|
SRCFILES = $(wildcard $(SRCDIR)*.cpp)
|
|
OBJFILES = $(patsubst $(SRCDIR)%, $(BUILDDIR)%, $(patsubst %.cpp,%.so,$(SRCFILES)))
|
|
|
|
plugins: $(INSTALLDIR)$(NAME)
|
|
bash testplugins/compile.sh
|
|
|
|
installplugins: plugins
|
|
bash testplugins/install.sh
|
|
|
|
install: $(BUILDDIR)$(NAME)
|
|
|
|
uninstall:
|
|
sudo rm -f $(INSTALLDIR)$(NAME)
|
|
|
|
link: $(BUILDDIR)$(NAME)
|
|
sudo ln -fs $(realpath $(BUILDDIR)$(NAME)) $(INSTALLDIR)
|
|
|
|
$(INSTALLDIR)$(NAME): $(BUILDDIR)$(NAME)
|
|
cp $(BUILDDIR)$(NAME) $(INSTALLDIR)
|
|
|
|
all: createhfiles link
|
|
|
|
$(BUILDDIR)%.so: $(SRCDIR)%.cpp $(BUILDDIR)
|
|
$(CXX) -fPIC -shared $(CFLAGS) $(SRCDIR)*.cpp -o $@ $(LDFLAGS)
|
|
|
|
$(BUILDDIR)%: $(SRCDIR)%.cpp $(BUILDDIR)
|
|
$(CXX) $(CFLAGS) $(SRCDIR)$*.cpp -o $@
|
|
|
|
clean:
|
|
$(RM) -r $(BUILDDIR)
|
|
$(RM) $(SERVER)plugins/*.so $(SERVER)plugins/CppPlugins/*.so testplugins/*/*.so
|
|
|
|
$(BUILDDIR):
|
|
mkdir -p $@
|
|
|
|
createhfiles:
|
|
$(RM) -r $(INCDIR)
|
|
javah -d $(INCDIR) -classpath $(BUILDDIR)classes/:testserver/spigot-1.12.2.jar de.mrbesen.cppplugins.CppPlugin
|
|
|
|
.PHONY: createhfiles clean plugins
|