Makefile 2.1 KB

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