2

I got a simple problem.

Here's my Android.mk:

LOCAL_PATH:= $(call my-dir)

include $(CLEAR_VARS)

LOCAL_MODULE    := libandroidgameengine
LOCAL_C_INCLUDES := $(LOCAL_PATH)/../include/ \
                    $(LOCAL_PATH)/../interface/ \
                    $(LOCAL_PATH)/../include/Render \
                    $(LOCAL_PATH)/../include/Utils

LOCAL_SRC_FILES :=  # Core
                    ../src/Engine.cpp \

                    # Rendering
                    ../src/Render/RenderManagerImpl.cpp \

                    # Utils
                    ../src/Utils/LogManagerImpl.cpp \

                    # Memory
                    ../src/Memory/MemoryManagerImpl.cpp \
                    ../src/Memory/malloc.c

LOCAL_EXPORT_C_INCLUDES := $(LOCAL_C_INCLUDES)
LOCAL_CFLAGS := -DSTRUCT_MALLINFO_DECLARED
LOCAL_LDLIBS    := -lGLESv2 -llog

I keep getting "Android.mk:11 * commands commence before first target" Error. I know it has something to do with the way I structured the source files (with hashtags to symbolize specific parts of the engine) but I do not understand how it is actually supposed to look like. Any hints? include $(BUILD_STATIC_LIBRARY)

2 Answers 2

7

You can't add comments into a variable definition in Make.

LOCAL_SRC_FILES :=  # Core
                    ../src/Engine.cpp \

...

Makefile syntax is line-based, thus in the code above parser treats only the first line as variable assignment (effectively it sets LOCAL_SRC_FILES to empty string). The second line is parsed as independent statement, in your case as a recipe (because of leading tabs).

Try removing comments from variable definition:

LOCAL_SRC_FILES := \
    ../src/Engine.cpp \
    ../src/Render/RenderManagerImpl.cpp \
    ../src/Utils/LogManagerImpl.cpp \
    ../src/Memory/MemoryManagerImpl.cpp \
    ../src/Memory/malloc.c

Or split it using append operator and leaving comments outside:

# Core
LOCAL_SRC_FILES := ../src/Engine.cpp

# Rendering
LOCAL_SRC_FILES += ../src/Render/RenderManagerImpl.cpp

# Utils
LOCAL_SRC_FILES += ../src/Utils/LogManagerImpl.cpp

# Memory
LOCAL_SRC_FILES += \
    ../src/Memory/MemoryManagerImpl.cpp \
    ../src/Memory/malloc.c
Sign up to request clarification or add additional context in comments.

Comments

2

make sure you have no spaces after a backslashes, also I am not sure if adding blank lines / comments between backslash ended lines is OK

2 Comments

I've made sure there is no space after backslash. Also, Surely you must be able to have commented-lines..?
space after '\' was my problem. Ty!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.