]>
git.argeo.org Git - gpl/argeo-slc.git/blob - jni/jni.mk
1 TARGET_EXEC
:= libJava_
$(NATIVE_PACKAGE
).so
3 LDFLAGS
= -shared
-fPIC
-Wl
,-soname
,$(TARGET_EXEC
).
$(MAJOR
).
$(MINOR
) $(ADDITIONAL_LIBS
)
11 BUILD_DIR
:= $(SDK_BUILD_BASE
)/jni
/$(NATIVE_PACKAGE
)
13 # Every folder in ./src will need to be passed to GCC so that it can find header files
14 INC_DIRS
:= $(shell find
$(SRC_DIRS
) -type d
) $(JAVA_HOME
)/include $(JAVA_HOME
)/include/linux
$(ADDITIONAL_INCLUDES
)
18 all: $(SDK_BUILD_BASE
)/jni
/$(TARGET_EXEC
)
20 # Find all the C and C++ files we want to compile
21 # Note the single quotes around the * expressions. Make will incorrectly expand these otherwise.
22 SRCS
:= $(shell find
$(SRC_DIRS
) -name
'*.cpp' -or
-name
'*.c' -or
-name
'*.s')
24 # String substitution for every C/C++ file.
25 # As an example, hello.cpp turns into ./build/hello.cpp.o
26 OBJS
:= $(SRCS
:%=$(BUILD_DIR
)/%.o
)
28 # String substitution (suffix version without %).
29 # As an example, ./build/hello.cpp.o turns into ./build/hello.cpp.d
32 # Add a prefix to INC_DIRS. So moduleA would become -ImoduleA. GCC understands this -I flag
33 INC_FLAGS
:= $(addprefix -I
,$(INC_DIRS
))
35 # The -MMD and -MP flags together generate Makefiles for us!
36 # These files will have .d instead of .o as the output.
37 CPPFLAGS
:= $(INC_FLAGS
) -MMD
-MP
39 # The final build step.
40 $(SDK_BUILD_BASE
)/jni
/$(TARGET_EXEC
): $(OBJS
)
41 $(CC
) $(OBJS
) -o
$@
$(LDFLAGS
)
43 # Build step for C source
44 $(BUILD_DIR
)/%.c.o
: %.c
46 $(CC
) $(CPPFLAGS
) $(CFLAGS
) -c
$< -o
$@
48 # Build step for C++ source
49 $(BUILD_DIR
)/%.
cpp.o
: %.
cpp
51 $(CXX
) $(CPPFLAGS
) $(CXXFLAGS
) -c
$< -o
$@
53 # Include the .d makefiles. The - at the front suppresses the errors of missing
54 # Makefiles. Initially, all the .d files will be missing, and we don't want those
58 # MAKEFILE_DIR := $(dir $(firstword $(MAKEFILE_LIST)))