1# 2# Copyright (C) 2016 The Android Open Source Project 3# 4# Licensed under the Apache License, Version 2.0 (the "License"); 5# you may not use this file except in compliance with the License. 6# You may obtain a copy of the License at 7# 8# http://www.apache.org/licenses/LICENSE-2.0 9# 10# Unless required by applicable law or agreed to in writing, software 11# distributed under the License is distributed on an "AS IS" BASIS, 12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13# See the License for the specific language governing permissions and 14# limitations under the License. 15# 16 17SELF_DIR := $(SELF_MKFILE:Makefile=) 18SELF_FILES := $(wildcard $(SELF_DIR)*.c) 19APP_NM := $(SELF_DIR)app 20CLEANFILES := $(CLEANFILES) $(APP_NM).elf $(APP_NM).bin 21DELIVERABLES := $(DELIVERABLES) $(APP_NM).napp 22APP_ELF := $(APP_NM).elf 23APP_BIN := $(APP_NM).bin 24APP_APP := $(APP_NM).napp 25APPFLAGS += $(EXTRA_FLAGS) -Wall -Werror 26 27define APPRULE 28$(APP_APP): $(APP_BIN) 29 nanoapp_postprocess -v -a $(APP_ID) $(APP_BIN) $(APP_APP) 30 31$(APP_BIN): $(APP_ELF) 32 $(OBJCOPY) -j.relocs -j.flash -j.data -j.dynsym -O binary $(APP_ELF) $(APP_BIN) 33 34$(APP_ELF): $(SELF_FILES) symlinks 35 $(GCC) -o $(APP_ELF) $(FLAGS) $(APPFLAGS) -fvisibility=hidden $(SELF_FILES) 36endef 37 38$(eval $(APPRULE)) 39