test/nacl/Makefile
author Gabriel Jacobo <gabomdq@gmail.com>
Fri, 06 Jun 2014 18:33:17 -0300
changeset 8834 b300e097899d
child 8851 a7cfe554d337
permissions -rw-r--r--
Adds missing Makefile for NACL test and a couple of smaller fixes
gabomdq@8834
     1
# Copyright (c) 2013 The Chromium Authors. All rights reserved.
gabomdq@8834
     2
# Use of this source code is governed by a BSD-style license that can be
gabomdq@8834
     3
# found in the LICENSE file.
gabomdq@8834
     4
gabomdq@8834
     5
# GNU Makefile based on shared rules provided by the Native Client SDK.
gabomdq@8834
     6
# See README.Makefiles for more details.
gabomdq@8834
     7
gabomdq@8834
     8
VALID_TOOLCHAINS := pnacl
gabomdq@8834
     9
gabomdq@8834
    10
# NACL_SDK_ROOT ?= $(abspath $(CURDIR)/../../..)
gabomdq@8834
    11
include $(NACL_SDK_ROOT)/tools/common.mk
gabomdq@8834
    12
gabomdq@8834
    13
gabomdq@8834
    14
TARGET = sdl_app
gabomdq@8834
    15
DEPS = ppapi_simple nacl_io
gabomdq@8834
    16
# ppapi_simple ends up being listed twice due to dependency solving issues -- Gabriel
gabomdq@8834
    17
LIBS = SDL2_test SDL2 ppapi_simple SDL2main $(DEPS) ppapi_gles2 ppapi_cpp ppapi pthread 
gabomdq@8834
    18
gabomdq@8834
    19
CFLAGS := -Wall
gabomdq@8834
    20
SOURCES ?= testgles2.c
gabomdq@8834
    21
gabomdq@8834
    22
# Build rules generated by macros from common.mk:
gabomdq@8834
    23
# Overriden macro from NACL SDK to be able to customize the library search path -- Gabriel
gabomdq@8834
    24
# Specific Link Macro 
gabomdq@8834
    25
#
gabomdq@8834
    26
# $1 = Target Name
gabomdq@8834
    27
# $2 = List of inputs
gabomdq@8834
    28
# $3 = List of libs
gabomdq@8834
    29
# $4 = List of deps
gabomdq@8834
    30
# $5 = List of lib dirs
gabomdq@8834
    31
# $6 = Other Linker Args
gabomdq@8834
    32
#
gabomdq@8834
    33
# For debugging, we translate the pre-finalized .bc file.
gabomdq@8834
    34
#
gabomdq@8834
    35
define LINKER_RULE
gabomdq@8834
    36
all: $(1).pexe 
gabomdq@8834
    37
$(1)_x86_32.nexe : $(1).bc
gabomdq@8834
    38
	$(call LOG,TRANSLATE,$$@,$(PNACL_TRANSLATE) --allow-llvm-bitcode-input -arch x86-32 $$^ -o $$@)
gabomdq@8834
    39
gabomdq@8834
    40
$(1)_x86_64.nexe : $(1).bc
gabomdq@8834
    41
	$(call LOG,TRANSLATE,$$@,$(PNACL_TRANSLATE) --allow-llvm-bitcode-input -arch x86-64 $$^ -o $$@)
gabomdq@8834
    42
gabomdq@8834
    43
$(1)_arm.nexe : $(1).bc
gabomdq@8834
    44
	$(call LOG,TRANSLATE,$$@,$(PNACL_TRANSLATE) --allow-llvm-bitcode-input -arch arm $$^ -o $$@)
gabomdq@8834
    45
gabomdq@8834
    46
$(1).pexe: $(1).bc
gabomdq@8834
    47
	$(call LOG,FINALIZE,$$@,$(PNACL_FINALIZE) -o $$@ $$^)
gabomdq@8834
    48
gabomdq@8834
    49
$(1).bc: $(2) $(foreach dep,$(4),$(STAMPDIR)/$(dep).stamp)
gabomdq@8834
    50
	$(call LOG,LINK,$$@,$(PNACL_LINK) -o $$@ $(2) $(PNACL_LDFLAGS) $(foreach path,$(5),-L$(path)/pnacl/$(CONFIG)) -L./lib $(foreach lib,$(3),-l$(lib)) $(6))
gabomdq@8834
    51
endef
gabomdq@8834
    52
gabomdq@8834
    53
$(foreach dep,$(DEPS),$(eval $(call DEPEND_RULE,$(dep))))
gabomdq@8834
    54
$(foreach src,$(SOURCES),$(eval $(call COMPILE_RULE,$(src),$(CFLAGS))))
gabomdq@8834
    55
gabomdq@8834
    56
ifeq ($(CONFIG),Release)
gabomdq@8834
    57
$(eval $(call LINK_RULE,$(TARGET)_unstripped,$(SOURCES),$(LIBS),$(DEPS)))
gabomdq@8834
    58
$(eval $(call STRIP_RULE,$(TARGET),$(TARGET)_unstripped))
gabomdq@8834
    59
else
gabomdq@8834
    60
$(eval $(call LINK_RULE,$(TARGET),$(SOURCES),$(LIBS),$(DEPS)))
gabomdq@8834
    61
endif
gabomdq@8834
    62
gabomdq@8834
    63
$(eval $(call NMF_RULE,$(TARGET),))