CppPlugins/Makefile

51 lines
1.3 KiB
Makefile
Raw Permalink Normal View History

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 = $(BUILDDIR)inc/
2020-02-21 04:10:23 +01:00
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
2020-02-20 04:28:05 +01:00
NAME = libplugin.so
2020-02-22 05:28:38 +01:00
SERVER = testerver/
2020-02-20 04:28:05 +01:00
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
2020-03-30 16:59:26 +02:00
install: $(BUILDDIR)$(NAME)
2020-02-21 04:10:23 +01:00
2020-03-30 10:44:38 +02:00
uninstall:
sudo rm -f $(INSTALLDIR)$(NAME)
2020-03-30 16:59:26 +02:00
link: $(BUILDDIR)$(NAME)
sudo ln -fs $(realpath $(BUILDDIR)$(NAME)) $(INSTALLDIR)
2020-03-30 10:44:38 +02:00
2020-02-21 04:10:23 +01:00
$(INSTALLDIR)$(NAME): $(BUILDDIR)$(NAME)
cp $(BUILDDIR)$(NAME) $(INSTALLDIR)
2020-03-30 16:59:26 +02:00
all: createhfiles link
2020-02-20 04:28:05 +01:00
$(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)
2020-03-30 16:59:26 +02:00
$(RM) $(SERVER)plugins/*.so $(SERVER)plugins/CppPlugins/*.so testplugins/*/*.so
2020-02-20 04:28:05 +01:00
$(BUILDDIR):
mkdir -p $@
createhfiles:
$(RM) -r $(INCDIR)
2020-03-30 10:44:38 +02:00
javah -d $(INCDIR) -classpath $(BUILDDIR)classes/:testserver/spigot-1.12.2.jar de.mrbesen.cppplugins.CppPlugin
2020-02-20 04:28:05 +01:00
2020-03-30 10:44:38 +02:00
.PHONY: createhfiles clean plugins