diff --git a/Makefile.am b/Makefile.am index ce5fb41..9744e7e 100644 --- a/Makefile.am +++ b/Makefile.am @@ -43,6 +43,7 @@ JIGA_MAVEN_DIR = META-INF/maven/$(GROUP)/$(ARTIFACT) JIGA_NATIVE_FUNCS = com/redhat/jigawatts/Jigawatts.java JIGA_NATIVE_HDRS = $(subst .java,.h,$(subst /,_,$(JIGA_NATIVE_FUNCS))) +JIGA_NATIVE_HDRS_PREFIXED = $(addprefix $(JIGA_INCLUDEDIR)/,$(JIGA_NATIVE_HDRS)) JIGA_NATIVE_SRC = $(subst .java,.cpp,$(subst /,_,$(JIGA_NATIVE_FUNCS))) JIGA_NATIVE_OBJS = $(subst .cpp,.o,$(JIGA_NATIVE_SRC)) JIGA_LIB = libJigawatts.so @@ -74,16 +75,23 @@ $(JIGA_BUILDDIR)/source-files.txt: clean-source-file-list: $(RM) $(JIGA_BUILDDIR)/source-files.txt +$(JIGA_NATIVE_HDRS_PREFIXED): $(JIGA_BUILDDIR)/source-files.txt + $(SYSTEM_JDK_DIR)/bin/javac -g $(JAVACFLAGS) \ + -d `mktemp -d` \ + -h $(JIGA_INCLUDEDIR) \ + -sourcepath $(JIGA_JAVA_SRCDIR) \ + @$<; + $(JIGA_STAMPDIR)/classes.stamp: $(JIGA_BUILDDIR)/source-files.txt $(SYSTEM_JDK_DIR)/bin/javac -g $(JAVACFLAGS) \ - -d $(JIGA_BUILDDIR) -h $(JIGA_INCLUDEDIR) \ + -d $(JIGA_BUILDDIR) \ -sourcepath $(JIGA_JAVA_SRCDIR) \ @$< ; mkdir -p $(JIGA_STAMPDIR) touch $@ clean-classes-and-headers: - $(RM) $(addprefix $(JIGA_INCLUDEDIR)/,$(JIGA_NATIVE_HDRS)) + $(RM) $(JIGA_NATIVE_HDRS_PREFIXED) $(RM) -r $(JIGA_BUILDDIR)/$(JAVA_ROOT_DIR) $(RM) $(JIGA_STAMPDIR)/classes.stamp @@ -95,7 +103,9 @@ $(JIGA_BUILDDIR)/%.o: $(JIGA_NATIVE_SRCDIR)/%.cpp clean-native-objects: $(RM) $(addprefix $(JIGA_BUILDDIR)/,$(JIGA_NATIVE_OBJS)) -$(JIGA_BUILDDIR)/$(JIGA_LIB): $(addprefix $(JIGA_INCLUDEDIR)/,$(JIGA_NATIVE_HDRS)) \ +natives: $(JIGA_BUILDDIR)/$(JIGA_LIB) + +$(JIGA_BUILDDIR)/$(JIGA_LIB): $(JIGA_NATIVE_HDRS_PREFIXED) \ $(addprefix $(JIGA_BUILDDIR)/,$(JIGA_NATIVE_OBJS)) $(CC) $(LDFLAGS) $(addprefix $(JIGA_BUILDDIR)/,$(JIGA_NATIVE_OBJS)) -shared -o $@ $(CRIU_LIBS) diff --git a/pom.xml b/pom.xml index e16c7bb..3d3204d 100644 --- a/pom.xml +++ b/pom.xml @@ -48,129 +48,169 @@ Jigawatts - UTF-8 - ${env.JAVA_HOME} + UTF-8 + ${env.JAVA_HOME} - + - + org.junit.jupiter junit-jupiter-engine 5.7.0 test - + - - - - org.apache.maven.plugins - maven-compiler-plugin - 3.8.1 - - 8 - 8 - 8 - - - - header-generation - process-sources - - compile - - - - -h - ${project.build.directory}/native/javah - - - com/redhat/jigawatts/Jigawatts.java - - - - - - - maven-surefire-plugin - 3.0.0-M5 - - - - - - - org.codehaus.mojo - exec-maven-plugin - 3.0.0 - - - compile-cpp - - exec - - process-classes + + + natives + + true + + + + + org.codehaus.mojo + exec-maven-plugin + 3.0.0 + + + default-autogen + + exec + + process-classes + + ./autogen.sh + + + + default-configure + + exec + + process-classes + + ./configure + + --with-jdk=${env.JAVA_HOME} + + + + + make-default-natives + + exec + + process-classes + + make + + natives + + + + + copy-default-lib + + exec + + process-classes + + mv + + -v + build/libJigawatts.so + target/classes/libJigawatts.so + + + + + + + + + + java + + true + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.8.1 + + 8 + 8 + 8 + + + + maven-surefire-plugin + 3.0.0-M5 + + + + + + + org.apache.maven.plugins + maven-shade-plugin + 3.2.4 + + + jigawatts + package + + shade + + + jigawatts + + + + + + maven-clean-plugin + 3.1.0 - gcc - - -v - -shared - -fPIC - -I${java.includes}/include - -I${java.includes}/include/linux - -I/usr/lib64/ - -I/usr/include/criu - -I${project.build.directory}/native/javah - -lcriu - -o${project.build.outputDirectory}/libJigawatts.so - ${project.basedir}/src/main/cpp/com_redhat_jigawatts_Jigawatts.cpp - + + + src/test/resources + + jigawatts/* + jigawatts/testhooks/** + 1* + + false + + + build + + **/* + + false + + + build + + - - - - - org.apache.maven.plugins - maven-shade-plugin - 3.2.4 - - - jigawatts - package - - shade - + + + org.apache.maven.plugins + maven-javadoc-plugin + 3.2.0 - jigawatts - - - - - maven-clean-plugin - 3.1.0 - - - - src/test/resources - - jigawatts/* - 1* - - false - - - - - - org.apache.maven.plugins - maven-javadoc-plugin - 3.2.0 - - - - - + + + + +