GitLab will be upgraded on June 2nd 2020 at 2.00 pm (AEDT) to 3.00 pm (AEDT) due to Critical Security Patch Availability. During the update, GitLab and Mattermost services will not be available. If you have any concerns with this, please talk to local Gitlab admin team.

Makefile 1.18 KB
Newer Older
1
CFLAGS += -std=gnu11
Kunshan Wang's avatar
Kunshan Wang committed
2

3 4 5 6
ifndef JAVA_HOME
    $(error JAVA_HOME is required. Invoke with 'make JAVA_HOME=/path/to/java/home')
endif

Kunshan Wang's avatar
Kunshan Wang committed
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
CFLAGS += -I $(JAVA_HOME)/include

ifndef OS
    uname := $(shell uname)
    ifeq ($(uname),Darwin)
	OS = OSX
    else
    ifeq ($(uname),Linux)
	OS = LINUX
    else
	$(error Unrecognized operating system $(uname). I currently only worked on OSX and Linux.)
    endif
    endif
endif

ifeq ($(OS),OSX)
    CFLAGS += -I $(JAVA_HOME)/include/darwin
endif

ifeq ($(OS),LINUX)
    CFLAGS += -I $(JAVA_HOME)/include/linux
endif

LDFLAGS += -L $(JAVA_HOME)/jre/lib/server -l jvm -rpath $(JAVA_HOME)/jre/lib/server

32
.PHONY: all
Kunshan Wang's avatar
Kunshan Wang committed
33
all: libs tests
34

Kunshan Wang's avatar
Kunshan Wang committed
35 36 37 38
.PHONY: libs
libs: libmurefimpl2start.so

libmurefimpl2start.so: refimpl2-start.c classpath.h
39 40
	$(CC) -fPIC -shared $(CFLAGS) -o $@ $< $(LDFLAGS)

Kunshan Wang's avatar
Kunshan Wang committed
41 42 43 44 45
classpath.txt: ../build.sbt
	cd .. ; sbt makeClasspathFile

classpath.h: classpath.txt
	xxd -i classpath.txt > classpath.h
46

Kunshan Wang's avatar
Kunshan Wang committed
47 48 49 50
.PHONY: tests
tests: test_client

test_client: test_client.c libmurefimpl2start.so
51
	$(CC) $(CFLAGS) `./refimpl2-config --istart --cflags --libs` -o $@ $<
Kunshan Wang's avatar
Kunshan Wang committed
52 53

.PHONY: clean veryclean
54 55

clean:
Kunshan Wang's avatar
Kunshan Wang committed
56 57 58 59
	rm *.so test_client

veryclean:
	rm *.so test_client classpath.txt classpath.h