I need some custom MACROs in my NDK projects however I have no ideal how to add and I found no answers Could anyone please help? Many thanks!
Overview. The Android.mk file resides in a subdirectory of your project's jni/ directory, and describes your sources and shared libraries to the build system. It is really a tiny GNU makefile fragment that the build system parses once or more.
The NDK itself invokes a customized cross-compiler built on the arm-eabi-gcc compiler.
OpenJDK has the same code as OracleJDK, depending on what provider you're using. The key difference (as stated above) is that OpenJDK is an open source java development kit, whereas Oracle JDK is closed source.
If you would like to add a special definition when compiling your NDK code (jni) add the following into your Android.mk:
LOCAL_CFLAGS := -DMYDEFINE
This will define the Macro MYDEFINE in your c/c++ code. Here an example
#ifdef MYDEFINE
// We build the project with this special macro
#else
// We build without setting the macro in the LOCAL_CFLAGS
#endif
If you understand you correctly, you need to look at how the C Preprocessor works.
Do you have any experience in writing C/C++-programs? First off, you should be really picky on what parts of your application you write in native code. Also, you need to keep in mind that the native code will behave totally different when it comes to memory allocation and such, so this really isn't the place for guesswork.
Spend some time getting to know C/C++, design your application wisely so that the parts you want to write in native code is clearly defined, and that it doesn't increase the chance of your application crashing. I'm guessing most projects can do without an native application part, so if you're using it, and don't know exactly what you're doing, you should really re-asses whether it's the right thing to do or not.
If you're talking about android makefile MACROs like
$(call my-dir)
It's exactly same as GNU makefile syntax
Gnu makefile manual
For instance:
reverse = $(2) $(1)
foo = $(call reverse,a,b)
$(warning $(foo))
results:
b a
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With