| 1 | #-------------------------------------------------------------------------- |
|---|
| 2 | # Makefile for the NeXus Java API. Builds both the required Java class |
|---|
| 3 | # files and the shared library with the native methods. |
|---|
| 4 | # |
|---|
| 5 | # This version is for Windows 32, using the mingw toolchain |
|---|
| 6 | # |
|---|
| 7 | # Getting the import libraries for HDF right was a pain: |
|---|
| 8 | # The HDF4 library ones were created through: |
|---|
| 9 | # > reimp hdf4lib.dll |
|---|
| 10 | # where hdf4lib must be replaced with the name of the HDF4 library to |
|---|
| 11 | # convert. |
|---|
| 12 | # |
|---|
| 13 | # The HDF5 libraries seem to have been compiled with a different version of |
|---|
| 14 | # MS Visual Schrott and need another treatment: |
|---|
| 15 | # > pexport hdf5dll.dll > hdf5dll.def |
|---|
| 16 | # > dlltool -d hdf5dll.def -l libhdfdll.a |
|---|
| 17 | # Of course, these things may change between versions of MSVC and mingw..... |
|---|
| 18 | # Windows is a pain in the ass ............................................ |
|---|
| 19 | # |
|---|
| 20 | # Mark Koennecke, November 2003 |
|---|
| 21 | #-------------------------------------------------------------------------- |
|---|
| 22 | .SUFFIXES: |
|---|
| 23 | .SUFFIXES: .java .class .c .o |
|---|
| 24 | |
|---|
| 25 | ########################################################################### |
|---|
| 26 | # C O N F I G U R A T I O N S E C T I O N # |
|---|
| 27 | ########################################################################### |
|---|
| 28 | # Where to find the HDF libraries: HDF4.1r3 is REQUIRED |
|---|
| 29 | HDFROOT=/g/hdf |
|---|
| 30 | HDF4ROOT=$(HDFROOT)/HDF41r5 |
|---|
| 31 | HDF5ROOT=$(HDFROOT)/5-161-win2k/c/release |
|---|
| 32 | #HDF5ROOT=/c/temp/hdf5-161mingw |
|---|
| 33 | |
|---|
| 34 | #Where to find the napi C stuff |
|---|
| 35 | NAPIROOT=$(SINQDIR)/linux |
|---|
| 36 | |
|---|
| 37 | # Where the Java binaries live |
|---|
| 38 | JAVAROOT=/java |
|---|
| 39 | JAVABIN=$(JAVAROOT)/bin |
|---|
| 40 | |
|---|
| 41 | # The classpath for compiling java |
|---|
| 42 | JCP=.: |
|---|
| 43 | |
|---|
| 44 | # The path to the include files for the jni-headers |
|---|
| 45 | JINCLUDE= -I$(JAVAROOT)/include -I$(JAVAROOT)/include/win32 |
|---|
| 46 | |
|---|
| 47 | # The C-compiler to use |
|---|
| 48 | CC=gcc |
|---|
| 49 | |
|---|
| 50 | # Compiler flags to use for compiling |
|---|
| 51 | CFLAGS= -g -c $(JINCLUDE) -DHDF4 -DHDF5 -D_HDF5USEDLL_ -I$(HDF4ROOT)/include \ |
|---|
| 52 | -I$(HDF5ROOT)/include -I../../include -Inative \ |
|---|
| 53 | -D_JNI_IMPLEMENTATION_ -Wl,--kill-at |
|---|
| 54 | |
|---|
| 55 | #Compiler flags used for linking |
|---|
| 56 | LFLAGS= -g -shared \ |
|---|
| 57 | -D_JNI_IMPLEMENTATION_ -Wl,--kill-at |
|---|
| 58 | |
|---|
| 59 | #Target location for the shared library |
|---|
| 60 | SHLIB=bin/win32/jnexus.dll |
|---|
| 61 | |
|---|
| 62 | ########################################################################### |
|---|
| 63 | # END OF C O N F I G U R A T I O N S E C T I O N # |
|---|
| 64 | # DO NOT TOUCH ANYTHING BELOW! # |
|---|
| 65 | ########################################################################### |
|---|
| 66 | |
|---|
| 67 | .java.class: |
|---|
| 68 | $(JAVABIN)/javac -g -target 1.1 $*.java |
|---|
| 69 | |
|---|
| 70 | .c.o: |
|---|
| 71 | $(CC) $(CFLAGS) -o $*.o $*.c |
|---|
| 72 | |
|---|
| 73 | JOBJ=ncsa/hdf/hdflib/HDFException.class \ |
|---|
| 74 | ncsa/hdf/hdflib/HDFJavaException.class \ |
|---|
| 75 | ncsa/hdf/hdflib/HDFNotImplementedException.class \ |
|---|
| 76 | ncsa/hdf/hdflib/HDFConstants.class \ |
|---|
| 77 | ncsa/hdf/hdflib/HDFArray.class \ |
|---|
| 78 | ncsa/hdf/hdflib/HDFNativeData.class \ |
|---|
| 79 | neutron/nexus/NexusException.class \ |
|---|
| 80 | neutron/nexus/NXlink.class \ |
|---|
| 81 | neutron/nexus/NeXusFileInterface.class \ |
|---|
| 82 | neutron/nexus/AttributeEntry.class \ |
|---|
| 83 | neutron/nexus/NexusFile.class |
|---|
| 84 | |
|---|
| 85 | |
|---|
| 86 | COBJ=native/hdfnativeImp.o \ |
|---|
| 87 | native/hdfexceptionImp.o \ |
|---|
| 88 | native/handle.o \ |
|---|
| 89 | ../../src/napi.o \ |
|---|
| 90 | native/NexusFile.o |
|---|
| 91 | |
|---|
| 92 | du40: all |
|---|
| 93 | rh62: all |
|---|
| 94 | |
|---|
| 95 | ../../src/napi.o:../../src/napi.c ../../src/napi4.c ../../src/napi5.c |
|---|
| 96 | $(CC) $(CFLAGS) -I../../src -o ../../src/napi.o ../../src/napi.c |
|---|
| 97 | |
|---|
| 98 | all: jnexus.jar libjnexus.so test |
|---|
| 99 | |
|---|
| 100 | jnexus.jar: $(JOBJ) |
|---|
| 101 | - rm jnexus.jar |
|---|
| 102 | $(JAVABIN)/jar cvf jnexus.jar $(JOBJ) \ |
|---|
| 103 | ncsa/hdf/hdflib/ArrayDescriptor.class |
|---|
| 104 | |
|---|
| 105 | libjnexus.so: $(COBJ) |
|---|
| 106 | $(CC) $(LFLAGS) -o $(SHLIB) $(COBJ) --enable-stdcall-fixup\ |
|---|
| 107 | --enable-auto-import \ |
|---|
| 108 | -L$(HDF4ROOT)/dlllib \ |
|---|
| 109 | -L$(HDF5ROOT)/dll -lhdf5dll -lhm415m -lhd415m |
|---|
| 110 | |
|---|
| 111 | |
|---|
| 112 | header: neutron/nexus/NexusFile.class |
|---|
| 113 | $(JAVABIN)/javah -jni -d native neutron.nexus.NexusFile |
|---|
| 114 | |
|---|
| 115 | test: test/TestJapi.class |
|---|
| 116 | |
|---|
| 117 | clean: |
|---|
| 118 | - rm neutron/nexus/*.class |
|---|
| 119 | - rm ncsa/hdf/hdflib/*.class |
|---|
| 120 | - rm native/*.o |
|---|
| 121 | - rm ../../src/napi.o |
|---|