forked from vurtun/nuklear
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile
executable file
·52 lines (39 loc) · 1.27 KB
/
Makefile
1
2
3
4
5
6
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# Install
BUILD_DIR = build
BIN = $(BUILD_DIR)/libnuklear-java
SRC_DIR = src
GENERATED_DIR_BASE = generated
GENERATED_DIR = $(GENERATED_DIR_BASE)/nuklear/swig
TEST_NAME = AWTDemo2
TEST_CLASS_BIN = $(BUILD_DIR)/nuklear/demo/$(TEST_NAME).class
ifndef JAVA_HOME
$(error JAVA_HOME is not set)
endif
# Flags
CFLAGS = -std=c99 -pedantic -fPIC -O0 -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/linux -I$(SRC_DIR)
LDFLAGS = -shared
SRC = $(SRC_DIR)/nuklear_headless.c $(GENERATED_DIR)/nuklear_wrap.c
OBJS = $(SRC:.c=.o)
ifeq ($(OS),Windows_NT)
BIN := $(BIN).exe
LIBS = -lm
else
BIN := $(BIN).so
LIBS = -lm
endif
.PHONY: all clean test
all: $(TEST_CLASS_BIN)
#all: $(BIN)
%.o: %.c
$(CC) $(CFLAGS) -o $@ -c $<
$(GENERATED_DIR)/nuklear_wrap.c: nuklear.i
mkdir -p $(GENERATED_DIR) $(BUILD_DIR)
swig3.0 -java -package nuklear.swig -outdir $(GENERATED_DIR) -o $@ $<
$(BIN):$(OBJS)
$(CC) $(LDFLAGS) -o $(BIN) $(OBJS) $(LIBS)
$(TEST_CLASS_BIN): $(BIN)
$(JAVA_HOME)/bin/javac -source 1.5 -target 1.5 -d $(BUILD_DIR) $(SRC_DIR)/nuklear/*.java $(SRC_DIR)/nuklear/swig/*.java $(SRC_DIR)/nuklear/demo/*.java $(GENERATED_DIR)/*.java
test:
$(JAVA_HOME)/bin/java -Djava.library.path=build -cp build:resources nuklear.demo.$(TEST_NAME)
clean:
rm -rf $(BIN) $(OBJS) $(GENERATED_DIR_BASE) $(BUILD_DIR)