]>
git.argeo.org Git - lgpl/argeo-commons.git/blob - Makefile
093701fbd14fd5348e4e4ea35129c15003807ec0
3 NATIVE_PACKAGE
=org_argeo_api_uuid
4 TARGET_EXEC
:= libJava_
$(NATIVE_PACKAGE
).so
6 SRC_DIRS
:= .
/jni
/$(NATIVE_PACKAGE
)
8 LDFLAGS
=-shared
-fPIC
-Wl
,-soname
,$(TARGET_EXEC
).
$(MAJOR
).
$(MINOR
)
13 BUILD_DIR
:= .
/generated
14 META_INF_DIR
:= .
/META-INF
15 ARCH
:= $(shell uname
-p
)
17 # Every folder in ./src will need to be passed to GCC so that it can find header files
18 INC_DIRS
:= $(shell find
$(SRC_DIRS
) -type d
) /usr
/lib
/jvm
/java
/include /usr
/lib
/jvm
/java
/include/linux
21 all: $(BUILD_DIR
)/$(TARGET_EXEC
)
23 ide
: $(META_INF_DIR
)/$(ARCH
)/$(TARGET_EXEC
)
25 $(META_INF_DIR
)/$(ARCH
)/$(TARGET_EXEC
): $(BUILD_DIR
)/$(TARGET_EXEC
)
27 cp
$(BUILD_DIR
)/$(TARGET_EXEC
) $(dir $@
)
29 # Find all the C and C++ files we want to compile
30 # Note the single quotes around the * expressions. Make will incorrectly expand these otherwise.
31 SRCS
:= $(shell find
$(SRC_DIRS
) -name
'*.cpp' -or
-name
'*.c' -or
-name
'*.s')
33 # String substitution for every C/C++ file.
34 # As an example, hello.cpp turns into ./build/hello.cpp.o
35 OBJS
:= $(SRCS
:%=$(BUILD_DIR
)/%.o
)
37 # String substitution (suffix version without %).
38 # As an example, ./build/hello.cpp.o turns into ./build/hello.cpp.d
41 # Add a prefix to INC_DIRS. So moduleA would become -ImoduleA. GCC understands this -I flag
42 INC_FLAGS
:= $(addprefix -I
,$(INC_DIRS
))
44 # The -MMD and -MP flags together generate Makefiles for us!
45 # These files will have .d instead of .o as the output.
46 CPPFLAGS
:= $(INC_FLAGS
) -MMD
-MP
48 # The final build step.
49 $(BUILD_DIR
)/$(TARGET_EXEC
): $(OBJS
)
50 $(CC
) $(OBJS
) -o
$@
$(LDFLAGS
)
52 # Build step for C source
53 $(BUILD_DIR
)/%.c.o
: %.c
55 $(CC
) $(CPPFLAGS
) $(CFLAGS
) -c
$< -o
$@
57 # Build step for C++ source
58 $(BUILD_DIR
)/%.
cpp.o
: %.
cpp
60 $(CXX
) $(CPPFLAGS
) $(CXXFLAGS
) -c
$< -o
$@
65 # Include the .d makefiles. The - at the front suppresses the errors of missing
66 # Makefiles. Initially, all the .d files will be missing, and we don't want those