-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(appgen): Add native app template
Closes: #235 Approved by: jmcadden
- Loading branch information
Showing
15 changed files
with
111 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
cmake_minimum_required(VERSION 2.6 FATAL_ERROR) | ||
project("{{ title }}-ebbrt" C CXX) | ||
|
||
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake") | ||
set(CMAKE_CXX_FLAGS_DEBUG "-O0 -g3") | ||
set(CMAKE_CXX_FLAGS_MINSIZEREL "-Os -DNDEBUG") | ||
set(CMAKE_CXX_FLAGS_RELEASE "-O4 -flto -DNDEBUG") | ||
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g3") | ||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++14 -Wall -Werror") | ||
set(BAREMETAL_SOURCES src/{{ title }}.cc) | ||
|
||
if( ${CMAKE_SYSTEM_NAME} STREQUAL "EbbRT") | ||
add_executable({{ title }}.elf ${BAREMETAL_SOURCES}) | ||
add_custom_command(TARGET {{ title }}.elf POST_BUILD | ||
COMMAND objcopy -O elf32-i386 {{ title }}.elf {{ title }}.elf32 ) | ||
|
||
# Hosted =========================================================== | ||
elseif( ${CMAKE_SYSTEM_NAME} STREQUAL "Linux" ) | ||
message(FATAL_ERROR "System name unsupported: ${CMAKE_SYSTEM_NAME}") | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
MYDIR := $(abspath $(dir $(lastword $(MAKEFILE_LIST)))) | ||
|
||
CD ?= cd | ||
CMAKE ?= cmake | ||
CP ?= cp | ||
ECHO ?= echo | ||
MAKE ?= make | ||
MKDIR ?= mkdir | ||
|
||
EBBRTSYSROOT ?= $(abspath $(EBBRT_SYSROOT)) | ||
CMAKE_TOOLCHAIN_FILE ?= $(EBBRTSYSROOT)/usr/misc/ebbrt.cmake | ||
BAREMETAL_PREFIX_PATH= $(EBBRTSYSROOT)/usr/ | ||
|
||
BUILD_PATH ?= $(MYDIR) | ||
DEBUG_PATH ?= $(BUILD_PATH)/Debug | ||
RELEASE_PATH ?= $(BUILD_PATH)/Release | ||
BAREMETAL_DEBUG_DIR ?= $(DEBUG_PATH) | ||
BAREMETAL_RELEASE_DIR ?= $(RELEASE_PATH) | ||
|
||
all: Debug Release | ||
native: native-debug native-release | ||
Debug: native-debug | ||
Release: native-release | ||
|
||
# ENVIRONMENT VARIABLES | ||
check-ebbrt-sysroot: | ||
ifndef EBBRT_SYSROOT | ||
$(error EBBRT_SYSROOT is undefined) | ||
endif | ||
|
||
$(BUILD_PATH): | ||
$(MKDIR) $@ | ||
|
||
$(DEBUG_PATH): | $(BUILD_PATH) | ||
$(MKDIR) $@ | ||
|
||
$(RELEASE_PATH): | $(BUILD_PATH) | ||
$(MKDIR) $@ | ||
|
||
ifneq ($(DEBUG_PATH), $(BAREMETAL_DEBUG_DIR)) | ||
$(BAREMETAL_DEBUG_DIR): | $(DEBUG_PATH) | ||
$(MKDIR) $@ | ||
endif | ||
|
||
ifneq ($(RELEASE_PATH), $(BAREMETAL_RELEASE_DIR)) | ||
$(BAREMETAL_RELEASE_DIR): | $(RELEASE_PATH) | ||
$(MKDIR) $@ | ||
endif | ||
|
||
native-debug: | check-ebbrt-sysroot $(BAREMETAL_DEBUG_DIR) | ||
$(CD) $(BAREMETAL_DEBUG_DIR) && \ | ||
EBBRT_SYSROOT=$(EBBRTSYSROOT) $(CMAKE) -DCMAKE_BUILD_TYPE=Debug \ | ||
-DCMAKE_PREFIX_PATH=$(BAREMETAL_PREFIX_PATH) \ | ||
-DCMAKE_TOOLCHAIN_FILE=$(CMAKE_TOOLCHAIN_FILE) $(MYDIR) && $(MAKE) | ||
|
||
native-release: | check-ebbrt-sysroot $(BAREMETAL_RELEASE_DIR) | ||
$(CD) $(BAREMETAL_RELEASE_DIR) && \ | ||
EBBRT_SYSROOT=$(EBBRTSYSROOT) $(CMAKE) -DCMAKE_BUILD_TYPE=Release \ | ||
-DCMAKE_PREFIX_PATH=$(BAREMETAL_PREFIX_PATH) \ | ||
-DCMAKE_TOOLCHAIN_FILE=$(CMAKE_TOOLCHAIN_FILE) $(MYDIR) && \ | ||
$(MAKE) | ||
|
||
|
||
clean: | ||
$(MAKE) clean -C $(BAREMETAL_DEBUG_DIR) && \ | ||
$(MAKE) clean -C $(BAREMETAL_RELEASE_DIR) | ||
|
||
.PHONY: Debug Release all clean native native-debug native-release |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
// Copyright Boston University SESA Group 2013 - 2016. | ||
// Distributed under the Boost Software License, Version 1.0. | ||
// (See accompanying file LICENSE_1_0.txt or copy at | ||
// http://www.boost.org/LICENSE_1_0.txt) | ||
|
||
#include <ebbrt/Debug.h> | ||
|
||
void AppMain() { ebbrt::kprintf_force("{{ CAP_TITLE }} BACKEND UP.\n"); } |