]>
git.argeo.org Git - lgpl/argeo-commons.git/blob - sdk/jni.mk
8483bd7041ddca5096a7cb63872af055e8a7366f
1 TARGET_EXEC
:= libJava_
$(NATIVE_PACKAGE
).so
3 LDFLAGS
= -shared
-fPIC
-Wl
,-soname
,$(TARGET_EXEC
).
$(MAJOR
).
$(MINOR
) -luuid
8 @echo Making
'$@' $(if
$^
,from
'$^')
9 # @echo 'MAJOR=$(MAJOR)'
10 # @echo 'MINOR=$(MINOR)'
11 @echo
'SRC_DIRS=$(SRC_DIRS)'
12 @echo
'BUILD_DIR=$(BUILD_DIR)'
18 BUILD_DIR
:= $(SDK_BUILD_BASE
)/$(NATIVE_PACKAGE
)
20 #META_INF_DIR := ./../META-INF
21 #ARCH := $(shell uname -p)
23 # Every folder in ./src will need to be passed to GCC so that it can find header files
24 INC_DIRS
:= $(shell find
$(SRC_DIRS
) -type d
) /usr
/lib
/jvm
/java
/include /usr
/lib
/jvm
/java
/include/linux
/usr
/include/uuid
28 all: $(SDK_BUILD_BASE
)/$(TARGET_EXEC
)
30 # Find all the C and C++ files we want to compile
31 # Note the single quotes around the * expressions. Make will incorrectly expand these otherwise.
32 SRCS
:= $(shell find
$(SRC_DIRS
) -name
'*.cpp' -or
-name
'*.c' -or
-name
'*.s')
34 # String substitution for every C/C++ file.
35 # As an example, hello.cpp turns into ./build/hello.cpp.o
36 OBJS
:= $(SRCS
:%=$(BUILD_DIR
)/%.o
)
38 # String substitution (suffix version without %).
39 # As an example, ./build/hello.cpp.o turns into ./build/hello.cpp.d
42 # Add a prefix to INC_DIRS. So moduleA would become -ImoduleA. GCC understands this -I flag
43 INC_FLAGS
:= $(addprefix -I
,$(INC_DIRS
))
45 # The -MMD and -MP flags together generate Makefiles for us!
46 # These files will have .d instead of .o as the output.
47 CPPFLAGS
:= $(INC_FLAGS
) -MMD
-MP
49 # The final build step.
50 $(SDK_BUILD_BASE
)/$(TARGET_EXEC
): $(OBJS
)
51 $(CC
) $(OBJS
) -o
$@
$(LDFLAGS
)
53 # Build step for C source
54 $(BUILD_DIR
)/%.c.o
: %.c
56 $(CC
) $(CPPFLAGS
) $(CFLAGS
) -c
$< -o
$@
58 # Build step for C++ source
59 $(BUILD_DIR
)/%.
cpp.o
: %.
cpp
61 $(CXX
) $(CPPFLAGS
) $(CXXFLAGS
) -c
$< -o
$@
64 rm -r
$(BUILD_DIR
) $(SDK_BUILD_BASE
)/$(TARGET_EXEC
)
66 # Include the .d makefiles. The - at the front suppresses the errors of missing
67 # Makefiles. Initially, all the .d files will be missing, and we don't want those
71 # MAKEFILE_DIR := $(dir $(firstword $(MAKEFILE_LIST)))