KaiserJohaan
KaiserJohaan

Reputation: 9240

Android.mk syntax issue

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)

Upvotes: 2

Views: 7857

Answers (2)

Eldar Abusalimov
Eldar Abusalimov

Reputation: 25483

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

Upvotes: 7

marcinj
marcinj

Reputation: 49976

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

Upvotes: 2

Related Questions