Please copy and save the content below as Makefile.

Note: there are several places that need to be adjusted: EXTRA_FLAGS, lib_srcs and package_version. Please read the highlighted comments below.

### Makefile for npruntime-graphical-plugin

### Compiler setup

ifndef VIP
  $(error VIP not set, check Makefile for alternatives.)
endif

# Architecture handling
ifeq ($(VIP),bcm74xx)
VIP_ARCH       = mipsel-motorola-linux-uclibc
endif
ifeq ($(VIP),st40)
VIP_ARCH       = sh4-motorola-linux-gnu
endif

VIP_NAME       = $(VIP)

## Toolchain
DK_DIR        = $(CURDIR)/../.. # You can adjust the location of "DK_DIR" here, but better leave it as it is.
TOOLCHAIN_DIR = $(shell cat $(DK_DIR)/$(VIP_NAME)/toolchain_dir)
VIP_DIR       = $(DK_DIR)/$(VIP_NAME)
CC            = $(TOOLCHAIN_DIR)/bin/$(VIP_ARCH)-gcc
CXX           = $(TOOLCHAIN_DIR)/bin/$(VIP_ARCH)-c++

export PERLLIB = $(DK_DIR)/bin
EXTRA_FLAGS = -DXP_UNIX # XP_UNIX is a must-have macro. You may need add your own define here.

## GCC setup
CXXFLAGS += -Wall
CXXFLAGS += -c
CXXFLAGS += -Os

CXXFLAGS += -fPIC
CXXFLAGS += -g

# Include files and libraries
CPPFLAGS += -I$(DK_DIR)/include/npapi
CPPFLAGS += -I$(DK_DIR)/include/eklibrary_webkit/EKLibrary/PublicHeaders
CPPFLAGS += -I$(DK_DIR)/include/eklibrary_webkit/EKLibrary/PublicHeaders/Plugins

LDFLAGS += -Wl,--version-script=$(lib_version_script)


CPPFLAGS += $(EXTRA_FLAGS)
LDFLAGS += $(EXTRA_FLAGS)

lib_target = libnpplugin.so #The default name of generated plug-in.
lib_srcs  += YourSource1.cpp # Put all your source files here for compiling.
lib_srcs  += YourSource2.cpp
lib_objs   = $(lib_srcs:.cpp=.o)
lib_version_script = GraphicalPluginModule.ver

### Build dirs

build_dir = $(CURDIR)/.build


### Install packages

package_name    = example-npruntime-graphical-plugin
package_version = BSG_BUILD_VERSION # Replace "BSG_BUILD_VERSION" with the "Version" string available in $(DK_DIR)/sdk/build_data.xml.
package_target = $(CURDIR)/$(package_name)_$(package_version)_$(VIP_NAME).iip
package_data    = $(build_dir)/package/data
package_install = $(CURDIR)/install.sh

### Build rules

all: $(package_target)

clean:
	rm -rf *.o $(lib_target) $(package_data) $(package_target)

$(lib_target): $(lib_objs)
	$(CXX) $(LDFLAGS) -shared -rdynamic -o $@ $^

$(package_data): $(lib_target)
	rm -rf $@
	mkdir -p $(package_data)
	cp $^ $(package_data)

$(package_target): $(package_data)
	$(DK_DIR)/bin/iip_build \
	  --name $(package_name) \
	  --version $(package_version) \
	  --processor $(VIP_NAME) \
	  --data_dir $^ \
	  --install buildtime:$(package_install)

.PHONY: all clean