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