| # Copyright (c) 2011 The Native Client Authors. All rights reserved. |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| # |
| |
| # Build OpenAL/ogg demo with Pepper in C |
| VALID_TOOLCHAINS := glibc newlib pnacl |
| NACL_SDK_ROOT ?= $(abspath $(CURDIR)/../..) |
| include $(NACL_SDK_ROOT)/tools/common.mk |
| |
| TARGET = openal-ogg-demo |
| LIBS = openal vorbisfile vorbis ogg m ppapi pthread |
| SOURCES = openal_ogg.c ogg_buffer_reader.c |
| INSTALL_DIR = $(NACL_PACKAGES_PUBLISH)/openal-ogg-demo/$(TOOLCHAIN) |
| CFLAGS = -Wall -Werror |
| |
| ifeq ($(TOOLCHAIN),pnacl) |
| EXEEXT=.pexe |
| else |
| EXEEXT=.nexe |
| endif |
| |
| ifneq ($(TOOLCHAIN),pnacl) |
| # We want the nmf to contain all the .nexe we have previously |
| # built as well as the one currently being built, so we modify |
| # the list of executables that we pass to create_nmf. |
| EXECUTABLES += $(wildcard $(OUTDIR)/$(TARGET)_x86_64$(EXEEXT)) |
| EXECUTABLES += $(wildcard $(OUTDIR)/$(TARGET)_x86_32$(EXEEXT)) |
| EXECUTABLES += $(wildcard $(OUTDIR)/$(TARGET)_arm$(EXEEXT)) |
| endif |
| |
| # Build rules generated by macros from common.mk: |
| |
| $(foreach src,$(SOURCES),$(eval $(call COMPILE_RULE,$(src),$(CFLAGS)))) |
| |
| ifeq ($(CONFIG),Release) |
| $(eval $(call LINK_RULE,$(TARGET)_unstripped,$(SOURCES),$(LIBS),$(DEPS))) |
| $(eval $(call STRIP_RULE,$(TARGET),$(TARGET)_unstripped)) |
| else |
| $(eval $(call LINK_RULE,$(TARGET),$(SOURCES),$(LIBS),$(DEPS))) |
| endif |
| |
| $(eval $(call NMF_RULE,$(TARGET),)) |
| |
| install: |
| mkdir -p $(INSTALL_DIR) |
| cp $(OUTDIR)/$(TARGET)*$(EXEEXT) $(INSTALL_DIR) |
| rm -f $(INSTALL_DIR)/*_unstripped_*$(EXEEXT) |
| cp $(OUTDIR)/$(TARGET).nmf $(INSTALL_DIR) |
| ifeq ($(TOOLCHAIN),glibc) |
| cp -r $(OUTDIR)/lib* $(INSTALL_DIR) |
| endif |
| cp index.html $(INSTALL_DIR) |
| cp sample.ogg $(INSTALL_DIR) |
| ifeq ($(TOOLCHAIN),pnacl) |
| sed -i.bak 's/x-nacl/x-pnacl/g' $(INSTALL_DIR)/index.html |
| endif |