# Copyright (c) 2017 Silk Labs, Inc.
# All Rights Reserved.
# Confidential and Proprietary - Silk Labs, Inc.
#
# This task builds silk.img, which is an ext4 filesystem containing the contents
# of /system/silk.  It may be pushed onto a device at /data/silk.img (if not
# overridden by ro.silk.update.img.file), and activated via |adb shell setprop
# persist.silk.root silk.img|.  When active it overrides the current contents of
# /system/silk.

SILKIMAGE=$(PRODUCT_OUT)/silk.img
.PHONY: $(SILKIMAGE)

.PHONY: silkimage
silkimage: $(SILKIMAGE)

$(SILKIMAGE): $(MAKE_EXT4FS)
	@echo "silk.img: $@"
	$(MAKE_EXT4FS) \
    -l $$(( ($$(du -sh $(TARGET_OUT_SILK) | cut -dM -f1) + 25) * 1000000 )) \
    -i 2048 \
    -L silkimage \
    -J \
    $@ \
    $(TARGET_OUT_SILK)

Add extra padding for filesystem size

# Copyright (c) 2017 Silk Labs, Inc.
# All Rights Reserved.
# Confidential and Proprietary - Silk Labs, Inc.
#
# This task builds silk.img, which is an ext4 filesystem containing the contents
# of /system/silk.  It may be pushed onto a device at /data/silk.img (if not
# overridden by ro.silk.update.img.file), and activated via |adb shell setprop
# persist.silk.root silk.img|.  When active it overrides the current contents of
# /system/silk.

SILKIMAGE=$(PRODUCT_OUT)/silk.img
.PHONY: $(SILKIMAGE)

.PHONY: silkimage
silkimage: $(SILKIMAGE)

$(SILKIMAGE): $(MAKE_EXT4FS)
	@echo "silk.img: $@"
	$(MAKE_EXT4FS) \
    -l $$(( ($$(du -sh $(TARGET_OUT_SILK) | cut -dM -f1) + 50) * 1000000 )) \
    -i 2048 \
    -L silkimage \
    -J \
    $@ \
    $(TARGET_OUT_SILK)


LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)

LOCAL_CPP_EXTENSION := .cc

# Set up the target identity
LOCAL_MODULE := libpac
LOCAL_MODULE_CLASS := SHARED_LIBRARIES

LOCAL_SRC_FILES := \
  src/proxy_resolver_v8.cc \
  src/proxy_resolver_js_bindings.cc \
  src/net_util.cc

LOCAL_CFLAGS += \
  -Wno-endif-labels \
  -Wno-import \
  -Wno-format \
  -Wno-unused-parameter \

LOCAL_C_INCLUDES += $(LOCAL_PATH)/src \
                    external/chromium_org/v8 \
                    external/chromium_org/src/v8 \

# Depend on V8 from WebView
# DO NOT COPY without permission from WebView Owners
LOCAL_STATIC_LIBRARIES := v8_tools_gyp_v8_base_gyp \
			  v8_tools_gyp_v8_libbase_gyp \
                          v8_tools_gyp_v8_snapshot_gyp \
                          third_party_icu_icui18n_gyp \
                          third_party_icu_icuuc_gyp \
                          third_party_icu_icudata_gyp

LOCAL_SHARED_LIBRARIES := libutils libstlport liblog libgabi++

include external/stlport/libstlport.mk

include $(BUILD_SHARED_LIBRARY)

Revert "Statically link chromium's ICU."

LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)

LOCAL_CPP_EXTENSION := .cc

# Set up the target identity
LOCAL_MODULE := libpac
LOCAL_MODULE_CLASS := SHARED_LIBRARIES

LOCAL_SRC_FILES := \
  src/proxy_resolver_v8.cc \
  src/proxy_resolver_js_bindings.cc \
  src/net_util.cc

LOCAL_CFLAGS += \
  -Wno-endif-labels \
  -Wno-import \
  -Wno-format \
  -Wno-unused-parameter \

LOCAL_C_INCLUDES += $(LOCAL_PATH)/src \
                    external/chromium_org/v8 \
                    external/chromium_org/src/v8 \

# Depend on V8 from WebView
# DO NOT COPY without permission from WebView Owners
LOCAL_STATIC_LIBRARIES := v8_tools_gyp_v8_base_gyp \
			  v8_tools_gyp_v8_libbase_gyp \
                          v8_tools_gyp_v8_snapshot_gyp

LOCAL_SHARED_LIBRARIES := libutils libstlport liblog libicui18n libicuuc

include external/stlport/libstlport.mk

include $(BUILD_SHARED_LIBRARY)


# Android makefile
# Build this using ndk as
# ndk-build NDK_PROJECT_PATH=.  APP_BUILD_SCRIPT=Android.mk
#

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)
LOCAL_MODULE := libOpenCL
LOCAL_C_INCLUDES := $(LOCAL_PATH)/include/
LOCAL_SRC_FILES :=  libopencl.c
LOCAL_CFLAGS   = -fPIC -O2

include $(BUILD_STATIC_LIBRARY)

Edit android.mk for new src path

# Android makefile
# Build this using ndk as
# ndk-build NDK_PROJECT_PATH=.  APP_BUILD_SCRIPT=Android.mk
#

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)
LOCAL_MODULE := libOpenCL
LOCAL_C_INCLUDES := $(LOCAL_PATH)/include/
LOCAL_SRC_FILES :=  src/libopencl.c
LOCAL_CFLAGS   = -fPIC -O2

include $(BUILD_STATIC_LIBRARY)


.PHONY: dist-rpm

RPM_WORKSPACE=$(shell pwd)/build
RPM_DIR=$(RPM_WORKSPACE)/rpmbuild
RPM_VER=$(shell echo $(VERSION) | awk -F_ '{ print $$1 }')
RPM_REL=$(shell echo $(VERSION) | awk -F_ '{ print $$2"_"$$3 }')

dist-rpm: dist
	rm -rf $(RPM_WORKSPACE)
	mkdir -p $(RPM_DIR)
	mkdir $(RPM_DIR)/SOURCES
	mkdir $(RPM_DIR)/BUILD
	mkdir $(RPM_DIR)/RPMS
	mkdir $(RPM_DIR)/SRPMS
	cp $(PACKAGE)-$(VERSION).tar.gz $(RPM_DIR)/SOURCES
	sed 's/@VERSION@/$(RPM_VER)/g;s/@RELEASE@/$(RPM_REL)/g' < packaging/rpm/$(PACKAGE).spec.in > $(RPM_WORKSPACE)/$(PACKAGE).spec
	(cd $(RPM_WORKSPACE); rpmbuild -ba $(PACKAGE).spec)
	mv $(RPM_DIR)/RPMS/*/*.rpm `pwd`
	mv $(RPM_DIR)/SRPMS/*.rpm `pwd`
	rm -rf $(RPM_WORKSPACE)

Remove 'g' prefix from the version

.PHONY: dist-rpm

RPM_WORKSPACE=$(shell pwd)/build
RPM_DIR=$(RPM_WORKSPACE)/rpmbuild
RPM_VER=$(shell echo $(VERSION) | awk -F_ '{ print $$1 }')
RPM_REL=$(shell echo $(VERSION) | awk -F_ '{ sub(/g/, "", $$3); print $$2"_"$$3 }')

dist-rpm: dist
	rm -rf $(RPM_WORKSPACE)
	mkdir -p $(RPM_DIR)
	mkdir $(RPM_DIR)/SOURCES
	mkdir $(RPM_DIR)/BUILD
	mkdir $(RPM_DIR)/RPMS
	mkdir $(RPM_DIR)/SRPMS
	cp $(PACKAGE)-$(VERSION).tar.gz $(RPM_DIR)/SOURCES
	sed 's/@VERSION@/$(RPM_VER)/g;s/@RELEASE@/$(RPM_REL)/g' < packaging/rpm/$(PACKAGE).spec.in > $(RPM_WORKSPACE)/$(PACKAGE).spec
	(cd $(RPM_WORKSPACE); rpmbuild -ba $(PACKAGE).spec)
	mv $(RPM_DIR)/RPMS/*/*.rpm `pwd`
	mv $(RPM_DIR)/SRPMS/*.rpm `pwd`
	rm -rf $(RPM_WORKSPACE)


#
# Component Makefile
#

COMPONENT_ADD_INCLUDEDIRS := port/include mbedtls/include

COMPONENT_SRCDIRS := mbedtls/library port

COMPONENT_OBJEXCLUDE := mbedtls/library/net_sockets.o

Add mbedtls submodule check to build system

#
# Component Makefile
#

COMPONENT_ADD_INCLUDEDIRS := port/include mbedtls/include

COMPONENT_SRCDIRS := mbedtls/library port

COMPONENT_OBJEXCLUDE := mbedtls/library/net_sockets.o

COMPONENT_SUBMODULES += mbedtls


# paths
PREFIX = /usr/local
MANPREFIX = ${PREFIX}/share/man

X11INC = /usr/X11R6/include
X11LIB = /usr/X11R6/lib

# Xft, comment if you don't want it
XFTINC = -I/usr/include/freetype2
XFTLIBS  = -lXft -lXrender -lfreetype -lz -lfontconfig

# Xinerama, comment if you don't want it
XINERAMALIBS  = -lXinerama
XINERAMAFLAGS = -DXINERAMA

# inih flags
INIFLAGS = -DINI_ALLOW_MULTILINE=0

# includes and libs
INCS = -I${X11INC} -I/usr/lib/dbus-1.0/include -I/usr/include/dbus-1.0 ${XFTINC}
LIBS = -L${X11LIB} -lX11 -lXext -lXss -ldbus-1 ${XFTLIBS} -lpthread -liniparser -lrt ${XINERAMALIBS}

# flags
CPPFLAGS = -D_BSD_SOURCE -DVERSION=\"${VERSION}\" ${XINERAMAFLAGS} ${INIFLAGS}
CFLAGS   = -g -ansi -pedantic -Wall -Os ${INCS} ${CPPFLAGS}
LDFLAGS  = ${LIBS}

# compiler and linker
CC = cc

Remove -liniparser, not needed anymore.

# paths
PREFIX = /usr/local
MANPREFIX = ${PREFIX}/share/man

X11INC = /usr/X11R6/include
X11LIB = /usr/X11R6/lib

# Xft, comment if you don't want it
XFTINC = -I/usr/include/freetype2
XFTLIBS  = -lXft -lXrender -lfreetype -lz -lfontconfig

# Xinerama, comment if you don't want it
XINERAMALIBS  = -lXinerama
XINERAMAFLAGS = -DXINERAMA

# inih flags
INIFLAGS = -DINI_ALLOW_MULTILINE=0

# includes and libs
INCS = -I${X11INC} -I/usr/lib/dbus-1.0/include -I/usr/include/dbus-1.0 ${XFTINC}
LIBS = -L${X11LIB} -lX11 -lXext -lXss -ldbus-1 ${XFTLIBS} -lpthread -lrt ${XINERAMALIBS}

# flags
CPPFLAGS = -D_BSD_SOURCE -DVERSION=\"${VERSION}\" ${XINERAMAFLAGS} ${INIFLAGS}
CFLAGS   = -g -ansi -pedantic -Wall -Os ${INCS} ${CPPFLAGS}
LDFLAGS  = ${LIBS}

# compiler and linker
CC = cc


SPINDLE_DIR=../../../vendor/spindle-1.0/spindle
MKPEF=$(SPINDLE_DIR)/mkpef
PEF2PRG=$(SPINDLE_DIR)/pef2prg
XA=xa

# Variables to be defined on each part Makefile:
#
# Mandatory:
#   - PART: name of part
# Optional:
#   - SRC: list of source files to be compiled with xa
#   - OBJ: list of object files to be compiled into a "part effect" (.pef)

SRC=$(PART).s
OBJ=$(PART).efo

all: $(PART).pef $(PART).prg

$(PART).efo: $(SRC)
	$(XA) -o $@ $^

$(PART).pef: $(OBJ)
	${MKPEF} -o $@ $^

%.prg: %.pef
	${PEF2PRG} -o $@ $^

clean:
	rm -f *.efo *.pef *.prg

run: $(PART).prg
	x64 $<

.PHONY: clean run

Make sure make clean does not delete other .prg files

SPINDLE_DIR=../../../vendor/spindle-1.0/spindle
MKPEF=$(SPINDLE_DIR)/mkpef
PEF2PRG=$(SPINDLE_DIR)/pef2prg
XA=xa

# Variables to be defined on each part Makefile:
#
# Mandatory:
#   - PART: name of part
# Optional:
#   - SRC: list of source files to be compiled with xa
#   - OBJ: list of object files to be compiled into a "part effect" (.pef)

SRC=$(PART).s
OBJ=$(PART).efo

all: $(PART).pef $(PART).prg

$(PART).efo: $(SRC)
	$(XA) -o $@ $^

$(PART).pef: $(OBJ)
	${MKPEF} -o $@ $^

%.prg: %.pef
	${PEF2PRG} -o $@ $^

clean:
	rm -f *.efo *.pef $(PART).prg

run: $(PART).prg
	x64 $<

.PHONY: clean run


LOCAL_DIR := $(GET_LOCAL_DIR)

ARCH := arm
ARM_CPU := cortex-a8
#arm1136j-s
CPU := generic

DEFINES += WITH_CPU_EARLY_INIT=1 MEMBASE=0

INCLUDES += -I$(LOCAL_DIR)/include

DEVS += fbcon
MODULES += dev/fbcon

OBJS += \
	$(LOCAL_DIR)/arch_init.o \
	$(LOCAL_DIR)/platform.o \
	$(LOCAL_DIR)/interrupts.o \
	$(LOCAL_DIR)/gpio.o \
	$(LOCAL_DIR)/acpuclock.o \
	$(LOCAL_DIR)/lcdc.o

LINKER_SCRIPT += $(BUILDDIR)/system-onesegment.ld

include platform/msm_shared/rules.mk

Add code to support Scorpion warm boot in lk bootloader

LOCAL_DIR := $(GET_LOCAL_DIR)

ARCH := arm
ARM_CPU := cortex-a8
#arm1136j-s
CPU := generic

DEFINES += WITH_CPU_EARLY_INIT=1 WITH_CPU_WARM_BOOT=1 MEMBASE=0

INCLUDES += -I$(LOCAL_DIR)/include

DEVS += fbcon
MODULES += dev/fbcon

OBJS += \
	$(LOCAL_DIR)/arch_init.o \
	$(LOCAL_DIR)/platform.o \
	$(LOCAL_DIR)/interrupts.o \
	$(LOCAL_DIR)/gpio.o \
	$(LOCAL_DIR)/acpuclock.o \
	$(LOCAL_DIR)/lcdc.o

LINKER_SCRIPT += $(BUILDDIR)/system-onesegment.ld

include platform/msm_shared/rules.mk


# $Id$
#

include build2/generated_lists

PHP_AUTOCONF ?= 'autoconf'
PHP_AUTOHEADER ?= 'autoheader'

all: configure config.h.in

aclocal.m4: configure.in acinclude.m4
	@echo rebuilding $@
	@if [ -f /usr/share/aclocal/ltsugar.m4 ]; then cat /usr/share/aclocal/lt~obsolete.m4 /usr/share/aclocal/ltoptions.m4 /usr/share/aclocal/ltsugar.m4 /usr/share/aclocal/ltversion.m4 >> ./build/libtool.m4; fi
	cat acinclude.m4 ./build/libtool.m4 php_gtk.m4 > $@

configure: aclocal.m4 php_gtk.m4 config.m4 $(config_m4_files)
	@echo rebuilding $@
	$(PHP_AUTOCONF)
	@chmod 755 $@

config.h.in: configure
# explicitly remove target since autoheader does not seem to work
# correctly otherwise (timestamps are not updated)
	@echo rebuilding $@
	@rm -f $@
	$(PHP_AUTOHEADER)

Remove broken "fix" for build issues with newer libtool

# $Id$
#

include build2/generated_lists

PHP_AUTOCONF ?= 'autoconf'
PHP_AUTOHEADER ?= 'autoheader'

all: configure config.h.in

aclocal.m4: configure.in acinclude.m4
	@echo rebuilding $@
	cat acinclude.m4 ./build/libtool.m4 php_gtk.m4 > $@

configure: aclocal.m4 php_gtk.m4 config.m4 $(config_m4_files)
	@echo rebuilding $@
	$(PHP_AUTOCONF)
	@chmod 755 $@

config.h.in: configure
# explicitly remove target since autoheader does not seem to work
# correctly otherwise (timestamps are not updated)
	@echo rebuilding $@
	@rm -f $@
	$(PHP_AUTOHEADER)


SELF_DIR := $(abspath $(dir $(lastword $(MAKEFILE_LIST))))

COMMON_SOURCES := $(shell /usr/bin/find $(SELF_DIR)/common/src/main -name *.scala)
RUNNER_SOURCES := $(shell /usr/bin/find $(SELF_DIR)/runner/src/main -name *.scala)
GRADER_SOURCES := $(shell /usr/bin/find $(SELF_DIR)/grader/src/main -name *.scala)
BACKEND_SOURCES := $(COMMON_SOURCES) $(RUNNER_SOURCES) $(GRADER_SOURCES)

SCALA_VERSION := $(shell grep '^\s*scalaVersion' $(SELF_DIR)/build.sbt | sed -e 's/.*"\([0-9]\+\.[0-9]\+\).*".*/\1/')
OMEGAUP_VERSION := $(shell git describe)
RUNNER_JAR := $(SELF_DIR)/runner/target/scala-$(SCALA_VERSION)/proguard/runner_$(SCALA_VERSION)-$(OMEGAUP_VERSION).jar
GRADER_JAR := $(SELF_DIR)/grader/target/scala-$(SCALA_VERSION)/proguard/grader_$(SCALA_VERSION)-$(OMEGAUP_VERSION).jar

Use better git-define for version

SELF_DIR := $(abspath $(dir $(lastword $(MAKEFILE_LIST))))

COMMON_SOURCES := $(shell /usr/bin/find $(SELF_DIR)/common/src/main -name *.scala)
RUNNER_SOURCES := $(shell /usr/bin/find $(SELF_DIR)/runner/src/main -name *.scala)
GRADER_SOURCES := $(shell /usr/bin/find $(SELF_DIR)/grader/src/main -name *.scala)
BACKEND_SOURCES := $(COMMON_SOURCES) $(RUNNER_SOURCES) $(GRADER_SOURCES)

SCALA_VERSION := $(shell grep '^\s*scalaVersion' $(SELF_DIR)/build.sbt | sed -e 's/.*"\([0-9]\+\.[0-9]\+\).*".*/\1/')
OMEGAUP_VERSION := $(shell cd $(SELF_DIR) && git describe --tags)
RUNNER_JAR := $(SELF_DIR)/runner/target/scala-$(SCALA_VERSION)/proguard/runner_$(SCALA_VERSION)-$(OMEGAUP_VERSION).jar
GRADER_JAR := $(SELF_DIR)/grader/target/scala-$(SCALA_VERSION)/proguard/grader_$(SCALA_VERSION)-$(OMEGAUP_VERSION).jar


LD_FILE = boards/samd21x18-external-flash.ld
USB_VID = 0x239A
USB_PID = 0x8015

FLASH_IMPL = spi_flash.c

CHIP_VARIANT = SAMD21G18A

Switch Metro back to including bootloader space.

LD_FILE = boards/samd21x18-bootloader-external-flash.ld
USB_VID = 0x239A
USB_PID = 0x8015

FLASH_IMPL = spi_flash.c

CHIP_VARIANT = SAMD21G18A


.if !defined(TOPDIR)
.error "TOPDIR must be defined."
.endif

.PATH: ${TOPDIR}/event

SRCS+=	event_poll.cc
SRCS+=	event_system.cc
SRCS+=	timeout.cc

.if !defined(USE_POLL)
.if ${OSNAME} == "Darwin" || ${OSNAME} == "FreeBSD"
USE_POLL=	kqueue
.else
USE_POLL=	poll
.endif
.endif

.if ${OSNAME} == "Linux"
# Required for clock_gettime(3).
LDADD+=		-lrt
.endif

SRCS+=	event_poll_${USE_POLL}.cc

.if ${USE_POLL} == "kqueue"
CFLAGS+=-DUSE_POLL_KQUEUE
.elif ${USE_POLL} == "poll"
CFLAGS+=-DUSE_POLL_POLL
.elif ${USE_POLL} == "select"
CFLAGS+=-DUSE_POLL_SELECT
.else
.error "Unsupported poll mechanism."
.endif

Use select, not poll, on Interix.

.if !defined(TOPDIR)
.error "TOPDIR must be defined."
.endif

.PATH: ${TOPDIR}/event

SRCS+=	event_poll.cc
SRCS+=	event_system.cc
SRCS+=	timeout.cc

.if !defined(USE_POLL)
.if ${OSNAME} == "Darwin" || ${OSNAME} == "FreeBSD"
USE_POLL=	kqueue
.elif ${OSNAME} == "Interix"
USE_POLL=	select
.else
USE_POLL=	poll
.endif
.endif

.if ${OSNAME} == "Linux"
# Required for clock_gettime(3).
LDADD+=		-lrt
.endif

SRCS+=	event_poll_${USE_POLL}.cc

.if ${USE_POLL} == "kqueue"
CFLAGS+=-DUSE_POLL_KQUEUE
.elif ${USE_POLL} == "poll"
CFLAGS+=-DUSE_POLL_POLL
.elif ${USE_POLL} == "select"
CFLAGS+=-DUSE_POLL_SELECT
.else
.error "Unsupported poll mechanism."
.endif


# IBM_PROLOG_BEGIN_TAG
# This is an automatically generated prolog.
#
# $Source: src/import/chips/p9/procedures/hwp/initfiles/p9_fbc_ab_hp_scom.mk $
#
# OpenPOWER HostBoot Project
#
# Contributors Listed Below - COPYRIGHT 2016,2019
# [+] International Business Machines Corp.
#
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied. See the License for the specific language governing
# permissions and limitations under the License.
#
# IBM_PROLOG_END_TAG
PROCEDURE=p9_fbc_ab_hp_scom
$(call BUILD_PROCEDURE)

Add no variable tracking to initfile procedures to imporve build time

# IBM_PROLOG_BEGIN_TAG
# This is an automatically generated prolog.
#
# $Source: src/import/chips/p9/procedures/hwp/initfiles/p9_fbc_ab_hp_scom.mk $
#
# OpenPOWER HostBoot Project
#
# Contributors Listed Below - COPYRIGHT 2016,2019
# [+] International Business Machines Corp.
#
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied. See the License for the specific language governing
# permissions and limitations under the License.
#
# IBM_PROLOG_END_TAG
PROCEDURE=p9_fbc_ab_hp_scom
lib$(PROCEDURE)_COMMONFLAGS+=-fno-var-tracking-assignments
$(call BUILD_PROCEDURE)


LINK = link /NOLOGO
CC = cl /nologo
CFLAGS = /W4 /MT /GR /EHsc /D_CRT_SECURE_NO_WARNINGS
O = .\obj
S = .\src

all: zar.exe

zar.exe: $O/main.obj $O/debug.obj $O/options.obj $O/io.obj
	$(CC) $(CFLAGS) /Fe$@ $**

{$S}.c{$O}.obj::
	$(CC) $(CFLAGS) /Fo$(O)\ /c $<

Add zlib to MSVC build.

LINK = link /NOLOGO
CC = cl /nologo
CFLAGS = /W4 /MD /GR /EHsc /D_CRT_SECURE_NO_WARNINGS /I.\\zlib\\
LIBS = zlib.lib
O = .\obj
S = .\src

all: zar.exe

zar.exe: $O/main.obj $O/debug.obj $O/options.obj $O/io.obj
	$(CC) $(CFLAGS) /Fe$@ $** $O\zlib.lib

{$S}.c{$O}.obj::
	$(CC) $(CFLAGS) /Fo$(O)\ /c $<


##### Options which a user might set before building go here #####

# Where to install idris2 binaries and libraries (must not be a relative path)
PREFIX ?= $(HOME)/.idris2

# For Windows targets. Set to 1 to support Windows 7.
OLD_WIN ?= 0

##################################################################

RANLIB ?= ranlib
AR ?= ar

CFLAGS := -Wall $(CFLAGS)
LDFLAGS := $(LDFLAGS)

MACHINE := $(shell $(CC) -dumpmachine)
ifneq (,$(findstring cygwin, $(MACHINE)))
	OS := windows
	SHLIB_SUFFIX := .dll
else ifneq (,$(findstring mingw, $(MACHINE)))
	OS := windows
	SHLIB_SUFFIX := .dll
else ifneq (,$(findstring windows, $(MACHINE)))
	OS := windows
	SHLIB_SUFFIX := .dll
else ifneq (,$(findstring darwin, $(MACHINE)))
	OS := darwin
	SHLIB_SUFFIX := .dylib
	CFLAGS += -fPIC
else ifneq (, $(findstring bsd, $(MACHINE)))
	OS := bsd
	SHLIB_SUFFIX := .so
	CFLAGS += -fPIC
else
	OS := linux
	SHLIB_SUFFIX := .so
	CFLAGS += -fPIC
endif
export OS

ifeq ($(OS),bsd)
	MAKE := gmake
else
	MAKE := make
endif
export MAKE

# Add a custom.mk file to override any of the configurations
-include custom.mk

Stop pointing at the Void

##### Options which a user might set before building go here #####

# Where to install idris2 binaries and libraries (must be an absolute path)
PREFIX ?= $(HOME)/.idris2

# For Windows targets. Set to 1 to support Windows 7.
OLD_WIN ?= 0

##################################################################

RANLIB ?= ranlib
AR ?= ar

CFLAGS := -Wall $(CFLAGS)
LDFLAGS := $(LDFLAGS)

MACHINE := $(shell $(CC) -dumpmachine)
ifneq (,$(findstring cygwin, $(MACHINE)))
	OS := windows
	SHLIB_SUFFIX := .dll
else ifneq (,$(findstring mingw, $(MACHINE)))
	OS := windows
	SHLIB_SUFFIX := .dll
else ifneq (,$(findstring windows, $(MACHINE)))
	OS := windows
	SHLIB_SUFFIX := .dll
else ifneq (,$(findstring darwin, $(MACHINE)))
	OS := darwin
	SHLIB_SUFFIX := .dylib
	CFLAGS += -fPIC
else ifneq (, $(findstring bsd, $(MACHINE)))
	OS := bsd
	SHLIB_SUFFIX := .so
	CFLAGS += -fPIC
else
	OS := linux
	SHLIB_SUFFIX := .so
	CFLAGS += -fPIC
endif
export OS

ifeq ($(OS),bsd)
	MAKE := gmake
else
	MAKE := make
endif
export MAKE

# Add a custom.mk file to override any of the configurations
-include custom.mk


PACKAGES := $(shell find ./ -mindepth 1 -name Makefile -type f -printf "%h\n")

Use git-ls-tree to get real package names

ifneq ($(shell git rev-parse HEAD),)
PACKAGES := $(shell git ls-tree -r --name-only $$(git rev-parse HEAD) | grep "\/Makefile$$" | sed 's/\/Makefile$$//')
else
PACKAGES := $(shell find ./ -mindepth 1 -name Makefile -type f -printf "%h\n")
endif


# IBM_PROLOG_BEGIN_TAG
# This is an automatically generated prolog.
#
# $Source: src/import/chips/p9/procedures/hwp/initfiles/p9_nx_scom.mk $
#
# OpenPOWER HostBoot Project
#
# Contributors Listed Below - COPYRIGHT 2016,2019
# [+] International Business Machines Corp.
#
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied. See the License for the specific language governing
# permissions and limitations under the License.
#
# IBM_PROLOG_END_TAG
PROCEDURE=p9_nx_scom
$(call BUILD_PROCEDURE)

Add no variable tracking to initfile procedures to imporve build time

# IBM_PROLOG_BEGIN_TAG
# This is an automatically generated prolog.
#
# $Source: src/import/chips/p9/procedures/hwp/initfiles/p9_nx_scom.mk $
#
# OpenPOWER HostBoot Project
#
# Contributors Listed Below - COPYRIGHT 2016,2019
# [+] International Business Machines Corp.
#
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied. See the License for the specific language governing
# permissions and limitations under the License.
#
# IBM_PROLOG_END_TAG
PROCEDURE=p9_nx_scom
lib$(PROCEDURE)_COMMONFLAGS+=-fno-var-tracking-assignments
$(call BUILD_PROCEDURE)


# Preparation: create foo.c
test1:
	touch foo.c

# foo.o should match the pattern rule below.
test2: foo.o

%.o: %.c
	echo FAIL

%o: %c
	echo FAIL

# The last one should be used.
%.o: %.c
	echo PASS

Comment out a test case which does not pass on make 3.81

# Preparation: create foo.c
test1:
	touch foo.c

# foo.o should match the pattern rule below.
test2: foo.o

%.o: %.c
	echo FAIL

# This passes with GNU make 4.0 but fails with 3.81.
#%o: %c
#	echo FAIL2

# The last one should be used.
%.o: %.c
	echo PASS


# This is a generic product that isn't specialized for a specific device.
# It includes the base Android platform.

PRODUCT_PACKAGES := \
    AccountAndSyncSettings \
    AlarmClock \
    AlarmProvider \
    Bluetooth \
    Calculator \
    Calendar \
    Camera \
    CertInstaller \
    DrmProvider \
    Email \
    Gallery \
    LatinIME \
    Mms \
    Music \
    Provision \
    QuickSearchBox \
    Settings \
    Sync \
    Updater \
    CalendarProvider \
    SyncProvider

$(call inherit-product, $(SRC_TARGET_DIR)/product/core.mk)

# Overrides
PRODUCT_BRAND := generic
PRODUCT_DEVICE := generic
PRODUCT_NAME := generic

Remove Gallery (not 3d) from all builds on master

# This is a generic product that isn't specialized for a specific device.
# It includes the base Android platform.

PRODUCT_PACKAGES := \
    AccountAndSyncSettings \
    AlarmClock \
    AlarmProvider \
    Bluetooth \
    Calculator \
    Calendar \
    Camera \
    CertInstaller \
    DrmProvider \
    Email \
    LatinIME \
    Mms \
    Music \
    Provision \
    QuickSearchBox \
    Settings \
    Sync \
    Updater \
    CalendarProvider \
    SyncProvider

$(call inherit-product, $(SRC_TARGET_DIR)/product/core.mk)

# Overrides
PRODUCT_BRAND := generic
PRODUCT_DEVICE := generic
PRODUCT_NAME := generic


#
# Copyright (C) 2012 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

# Don't build the library in unbundled branches.
ifeq (,$(TARGET_BUILD_APPS))

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

LOCAL_MODULE := android.support.v8.renderscript
#LOCAL_SDK_VERSION := 17
LOCAL_SRC_FILES := $(call all-java-files-under, java/src)

include $(BUILD_STATIC_JAVA_LIBRARY)

# Include this library in the build server's output directory
# TODO: Not yet.
#$(call dist-for-goals, dist_files, $(LOCAL_BUILT_MODULE):volley.jar)

# TODO: Build the tests as an APK here

include $(call all-makefiles-under, $(LOCAL_PATH))

endif

Revert "Don't build the RS compatibility library in unbundled branches."

#
# Copyright (C) 2012 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

LOCAL_MODULE := android.support.v8.renderscript
#LOCAL_SDK_VERSION := 17
LOCAL_SRC_FILES := $(call all-java-files-under, java/src)

include $(BUILD_STATIC_JAVA_LIBRARY)

# Include this library in the build server's output directory
# TODO: Not yet.
#$(call dist-for-goals, dist_files, $(LOCAL_BUILT_MODULE):volley.jar)

# TODO: Build the tests as an APK here

include $(call all-makefiles-under, $(LOCAL_PATH))


# Adafruit
USB_VID = 0x239A
# Allocated for Winterbloom Sol
# https://github.com/adafruit/circuitpython/issues/2217
USB_PID = 0x8062
USB_PRODUCT = "Sol"
USB_MANUFACTURER = "Winterbloom"
USB_INTERFACE_NAME = "Sol"

CHIP_VARIANT = SAMD51J20A
CHIP_FAMILY = samd51

QSPI_FLASH_FILESYSTEM = 1
EXTERNAL_FLASH_DEVICE_COUNT = 1
EXTERNAL_FLASH_DEVICES = W25Q32JV_IQ
LONGINT_IMPL = MPZ

# Disable modules that are unusable on this special-purpose board.
CIRCUITPY_AUDIOBUSIO = 0
CIRCUITPY_AUDIOIO = 0
CIRCUITPY_BLEIO = 0
CIRCUITPY_DISPLAYIO = 0
CIRCUITPY_GAMEPAD = 0
CIRCUITPY_I2CSLAVE = 0
CIRCUITPY_NETWORK = 0
CIRCUITPY_TOUCHIO = 0
CIRCUITPY_PS2IO = 0

# Enable micropython.native
CIRCUITPY_ENABLE_MPY_NATIVE = 1

Disable the HID USB descriptor for Sol

# Adafruit
USB_VID = 0x239A
# Allocated for Winterbloom Sol
# https://github.com/adafruit/circuitpython/issues/2217
USB_PID = 0x8062
USB_PRODUCT = "Sol"
USB_MANUFACTURER = "Winterbloom"
USB_INTERFACE_NAME = "Sol"
USB_DEVICES = "CDC,MSC,AUDIO"

CHIP_VARIANT = SAMD51J20A
CHIP_FAMILY = samd51

QSPI_FLASH_FILESYSTEM = 1
EXTERNAL_FLASH_DEVICE_COUNT = 1
EXTERNAL_FLASH_DEVICES = W25Q32JV_IQ
LONGINT_IMPL = MPZ

# Disable modules that are unusable on this special-purpose board.
CIRCUITPY_AUDIOBUSIO = 0
CIRCUITPY_AUDIOIO = 0
CIRCUITPY_BLEIO = 0
CIRCUITPY_DISPLAYIO = 0
CIRCUITPY_GAMEPAD = 0
CIRCUITPY_I2CSLAVE = 0
CIRCUITPY_NETWORK = 0
CIRCUITPY_TOUCHIO = 0
CIRCUITPY_PS2IO = 0
CIRCUITPY_USB_HID = 0

# Enable micropython.native
CIRCUITPY_ENABLE_MPY_NATIVE = 1


# SPDX-License-Identifier: SPDX-License-Identifier: LGPL-2.1-or-later
#
# workarounds.mk - workarounds for weird stuff behavior

LD_FLAVOR := $(shell $(LD) --version | grep -E '^(LLD|GNU ld)'|sed 's/ .*//g')
LD_VERSION := $(shell $(LD) --version | grep -E '^(LLD|GNU ld)'|sed 's/.* //')
# I haven't tested 2.36 here; 2.35 is definitely broken and 2.37 seems to work
LD_DASH_T := $(shell \
	if [ "x${LD_FLAVOR}" == xLLD ] ; then \
		echo '-T' ; \
	elif [ "x${LD_FLAVOR}" == xGNU ] ; then \
		if echo "${LD_VERSION}" | grep -q -E '^2\.3[789]|^2\.[456789]|^[3456789]|^[[:digit:]][[:digit:]]' ; then \
			echo '-T' ; \
		else \
			echo "" ; \
		fi ; \
	else \
		echo "Your linker is not supported" ; \
		exit 1 ; \
	fi)

export LD_DASH_T

# vim:ft=make

Fix linker string comparison for dash

# SPDX-License-Identifier: SPDX-License-Identifier: LGPL-2.1-or-later
#
# workarounds.mk - workarounds for weird stuff behavior

LD_FLAVOR := $(shell $(LD) --version | grep -E '^(LLD|GNU ld)'|sed 's/ .*//g')
LD_VERSION := $(shell $(LD) --version | grep -E '^(LLD|GNU ld)'|sed 's/.* //')
# I haven't tested 2.36 here; 2.35 is definitely broken and 2.37 seems to work
LD_DASH_T := $(shell \
	if [ "x${LD_FLAVOR}" = xLLD ] ; then \
		echo '-T' ; \
	elif [ "x${LD_FLAVOR}" = xGNU ] ; then \
		if echo "${LD_VERSION}" | grep -q -E '^2\.3[789]|^2\.[456789]|^[3456789]|^[[:digit:]][[:digit:]]' ; then \
			echo '-T' ; \
		else \
			echo "" ; \
		fi ; \
	else \
		echo "Your linker is not supported" ; \
		exit 1 ; \
	fi)

export LD_DASH_T

# vim:ft=make


LOCAL_PATH := $(call my-dir)

LIBOGG_TOP := $(LOCAL_PATH)

include $(CLEAR_VARS)

include $(LIBOGG_TOP)/src/Android.mk

Build libogg only if BUILD_WITH_GST option provided.

ifeq ($(strip $(BUILD_WITH_GST)),true)

LOCAL_PATH := $(call my-dir)

LIBOGG_TOP := $(LOCAL_PATH)

include $(CLEAR_VARS)

include $(LIBOGG_TOP)/src/Android.mk

endif


LOCAL_PATH := $(call my-dir)

# Not with bionic
ifneq ("$(TARGET_LIBC)","bionic")

include $(CLEAR_VARS)

LOCAL_MODULE := libNetwork
LOCAL_DESCRIPTION := ARSDK Network Control Library

LOCAL_LIBRARIES := libARSAL
LOCAL_EXPORT_LDLIBS := -lnetwork

#Autotools variables
LOCAL_AUTOTOOLS_CONFIGURE_ARGS := --with-libARSALInstallDir=""

# User define command to be launch before configure step.
# Generates files used by configure
define LOCAL_AUTOTOOLS_CMD_POST_UNPACK
	$(Q) cd $(PRIVATE_SRC_DIR) && ./bootstrap
endef

# User define command to be launch after dirclean
# Remove every files generated by bootstrap
define LOCAL_AUTOTOOLS_CMD_POST_DIRCLEAN
	$(Q) cd $(PRIVATE_SRC_DIR) && ./cleanup
endef

include $(BUILD_AUTOTOOLS)

endif

Add logical path, rename lib

LOCAL_PATH := $(call my-dir)

# Not with bionic
ifneq ("$(TARGET_LIBC)","bionic")

include $(CLEAR_VARS)

LOCAL_CATEGORY_PATH := mykonos3/libs
LOCAL_MODULE := libARNetwork
LOCAL_DESCRIPTION := ARSDK Network Control Library

LOCAL_LIBRARIES := libARSAL
LOCAL_EXPORT_LDLIBS := -larnetwork

#Autotools variables
LOCAL_AUTOTOOLS_CONFIGURE_ARGS := --with-libARSALInstallDir=""

# User define command to be launch before configure step.
# Generates files used by configure
define LOCAL_AUTOTOOLS_CMD_POST_UNPACK
	$(Q) cd $(PRIVATE_SRC_DIR) && ./bootstrap
endef

# User define command to be launch after dirclean
# Remove every files generated by bootstrap
define LOCAL_AUTOTOOLS_CMD_POST_DIRCLEAN
	$(Q) cd $(PRIVATE_SRC_DIR) && ./cleanup
endef

include $(BUILD_AUTOTOOLS)

endif


LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

LOCAL_MODULE := yogacore

LOCAL_SRC_FILES := \
  yoga/Yoga.c \
  yoga/YGNodeList.c

LOCAL_C_INCLUDES := $(LOCAL_PATH)
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_C_INCLUDES)

LOCAL_CFLAGS := -Wall -Werror -fexceptions -frtti -std=c99 -O3

include $(BUILD_STATIC_LIBRARY)

Add YGEnums to fix gradle build

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

LOCAL_MODULE := yogacore

LOCAL_SRC_FILES := \
  yoga/Yoga.c \
  yoga/YGEnums.c \
  yoga/YGNodeList.c

LOCAL_C_INCLUDES := $(LOCAL_PATH)
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_C_INCLUDES)

LOCAL_CFLAGS := -Wall -Werror -fexceptions -frtti -std=c99 -O3

include $(BUILD_STATIC_LIBRARY)


# TARGETS #

# Run Python benchmarks.
#
# This target runs a list of Python benchmarks in sequential order. Note that we assume the benchmarks can be run using Python.

benchmark-python:
	$(QUIET) $(FIND_PYTHON_BENCHMARKS_CMD) | grep '^[\/]\|^[a-zA-Z]:[/\]' | while read -r file; do \
		echo ""; \
		echo "Running benchmark: $$file"; \
		$(PYTHON) $$file || exit 1; \
	done

.PHONY: benchmark-python

# Run Python benchmarks.
#
# This target runs a specified list of Python benchmarks in sequential order. Note that we assume the benchmarks can be run using Python.

benchmark-python-files:
	$(QUIET) for file in $(FILES); do \
		echo ""; \
		echo "Running benchmark: $$file"; \
		$(PYTHON) $$file || exit 1; \
	done

.PHONY: benchmark-python-files

Reformat comments based on JSDoc

# TARGETS #

#/
# Runs Python benchmarks consecutively.
#
# ## Notes
#
# -   This recipe assumes that benchmark files can be run via Python.
# -   This recipe is useful when wanting to glob for Python benchmark files (e.g., run all Python benchmarks for a particular package).
#
#
# @param {string} [BENCHMARKS_FILTER] - filepath pattern (e.g., `.*/math/base/special/digamma/.*`)
#
# @example
# make benchmark-python
#
# @example
# make benchmark-python BENCHMARKS_FILTER=.*/math/base/special/digamma/.*
#/
benchmark-python:
	$(QUIET) $(FIND_PYTHON_BENCHMARKS_CMD) | grep '^[\/]\|^[a-zA-Z]:[/\]' | while read -r file; do \
		echo ""; \
		echo "Running benchmark: $$file"; \
		$(PYTHON) $$file || exit 1; \
	done

.PHONY: benchmark-python

#/
# Runs a specified list of Python benchmarks consecutively.
#
# ## Notes
#
# -   This recipe assumes that benchmark files can be run via Python.
# -   This recipe is useful when wanting to run a list of Python benchmark files generated by some other command (e.g., a list of changed Python benchmark files obtained via `git diff`).
#
#
# @param {string} FILES - list of Python benchmark file paths
#
# @example
# make benchmark-python-files FILES='/foo/benchmark.py /bar/benchmark.py'
#/
benchmark-python-files:
	$(QUIET) for file in $(FILES); do \
		echo ""; \
		echo "Running benchmark: $$file"; \
		$(PYTHON) $$file || exit 1; \
	done

.PHONY: benchmark-python-files


# IBM_PROLOG_BEGIN_TAG
# This is an automatically generated prolog.
#
# $Source: src/import/chips/p9/procedures/hwp/ffdc/p9_collect_lpc_regs.mk $
#
# OpenPOWER HostBoot Project
#
# Contributors Listed Below - COPYRIGHT 2018,2019
# [+] International Business Machines Corp.
#
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied. See the License for the specific language governing
# permissions and limitations under the License.
#
# IBM_PROLOG_END_TAG

Add final check for errors

# IBM_PROLOG_BEGIN_TAG
# This is an automatically generated prolog.
#
# $Source: src/import/chips/p9/procedures/hwp/ffdc/p9_collect_lpc_regs.mk $
#
# OpenPOWER HostBoot Project
#
# Contributors Listed Below - COPYRIGHT 2018,2019
# [+] International Business Machines Corp.
#
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied. See the License for the specific language governing
# permissions and limitations under the License.
#
# IBM_PROLOG_END_TAG
PROCEDURE=p9_collect_lpc_regs
$(call BUILD_PROCEDURE)


# IBM_PROLOG_BEGIN_TAG
# This is an automatically generated prolog.
#
# $Source: src/import/chips/p9/procedures/hwp/initfiles/p9_fbc_no_hp_scom.mk $
#
# OpenPOWER HostBoot Project
#
# Contributors Listed Below - COPYRIGHT 2016,2019
# [+] International Business Machines Corp.
#
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied. See the License for the specific language governing
# permissions and limitations under the License.
#
# IBM_PROLOG_END_TAG
PROCEDURE=p9_fbc_no_hp_scom
$(call BUILD_PROCEDURE)

Add no variable tracking to initfile procedures to imporve build time

# IBM_PROLOG_BEGIN_TAG
# This is an automatically generated prolog.
#
# $Source: src/import/chips/p9/procedures/hwp/initfiles/p9_fbc_no_hp_scom.mk $
#
# OpenPOWER HostBoot Project
#
# Contributors Listed Below - COPYRIGHT 2016,2019
# [+] International Business Machines Corp.
#
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied. See the License for the specific language governing
# permissions and limitations under the License.
#
# IBM_PROLOG_END_TAG
PROCEDURE=p9_fbc_no_hp_scom
lib$(PROCEDURE)_COMMONFLAGS+=-fno-var-tracking-assignments
$(call BUILD_PROCEDURE)


generalclean:
	rm -rf *~* *.o *.a *.so *.so.* a.out *.po *.s *.d *.pyc
	rm -rf core core.* .depend cscope.* *.orig *.rej
	rm -rf linux .*.o.cmd .*.ko.cmd *.mod.c .tmp_versions Module.symvers Module.markers .*.o.d modules.order
	rm -rf ${TARGET} ${TARGETS} ${TARGET}_test
	rm -rf ${TARGET1} ${TARGET2} ${TARGET3} ${TARGET4} ${TARGET5} ${TARGET6}

Clean extra kernel modules files

generalclean:
	rm -rf *~* *.o *.a *.so *.so.* a.out *.po *.s *.d *.pyc
	rm -rf core core.* .depend cscope.* *.orig *.rej
	rm -rf linux .*.o.cmd .*.ko.cmd *.mod.c .tmp_versions
	rm -rf Module.symvers Module.markers .*.o.d modules.order
	rm -rf ${TARGET} ${TARGETS} ${TARGET}_test
	rm -rf ${TARGET1} ${TARGET2} ${TARGET3} ${TARGET4} ${TARGET5} ${TARGET6}


ifneq ($(shell $(SHELL) $(.SHELLFLAGS) "command -v $(host)-g++-posix"),)
mingw32_CXX := $(host)-g++-posix
endif

mingw32_CFLAGS=-pipe
mingw32_CXXFLAGS=$(mingw32_CFLAGS)

mingw32_release_CFLAGS=-O2
mingw32_release_CXXFLAGS=$(mingw32_release_CFLAGS)

mingw32_debug_CFLAGS=-O1
mingw32_debug_CXXFLAGS=$(mingw32_debug_CFLAGS)

mingw32_debug_CPPFLAGS=-D_GLIBCXX_DEBUG -D_GLIBCXX_DEBUG_PEDANTIC

mingw_cmake_system=Windows

Fix configuring depends with cmake

ifneq ($(shell $(SHELL) $(.SHELLFLAGS) "command -v $(host)-g++-posix"),)
mingw32_CXX := $(host)-g++-posix
endif

mingw32_CFLAGS=-pipe
mingw32_CXXFLAGS=$(mingw32_CFLAGS)

mingw32_release_CFLAGS=-O2
mingw32_release_CXXFLAGS=$(mingw32_release_CFLAGS)

mingw32_debug_CFLAGS=-O1
mingw32_debug_CXXFLAGS=$(mingw32_debug_CFLAGS)

mingw32_debug_CPPFLAGS=-D_GLIBCXX_DEBUG -D_GLIBCXX_DEBUG_PEDANTIC

mingw32_cmake_system=Windows


CROSS_PREFIX	?= arm-linux-gnueabi
CROSS_COMPILE	?= $(CROSS_PREFIX)-

ARCH_DIR		= arch/$(ARCH)

PLATFORM_CPUARCH	= cortex-a15
PLATFORM_CFLAGS	 	= -mcpu=$(PLATFORM_CPUARCH) -mthumb -fno-short-enums
PLATFORM_SFLAGS	 	= -mcpu=$(PLATFORM_CPUARCH)
PLATFORM_CPPFLAGS	= -I$(ARCH_DIR)/include -DNUM_CPUS=1 -DNUM_THREADS=2

DEBUG		?= 1
ifeq ($(DEBUG),1)
PLATFORM_CFLAGS += -O0 -g
else
PLATFORM_CFLAGS += -Os
endif

SUBDIRS += $(addprefix $(ARCH_DIR)/, kern libc sm tee)

Add -g3 compiler option for debug

CROSS_PREFIX	?= arm-linux-gnueabi
CROSS_COMPILE	?= $(CROSS_PREFIX)-

ARCH_DIR		= arch/$(ARCH)

PLATFORM_CPUARCH	= cortex-a15
PLATFORM_CFLAGS	 	= -mcpu=$(PLATFORM_CPUARCH) -mthumb -fno-short-enums
PLATFORM_SFLAGS	 	= -mcpu=$(PLATFORM_CPUARCH)
PLATFORM_CPPFLAGS	= -I$(ARCH_DIR)/include -DNUM_CPUS=1 -DNUM_THREADS=2

DEBUG		?= 1
ifeq ($(DEBUG),1)
PLATFORM_CFLAGS += -O0 -g -g3
PLATFORM_SFLAGS += -g -g3
else
PLATFORM_CFLAGS += -Os
endif

SUBDIRS += $(addprefix $(ARCH_DIR)/, kern libc sm tee)


AR := ar
BISON := bison
CC := clang
FLEX := flex
LD := clang

CFLAGS := -Wall -Wextra -Wno-unused-parameter -O0 -ggdb -std=c89 -I c -I $(SRC)/c

%.o: %.c
	$(CC) -MMD -o $@ -c $(CFLAGS) $<

%.c: %.b bc1
	./bc1 $< >$@

%.tab.c: %.y
	$(BISON) -o $@ -d -v $<

%.yy.c: %.l
	$(FLEX) -o $@ $<

Delete .c file on bc1 failure.

AR := ar
BISON := bison
CC := clang
FLEX := flex
LD := clang

CFLAGS := -Wall -Wextra -Wno-unused-parameter -O0 -ggdb -std=c89 -I c -I $(SRC)/c

%.o: %.c
	$(CC) -MMD -o $@ -c $(CFLAGS) $<

%.c: %.b bc1
	./bc1 $< >$@ || \
	(rm -f $@; exit 1)

%.tab.c: %.y
	$(BISON) -o $@ -d -v $<

%.yy.c: %.l
	$(FLEX) -o $@ $<


# IBM_PROLOG_BEGIN_TAG
# This is an automatically generated prolog.
#
# $Source: src/import/chips/p9/procedures/hwp/memory/p9_mss_draminit_training.mk $
#
# OpenPOWER HostBoot Project
#
# Contributors Listed Below - COPYRIGHT 2015,2019
# [+] International Business Machines Corp.
#
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied. See the License for the specific language governing
# permissions and limitations under the License.
#
# IBM_PROLOG_END_TAG

# Include the macros and things for MSS procedures
-include 00common.mk

PROCEDURE=p9_mss_draminit_training
$(eval $(call ADD_MEMORY_INCDIRS,$(PROCEDURE)))
lib$(PROCEDURE)_DEPLIBS+=mss
$(call BUILD_PROCEDURE)

Change mss build to account for double free in wrappers

# IBM_PROLOG_BEGIN_TAG
# This is an automatically generated prolog.
#
# $Source: src/import/chips/p9/procedures/hwp/memory/p9_mss_draminit_training.mk $
#
# OpenPOWER HostBoot Project
#
# Contributors Listed Below - COPYRIGHT 2015,2019
# [+] International Business Machines Corp.
#
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied. See the License for the specific language governing
# permissions and limitations under the License.
#
# IBM_PROLOG_END_TAG

# Include the macros and things for MSS procedures
-include 00common.mk

PROCEDURE=p9_mss_draminit_training
$(eval $(call ADD_MEMORY_INCDIRS,$(PROCEDURE)))
$(call BUILD_PROCEDURE)


USB_VID = 0x0483
USB_PID = 0x5740
USB_PRODUCT = "SparkFun Thing Plus - STM32"
USB_MANUFACTURER = "SparkFun Electronics"

SPI_FLASH_FILESYSTEM = 1
EXTERNAL_FLASH_DEVICES = W25Q128JVxM

MCU_SERIES = F4
MCU_VARIANT = STM32F405xx
MCU_PACKAGE = LQFP64

LD_COMMON = boards/common_default.ld
LD_DEFAULT = boards/STM32F405_default.ld

# UF2 boot option
LD_BOOT = boards/STM32F405_boot.ld
UF2_OFFSET = 0x8010000

CIRCUITPY_RGBMATRIX ?= 1

Use same USB PID as the MicroMod STM32

USB_VID = 0X1B4F

# TODO: Replace the Product ID below with the official value once known.
USB_PID = 0x0027  # Same PID as the SparkFun MicroMod STM32

USB_PRODUCT = "SparkFun Thing Plus - STM32"
USB_MANUFACTURER = "SparkFun Electronics"

SPI_FLASH_FILESYSTEM = 1
EXTERNAL_FLASH_DEVICES = W25Q128JVxM

MCU_SERIES = F4
MCU_VARIANT = STM32F405xx
MCU_PACKAGE = LQFP64

LD_COMMON = boards/common_default.ld
LD_DEFAULT = boards/STM32F405_default.ld

# UF2 boot option
LD_BOOT = boards/STM32F405_boot.ld
UF2_OFFSET = 0x8010000

CIRCUITPY_RGBMATRIX ?= 1


LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)

# This will build the client static library for the Google Services Framework
LOCAL_MODULE := oauth

# Includes all the java files, and explicitly declares any aidl files
LOCAL_SRC_FILES := \
   $(call all-java-files-under, net)

LOCAL_SDK_VERSION := current

# Build the actual static library
include $(BUILD_STATIC_JAVA_LIBRARY)

Switch platform to 8, to allow unbundling/backporting of GoogleAuthenticator

LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)

# This will build the client static library for the Google Services Framework
LOCAL_MODULE := oauth

# Includes all the java files, and explicitly declares any aidl files
LOCAL_SRC_FILES := \
   $(call all-java-files-under, net)

LOCAL_SDK_VERSION := 8

# Build the actual static library
include $(BUILD_STATIC_JAVA_LIBRARY)


# Copyright (c) 2008 Roy Marples <roy@marples.name>
# Released under the 2-clause BSD license.

SFX=		.Linux.in
PKG_PREFIX?=	/usr

CPPFLAGS+=	-D_BSD_SOURCE -D_XOPEN_SOURCE=700
LIBDL=		-Wl,-Bdynamic -ldl

Add SELinux support to the build system

# Copyright (c) 2008 Roy Marples <roy@marples.name>
# Released under the 2-clause BSD license.

SFX=		.Linux.in
PKG_PREFIX?=	/usr

CPPFLAGS+=	-D_BSD_SOURCE -D_XOPEN_SOURCE=700
LIBDL=		-Wl,-Bdynamic -ldl

ifeq (${MKSELINUX},yes)
CPPFLAGS+= -DHAVE_SELINUX
LIBSELINUX= -lselinux
LDADD += $(LIBSELINUX)
endif


packages:=boost openssl curl zlib bzip2 libzip
native_packages := native_ccache

qt_packages = qrencode

ifeq ($(QT_59),1)
qt_linux_packages:=qt59 expat dbus libxcb xcb_proto libXau xproto freetype fontconfig libX11 xextproto libXext xtrans
qt_darwin_packages=qt59
qt_mingw32_packages=qt59
else
qt_linux_packages:=qt expat dbus libxcb xcb_proto libXau xproto freetype fontconfig libX11 xextproto libXext xtrans
qt_darwin_packages=qt
qt_mingw32_packages=qt
endif

ifeq ($(BDB_53),1)
wallet_packages=bdb53
else
wallet_packages=bdb
endif

upnp_packages=miniupnpc

darwin_native_packages = native_biplist native_ds_store native_mac_alias

ifneq ($(build_os),darwin)
darwin_native_packages += native_cctools native_cdrkit native_libdmg-hfsplus
endif

Remove 5.7.1 support and default for qt59 for now

packages:=boost openssl curl zlib bzip2 libzip
native_packages := native_ccache

qt_packages = qrencode

qt_linux_packages:=qt59 expat dbus libxcb xcb_proto libXau xproto freetype fontconfig libX11 xextproto libXext xtrans
qt_darwin_packages=qt59
qt_mingw32_packages=qt59

ifeq ($(BDB_53),1)
wallet_packages=bdb53
else
wallet_packages=bdb
endif

upnp_packages=miniupnpc

darwin_native_packages = native_biplist native_ds_store native_mac_alias

ifneq ($(build_os),darwin)
darwin_native_packages += native_cctools native_cdrkit native_libdmg-hfsplus
endif


#
# Copyright (C) 2012 The CyanogenMod Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

PRODUCT_MAKEFILES := \
    $(LOCAL_DIR)/omni_n7000.mk

Fix wrong change of omni

#
# Copyright (C) 2012 The CyanogenMod Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

PRODUCT_MAKEFILES := \
    $(LOCAL_DIR)/full_n7000.mk


# Yes, this is not by the book, but it is so cooler.
dist_urbi_DATA := $(call ls_files,share/urbi/*.u)

package_info_u = share/urbi/package-info.u
nodist_urbi_DATA = $(package_info_u)
REVISION_FLAGS = --urbi
REVISION_FILE = $(package_info_u)
include $(top_srcdir)/build-aux/revision.mk

$(srcdir)/share/urbi/tutorial-content.u: share/urbi/tutorial/tutorial.xml share/urbi/tutorial/tutorial.py
	rm -f $@ $@.tmp
	$(srcdir)/share/urbi/tutorial/tutorial.py $< > $@.tmp
	mv $@.tmp $@

Fix typo in package-info.u generation.

# Yes, this is not by the book, but it is so cooler.
dist_urbi_DATA := $(call ls_files,share/urbi/*.u)

package_info_u = share/urbi/package-info.u
nodist_urbi_DATA = $(package_info_u)
REVISIONFLAGS = --urbi
REVISION_FILE = $(package_info_u)
include $(top_srcdir)/build-aux/revision.mk

$(srcdir)/share/urbi/tutorial-content.u: share/urbi/tutorial/tutorial.xml share/urbi/tutorial/tutorial.py
	rm -f $@ $@.tmp
	$(srcdir)/share/urbi/tutorial/tutorial.py $< > $@.tmp
	mv $@.tmp $@


LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)

LOCAL_MODULE_TAGS := samples tests

LOCAL_SRC_FILES := $(call all-java-files-under, src)

LOCAL_PACKAGE_NAME := SupportAppNavigation

LOCAL_STATIC_JAVA_LIBRARIES += android-support-v4

LOCAL_SDK_VERSION := current

include $(BUILD_PACKAGE)

LOCAL_PROGUARD_FLAG_FILES := proguard.flags

# Use the following include to make our test apk.
include $(call all-makefiles-under,$(LOCAL_PATH))

Fix up the makefiles and some samples.

LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)

LOCAL_MODULE_TAGS := samples tests

LOCAL_SRC_FILES := $(call all-java-files-under, src)

LOCAL_PACKAGE_NAME := SupportAppNavigation

LOCAL_STATIC_JAVA_LIBRARIES += android-support-v4

LOCAL_SDK_VERSION := current

LOCAL_DEX_PREOPT := false

include $(BUILD_PACKAGE)

LOCAL_PROGUARD_FLAG_FILES := proguard.flags

# Use the following include to make our test apk.
include $(call all-makefiles-under,$(LOCAL_PATH))


# License and copyright goes here

# This file contains the Mac OS X specific macros
#
# This is included by platform.mk

CFLAGS += -fPIC
#CFLAGS += -D__APPLE__    # the compiler already does this for us
#CFLAGS += -arch i386 -arch x86_64 -mmacosx-version-min=10.5

ifdef DEBUG
CFLAGS += -g -W
else
CFLAGS += -O3 -funroll-loops
#helpful? -funroll-loops -fomit-frame-pointer
#unhelpful? -march=pentium4 -ffast-math -msse -mfpmath=sse -msse2
endif

ifdef PROFILE
# On OS X, use "Shark", not gprof, so don't bother with -pg
#CFLAGS += -pg
#LDFLAGS += -pg
CFLAGS += -g
STRIP_BINARY := touch
endif

# ? -fno-common

#LDFLAGS += -arch x86_64
SHLIBEXT := .dylib
SHLIB_LDFLAGS := -dynamiclib
#SHLIB_LDFLAGS += -arch x86_64
# -m64

QT_INCLUDE += -I/Library/Frameworks/QtGui.framework/Headers
QT_INCLUDE += -I/Library/Frameworks/QtOpenGL.framework/Headers
#QT_INCLUDE := -FQtGui.framework
#QT_INCLUDE += -FQtOpenGL.framework
LINK_QT += /Library/Frameworks/QtGui.framework/QtGui
LINK_QT += /Library/Frameworks/QtOpenGL.framework/QtOpenGL
LINK_QT += /Library/Frameworks/QtCore.framework/QtCore

OPENGL_INCLUDE :=
LINK_OPENGL := -L/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/ -lGL

Use the -framework line properly when linking.

# License and copyright goes here

# This file contains the Mac OS X specific macros
#
# This is included by platform.mk

CFLAGS += -fPIC
#CFLAGS += -D__APPLE__    # the compiler already does this for us
#CFLAGS += -arch i386 -arch x86_64 -mmacosx-version-min=10.5

ifdef DEBUG
CFLAGS += -g -W
else
CFLAGS += -O3 -funroll-loops
#helpful? -funroll-loops -fomit-frame-pointer
#unhelpful? -march=pentium4 -ffast-math -msse -mfpmath=sse -msse2
endif

ifdef PROFILE
# On OS X, use "Shark", not gprof, so don't bother with -pg
#CFLAGS += -pg
#LDFLAGS += -pg
CFLAGS += -g
STRIP_BINARY := touch
endif

# ? -fno-common

#LDFLAGS += -arch x86_64
SHLIBEXT := .dylib
SHLIB_LDFLAGS := -dynamiclib
#SHLIB_LDFLAGS += -arch x86_64
# -m64

QT_INCLUDE += -I/Library/Frameworks/QtGui.framework/Headers
QT_INCLUDE += -I/Library/Frameworks/QtOpenGL.framework/Headers
LINK_QT += -framework QtGui -framework QtOpenGL -framework QtCore

OPENGL_INCLUDE :=
LINK_OPENGL := -framework OpenGL


SVG = "inkscape"
SVGFLAGS = -z

SVGS = $(wildcard images/*.svg)
ICOS = images/app.ico
SVGPNGS = $(SVGS:.svg=.png)

SHARE += $(SVGPNGS)
FILES += $(SVGPNGS)
CLEAN += $(SVGPNGS)

$(SVGPNGS): %.png: %.svg
	$(SVG) $(SVGFLAGS) -e $@ $<

$(ICOS): %.ico: %.png
	icotool -c -o $@ $<

Add rules to build a 48px version of the app icon.

SVG = "inkscape"
SVGFLAGS = -z

SVGS = $(wildcard images/*.svg)
ICOS = images/app.ico
SVGPNGS = $(SVGS:.svg=.png)
SVGPNGS_48 = $(SVGS:.svg=_48.png)

SHARE += $(SVGPNGS)
FILES += $(SVGPNGS)
CLEAN += $(SVGPNGS)

$(SVGPNGS): %.png: %.svg
	$(SVG) $(SVGFLAGS) -e $@ $<

$(SVGPNGS_48): %_48.png: %.svg
	$(SVG) $(SVGFLAGS) -w 48 -h 48 -e $@ $<

$(ICOS): %.ico: %.png
	icotool -c -o $@ $<


LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

LOCAL_MODULE := libtee

LOCAL_SRC_FILES := \
				src/com_protocol.c \
				src/tee_client_api.c

LOCAL_C_INCLUDES    :=	\
				$(LOCAL_PATH)/include \
				external/zlib

LOCAL_SHARED_LIBRARIES := libc libdl libz

LOCAL_EXPORT_C_INCLUDE_DIRS := \
				$(LOCAL_PATH)/include

LOCAL_CFLAGS := -DANDROID -lz -DOT_LOGGING

ifeq ($(TARGET_ARCH),arm)
LOCAL_LDFLAGS := -Wl,--hash-style=sysv
endif

include $(BUILD_SHARED_LIBRARY)

Move -lz to LOCAL_LDFLAGS to allow build against NDK

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

LOCAL_MODULE := libtee

LOCAL_SRC_FILES := \
				src/com_protocol.c \
				src/tee_client_api.c

LOCAL_C_INCLUDES    :=	\
				$(LOCAL_PATH)/include \
				external/zlib

LOCAL_SHARED_LIBRARIES := libc libdl libz

LOCAL_EXPORT_C_INCLUDE_DIRS := \
				$(LOCAL_PATH)/include

LOCAL_CFLAGS := -DANDROID -DOT_LOGGING

LOCAL_LDLIBS := -lz

ifeq ($(TARGET_ARCH),arm)
LOCAL_LDFLAGS := -Wl,--hash-style=sysv
endif

include $(BUILD_SHARED_LIBRARY)


# The MIT License (MIT)
#
# Copyright (c) 2016 Fred Sundvik
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.

INC += $(SERIAL_DIR)
SRC += $(wildcard $(SERIAL_DIR)/serial_link/protocol/*.c)
SRC += $(wildcard $(SERIAL_DIR)/serial_link/system/*.c)

Fix include dir to use uincir instead of just inc

# The MIT License (MIT)
#
# Copyright (c) 2016 Fred Sundvik
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.

UINCDIR += $(SERIAL_DIR)
SRC += $(wildcard $(SERIAL_DIR)/serial_link/protocol/*.c)
SRC += $(wildcard $(SERIAL_DIR)/serial_link/system/*.c)


###########################################
## A thin wrapper around BUILD_EXECUTABLE
## Common flags for native tests are added.
###########################################

LOCAL_CFLAGS += -DGTEST_OS_LINUX -DGTEST_HAS_STD_STRING
LOCAL_C_INCLUDES += bionic \
                    bionic/libstdc++/include \
                    external/gtest/include \
                    external/stlport/stlport
LOCAL_STATIC_LIBRARIES += libgtest libgtest_main
LOCAL_SHARED_LIBRARIES += libstlport

ifndef LOCAL_MODULE_PATH
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_NATIVE_TESTS)
endif

include $(BUILD_EXECUTABLE)

Add $(LOCAL_MODULE) as part of the installed path.

###########################################
## A thin wrapper around BUILD_EXECUTABLE
## Common flags for native tests are added.
###########################################

LOCAL_CFLAGS += -DGTEST_OS_LINUX -DGTEST_HAS_STD_STRING
LOCAL_C_INCLUDES += bionic \
                    bionic/libstdc++/include \
                    external/gtest/include \
                    external/stlport/stlport
LOCAL_STATIC_LIBRARIES += libgtest libgtest_main
LOCAL_SHARED_LIBRARIES += libstlport

ifndef LOCAL_MODULE_PATH
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_NATIVE_TESTS)/$(LOCAL_MODULE)
endif

include $(BUILD_EXECUTABLE)


# IBM_PROLOG_BEGIN_TAG
# This is an automatically generated prolog.
#
# $Source: src/import/hwpf/fapi2/src/fapi2_utils.mk $
#
# OpenPOWER HostBoot Project
#
# Contributors Listed Below - COPYRIGHT 2016,2019
# [+] International Business Machines Corp.
#
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied. See the License for the specific language governing
# permissions and limitations under the License.
#
# IBM_PROLOG_END_TAG
MODULE=fapi2_utils
$(call ADD_MODULE_INCDIR,$(MODULE),$(FAPI2_PLAT_INCLUDE))
OBJS+=fapi2_utils.o
$(call BUILD_MODULE)

Support HB to Cronus attribute dump/sync

# IBM_PROLOG_BEGIN_TAG
# This is an automatically generated prolog.
#
# $Source: src/import/hwpf/fapi2/src/fapi2_utils.mk $
#
# OpenPOWER HostBoot Project
#
# Contributors Listed Below - COPYRIGHT 2016,2019
# [+] International Business Machines Corp.
#
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied. See the License for the specific language governing
# permissions and limitations under the License.
#
# IBM_PROLOG_END_TAG
MODULE=fapi2_utils
$(call ADD_MODULE_SRCDIR,$(MODULE),$(GENPATH))
$(call ADD_MODULE_INCDIR,$(MODULE),$(FAPI2_PLAT_INCLUDE))
OBJS+=fapi2_utils.o
OBJS+=fapi2_attribute_service.o
$(call BUILD_MODULE)


utils/haddock_USES_CABAL = YES
utils/haddock_PACKAGE = haddock
utils/haddock_CONFIGURE_OPTS = --flag in-ghc-tree
# XXX This is a temporary hack:
utils/haddock_HC_OPTS += -Wwarn -DNEW_GHC_LAYOUT
utils/haddock_dist_SHELL_WRAPPER = YES
utils/haddock_dist_INSTALL_SHELL_WRAPPER = YES
utils/haddock_dist_PROG = haddock$(exeext)

ifneq "$(BINDIST)" "YES"

$(INPLACE_BIN)/$(utils/haddock_dist_PROG): $(INPLACE_LIB)/html

$(INPLACE_LIB)/html:
	"$(RM)" $(RM_OPTS) -r $@
	"$(CP)" -R utils/haddock/html $@

endif

$(eval $(call build-prog,utils/haddock,dist,2))

utils/haddock_dist_MODULES += Paths_haddock

install: install_utils/haddock_html
.PHONY: install_utils/haddock_html
install_utils/haddock_html:
	"$(RM)" $(RM_OPTS) -r $(DESTDIR)$(datadir)/html
	"$(CP)" -R utils/haddock/html $(DESTDIR)$(datadir)/html

BINDIST_EXTRAS += $(addprefix utils/haddock/,html/*)

Remove the -Wwarn hack in the GHC build system

utils/haddock_USES_CABAL = YES
utils/haddock_PACKAGE = haddock
utils/haddock_CONFIGURE_OPTS = --flag in-ghc-tree
utils/haddock_HC_OPTS += -DNEW_GHC_LAYOUT
utils/haddock_dist_SHELL_WRAPPER = YES
utils/haddock_dist_INSTALL_SHELL_WRAPPER = YES
utils/haddock_dist_PROG = haddock$(exeext)

ifneq "$(BINDIST)" "YES"

$(INPLACE_BIN)/$(utils/haddock_dist_PROG): $(INPLACE_LIB)/html

$(INPLACE_LIB)/html:
	"$(RM)" $(RM_OPTS) -r $@
	"$(CP)" -R utils/haddock/html $@

endif

$(eval $(call build-prog,utils/haddock,dist,2))

utils/haddock_dist_MODULES += Paths_haddock

install: install_utils/haddock_html
.PHONY: install_utils/haddock_html
install_utils/haddock_html:
	"$(RM)" $(RM_OPTS) -r $(DESTDIR)$(datadir)/html
	"$(CP)" -R utils/haddock/html $(DESTDIR)$(datadir)/html

BINDIST_EXTRAS += $(addprefix utils/haddock/,html/*)


# $FreeBSD$
#
# This file contains common settings used for building FreeBSD
# sources.

# Enable various levels of compiler warning checks.  These may be
# overridden (e.g. if using a non-gcc compiler) by defining NO_WARNS.

.if !defined(NO_WARNS)
. if defined(WARNS)
.  if ${WARNS} > 0
CFLAGS		+=	-W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith
# XXX Delete -Wuninitialized by default for now -- the compiler doesn't
# XXX always get it right.
CFLAGS		+=	-Wno-uninitialized
.   if !defined(NO_WERROR)
CFLAGS		+=	-Werror
.   endif
.  endif
.  if ${WARNS} > 1
CFLAGS		+=	-Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch -Wshadow
.  endif
. endif

. if defined(FORMAT_AUDIT)
WFORMAT		=	1
. endif
. if defined(WFORMAT)
.  if ${WFORMAT} > 0
CFLAGS		+=	-Wnon-const-format -Wno-format-extra-args
.   if !defined(NO_WERROR)
CFLAGS		+=	-Werror
.   endif
.  endif
. endif
.endif

# Allow user-specified additional warning flags
CFLAGS		+=	${CWARNFLAGS}

Add some granularity to the WARNS levels. 1: add -Werror 2: -Wall [only], as this is the most used warnings setting by developers 3: our old `1' 4: our old `2'

# $FreeBSD$
#
# This file contains common settings used for building FreeBSD
# sources.

# Enable various levels of compiler warning checks.  These may be
# overridden (e.g. if using a non-gcc compiler) by defining NO_WARNS.

.if !defined(NO_WARNS)
. if defined(WARNS)
.  if ${WARNS} > 0
.   if !defined(NO_WERROR)
CFLAGS		+=	-Werror
.   endif
.  endif
.  if ${WARNS} > 1
CFLAGS		+=	-Wall
# XXX Delete -Wuninitialized by default for now -- the compiler doesn't
# XXX always get it right.
CFLAGS		+=	-Wno-uninitialized
.  endif
.  if ${WARNS} > 2
CFLAGS		+=	-W -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith
.  endif
.  if ${WARNS} > 3
CFLAGS		+=	-Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch -Wshadow -Wcast-align
.  endif
. endif

. if defined(FORMAT_AUDIT)
WFORMAT		=	1
. endif
. if defined(WFORMAT)
.  if ${WFORMAT} > 0
CFLAGS		+=	-Wnon-const-format -Wno-format-extra-args
.   if !defined(NO_WERROR)
CFLAGS		+=	-Werror
.   endif
.  endif
. endif
.endif

# Allow user-specified additional warning flags
CFLAGS		+=	${CWARNFLAGS}


# customize below to fit your system
DPL_PKG_CONFIG	= /usr/local/lib/pkgconfig/

# compiler and flags
CC		= gcc
CFLAGS		= -Wall -Wextra -Werror -g
LDFLAGS		=
MAKEFLAGS	= --silent

# required flags
CFLAGS		+= -I. -std=c99 -D_BSD_SOURCE

# openssl
CFLAGS		+= `pkg-config --cflags openssl`
LDFLAGS		+= `pkg-config --libs openssl`

# libdroplets
CFLAGS		+= `PKG_CONFIG_PATH=$(DPL_PKG_CONFIG) pkg-config --cflags droplet-1.0`
LDFLAGS		+= `PKG_CONFIG_PATH=$(DPL_PKG_CONFIG) pkg-config --libs droplet-1.0`

Change a compilation flag to fix a large file bug.

# customize below to fit your system
DPL_PKG_CONFIG	= /usr/local/lib/pkgconfig/

# compiler and flags
CC		= gcc
CFLAGS		= -Wall -Wextra -Werror -g
LDFLAGS		=
MAKEFLAGS	= --silent

# required flags
CFLAGS		+= -I. -std=c99 -D_BSD_SOURCE -D_FILE_OFFSET_BITS=64

# openssl
CFLAGS		+= `pkg-config --cflags openssl`
LDFLAGS		+= `pkg-config --libs openssl`

# libdroplets
CFLAGS		+= `PKG_CONFIG_PATH=$(DPL_PKG_CONFIG) pkg-config --cflags droplet-1.0`
LDFLAGS		+= `PKG_CONFIG_PATH=$(DPL_PKG_CONFIG) pkg-config --libs droplet-1.0`


.PHONY: info-applications info-applications-supported-boards

# fallback so empty RIOTBASE won't lead to "/examples/"
RIOTBASE ?= .

# 1. use wildcard to find Makefiles
# 2. use patsubst to drop trailing "/"
# 3. use patsubst to drop possible leading "./"
# 4. sort
APPLICATION_DIRS := $(sort $(patsubst ./%,%,$(patsubst %/,%,$(dir $(wildcard \
	$(RIOTBASE)/bootloaders/*/Makefile \
	$(RIOTBASE)/examples/*/Makefile    \
	$(RIOTBASE)/tests/*/Makefile       \
	)))))

info-applications:
	@for dir in $(APPLICATION_DIRS); do echo $$dir; done

# All applications / board output of `info-boards-supported`.
info-applications-supported-boards:
	@for dir in $(APPLICATION_DIRS); do \
	  make --no-print-directory -C $${dir} info-boards-supported 2>/dev/null | xargs -n 1 echo $${dir}; \
	done
# BOARDS values from 'boards.inc.mk' to only evaluate it once
info-applications-supported-boards: export BOARDS ?=

Add the fuzzing/ directory to APPLICATION_DIRS

.PHONY: info-applications info-applications-supported-boards

# fallback so empty RIOTBASE won't lead to "/examples/"
RIOTBASE ?= .

# 1. use wildcard to find Makefiles
# 2. use patsubst to drop trailing "/"
# 3. use patsubst to drop possible leading "./"
# 4. sort
APPLICATION_DIRS := $(sort $(patsubst ./%,%,$(patsubst %/,%,$(dir $(wildcard \
	$(RIOTBASE)/fuzzing/*/Makefile     \
	$(RIOTBASE)/bootloaders/*/Makefile \
	$(RIOTBASE)/examples/*/Makefile    \
	$(RIOTBASE)/tests/*/Makefile       \
	)))))

info-applications:
	@for dir in $(APPLICATION_DIRS); do echo $$dir; done

# All applications / board output of `info-boards-supported`.
info-applications-supported-boards:
	@for dir in $(APPLICATION_DIRS); do \
	  make --no-print-directory -C $${dir} info-boards-supported 2>/dev/null | xargs -n 1 echo $${dir}; \
	done
# BOARDS values from 'boards.inc.mk' to only evaluate it once
info-applications-supported-boards: export BOARDS ?=


LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)

LOCAL_CPP_EXTENSION := .cc

# Set up the target identity
LOCAL_MODULE := libpac
LOCAL_MODULE_CLASS := SHARED_LIBRARIES

LOCAL_SRC_FILES := \
  src/proxy_resolver_v8.cc \
  src/proxy_resolver_js_bindings.cc \
  src/net_util.cc

LOCAL_CFLAGS += \
  -Wno-endif-labels \
  -Wno-import \
  -Wno-format \

LOCAL_C_INCLUDES += $(LOCAL_PATH)/src external/v8

LOCAL_STATIC_LIBRARIES := libv8
LOCAL_SHARED_LIBRARIES := libutils libstlport liblog

include external/stlport/libstlport.mk

include $(BUILD_SHARED_LIBRARY)

Hide warnings about unused parameters

LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)

LOCAL_CPP_EXTENSION := .cc

# Set up the target identity
LOCAL_MODULE := libpac
LOCAL_MODULE_CLASS := SHARED_LIBRARIES

LOCAL_SRC_FILES := \
  src/proxy_resolver_v8.cc \
  src/proxy_resolver_js_bindings.cc \
  src/net_util.cc

LOCAL_CFLAGS += \
  -Wno-endif-labels \
  -Wno-import \
  -Wno-format \
  -Wno-unused-parameter \

LOCAL_C_INCLUDES += $(LOCAL_PATH)/src external/v8

LOCAL_STATIC_LIBRARIES := libv8
LOCAL_SHARED_LIBRARIES := libutils libstlport liblog

include external/stlport/libstlport.mk

include $(BUILD_SHARED_LIBRARY)


.if !defined(TOPDIR)
.error "TOPDIR must be defined."
.endif

.PATH: ${TOPDIR}/event

SRCS+=	event_poll.cc
SRCS+=	event_system.cc
SRCS+=	timeout.cc

.if !defined(USE_POLL)
.if ${OSNAME} == "Darwin" || ${OSNAME} == "FreeBSD"
USE_POLL=	kqueue
.else
USE_POLL=	poll
.endif
.endif

.if ${OSNAME} == "Linux"
# Required for clock_gettime(3).
LDADD+=		-lrt
.endif

SRCS+=	event_poll_${USE_POLL}.cc

.if ${USE_POLL} == "kqueue"
CFLAGS+=-DUSE_POLL_KQUEUE
.elif ${USE_POLL} == "poll"
CFLAGS+=-DUSE_POLL_POLL
.elif ${USE_POLL} == "select"
CFLAGS+=-DUSE_POLL_SELECT
.else
.error "Unsupported poll mechanism."
.endif

Use select, not poll, on Interix.

.if !defined(TOPDIR)
.error "TOPDIR must be defined."
.endif

.PATH: ${TOPDIR}/event

SRCS+=	event_poll.cc
SRCS+=	event_system.cc
SRCS+=	timeout.cc

.if !defined(USE_POLL)
.if ${OSNAME} == "Darwin" || ${OSNAME} == "FreeBSD"
USE_POLL=	kqueue
.elif ${OSNAME} == "Interix"
USE_POLL=	select
.else
USE_POLL=	poll
.endif
.endif

.if ${OSNAME} == "Linux"
# Required for clock_gettime(3).
LDADD+=		-lrt
.endif

SRCS+=	event_poll_${USE_POLL}.cc

.if ${USE_POLL} == "kqueue"
CFLAGS+=-DUSE_POLL_KQUEUE
.elif ${USE_POLL} == "poll"
CFLAGS+=-DUSE_POLL_POLL
.elif ${USE_POLL} == "select"
CFLAGS+=-DUSE_POLL_SELECT
.else
.error "Unsupported poll mechanism."
.endif


# Copyright (C) 2014 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

LOCAL_PATH:= $(call my-dir)

# Build the samples.
# We need to add some special AAPT flags to generate R classes
# for resources that are included from the libraries.
include $(CLEAR_VARS)
LOCAL_PACKAGE_NAME := SupportLeanbackDemos
LOCAL_MODULE_TAGS := samples tests
LOCAL_SDK_VERSION := current
LOCAL_SRC_FILES := $(call all-java-files-under, src)
LOCAL_STATIC_JAVA_LIBRARIES := \
        android-support-v4 \
        android-support-v7-recyclerview \
        android-support-v17-leanback
LOCAL_RESOURCE_DIR = \
        $(LOCAL_PATH)/res \
        frameworks/support/v17/leanback/res
LOCAL_AAPT_FLAGS := \
        --auto-add-overlay \
        --extra-packages android.support.v17.leanback
include $(BUILD_PACKAGE)

Add resources to recyclerview dependency.

# Copyright (C) 2014 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

LOCAL_PATH:= $(call my-dir)

# Build the samples.
# We need to add some special AAPT flags to generate R classes
# for resources that are included from the libraries.
include $(CLEAR_VARS)
LOCAL_PACKAGE_NAME := SupportLeanbackDemos
LOCAL_MODULE_TAGS := samples tests
LOCAL_SDK_VERSION := current
LOCAL_SRC_FILES := $(call all-java-files-under, src)
LOCAL_STATIC_JAVA_LIBRARIES := \
        android-support-v4 \
        android-support-v7-recyclerview \
        android-support-v17-leanback
LOCAL_RESOURCE_DIR = \
        $(LOCAL_PATH)/res \
        frameworks/support/v17/leanback/res \
        frameworks/support/v7/recyclerview/res
LOCAL_AAPT_FLAGS := \
        --auto-add-overlay \
        --extra-packages android.support.v17.leanback \
        --extra-packages android.support.v7.recyclerview
include $(BUILD_PACKAGE)


# This is just a rough approximation of LLVM deps
LLVM_DEPS:=$(wildcard $(addprefix $(CFG_LLVM_SRC_DIR)/, \
                        * */*h */*/*h */*/*/*h */*cpp */*/*cpp */*/*/*cpp))

define DEF_LLVM_RULES

# If CFG_LLVM_ROOT is defined then we don't build LLVM ourselves
ifeq ($(CFG_LLVM_ROOT),)

$$(LLVM_CONFIG_$(1)): $$(LLVM_DEPS_$(1))
	@$$(call E, make: llvm)
	$$(Q)make -C $$(CFG_LLVM_BUILD_DIR_$(1))

endif

endef

$(foreach target,$(CFG_TARGET_TRIPLES), \
 $(eval $(call DEF_LLVM_RULES,$(target))))

Use $(MAKE) for recursive make

# This is just a rough approximation of LLVM deps
LLVM_DEPS:=$(wildcard $(addprefix $(CFG_LLVM_SRC_DIR)/, \
                        * */*h */*/*h */*/*/*h */*cpp */*/*cpp */*/*/*cpp))

define DEF_LLVM_RULES

# If CFG_LLVM_ROOT is defined then we don't build LLVM ourselves
ifeq ($(CFG_LLVM_ROOT),)

$$(LLVM_CONFIG_$(1)): $$(LLVM_DEPS_$(1))
	@$$(call E, make: llvm)
	$$(Q)$$(MAKE) -C $$(CFG_LLVM_BUILD_DIR_$(1))

endif

endef

$(foreach target,$(CFG_TARGET_TRIPLES), \
 $(eval $(call DEF_LLVM_RULES,$(target))))


# This file will be symlinked to the public repo and used for promoting the channel
# A custom public makefile can be pointed out by adding in own your makefile:
#
# RELEASE_CHANNELS_PUBLIC_REPO_MAKEFILE=<path-to-a-custom-makefile>
#
# Do keep in mind that the custom file always needs to import the public-makefile.deps.mk

include support-firecloud/repo/mk/core.misc.release.channels.public-makefile.deps.mk

# ------------------------------------------------------------------------------

SF_RELEASE_CHANNELS := \
	merlin \
	stable \

# ------------------------------------------------------------------------------

Rename the default canary channel to 'canary'

# This file will be symlinked to the public repo and used for promoting the channel
# A custom public makefile can be pointed out by adding in own your makefile:
#
# RELEASE_CHANNELS_PUBLIC_REPO_MAKEFILE=<path-to-a-custom-makefile>
#
# Do keep in mind that the custom file always needs to import the public-makefile.deps.mk

include support-firecloud/repo/mk/core.misc.release.channels.public-makefile.deps.mk

# ------------------------------------------------------------------------------

SF_RELEASE_CHANNELS := \
	canary \
	stable \

# ------------------------------------------------------------------------------


DEST=$(INSTALL_DIR)/$(PACKAGE_TARNAME)-$(PACKAGE_VERSION)
IMPORT_LIB_NAME := $(call libname,qpdf)
installwin: all
	$(RM) -r $(INSTALL_DIR)
	mkdir $(INSTALL_DIR)
	mkdir $(DEST)
	mkdir $(DEST)/bin
	mkdir $(DEST)/lib
	mkdir $(DEST)/include
	mkdir $(DEST)/include/qpdf
	mkdir $(DEST)/doc
	cp libqpdf/$(OUTPUT_DIR)/$(IMPORT_LIB_NAME) $(DEST)/lib
	cp libqpdf/$(OUTPUT_DIR)/qpdf*.dll $(DEST)/bin
	perl copy_dlls libqpdf/$(OUTPUT_DIR)/qpdf*.dll $(DEST)/bin $(OBJDUMP) $(WINDOWS_WORDSIZE)
	cp qpdf/$(OUTPUT_DIR)/qpdf.exe $(DEST)/bin
	cp zlib-flate/$(OUTPUT_DIR)/zlib-flate.exe $(DEST)/bin
	cp qpdf/fix-qdf $(DEST)/bin
	cp include/qpdf/*.h $(DEST)/include/qpdf
	cp include/qpdf/*.hh $(DEST)/include/qpdf
	cp doc/stylesheet.css $(DEST)/doc
	cp doc/qpdf-manual.html $(DEST)/doc
	cp doc/qpdf-manual.pdf $(DEST)/doc

Make windows install not fail on missing docs

DEST=$(INSTALL_DIR)/$(PACKAGE_TARNAME)-$(PACKAGE_VERSION)
IMPORT_LIB_NAME := $(call libname,qpdf)
installwin: all
	$(RM) -r $(INSTALL_DIR)
	mkdir $(INSTALL_DIR)
	mkdir $(DEST)
	mkdir $(DEST)/bin
	mkdir $(DEST)/lib
	mkdir $(DEST)/include
	mkdir $(DEST)/include/qpdf
	mkdir $(DEST)/doc
	cp libqpdf/$(OUTPUT_DIR)/$(IMPORT_LIB_NAME) $(DEST)/lib
	cp libqpdf/$(OUTPUT_DIR)/qpdf*.dll $(DEST)/bin
	perl copy_dlls libqpdf/$(OUTPUT_DIR)/qpdf*.dll $(DEST)/bin $(OBJDUMP) $(WINDOWS_WORDSIZE)
	cp qpdf/$(OUTPUT_DIR)/qpdf.exe $(DEST)/bin
	cp zlib-flate/$(OUTPUT_DIR)/zlib-flate.exe $(DEST)/bin
	cp qpdf/fix-qdf $(DEST)/bin
	cp include/qpdf/*.h $(DEST)/include/qpdf
	cp include/qpdf/*.hh $(DEST)/include/qpdf
	cp doc/stylesheet.css $(DEST)/doc
	if [ -f doc/qpdf-manual.html ]; then \
	    cp doc/qpdf-manual.html $(DEST)/doc; \
	fi
	if [ -f doc/qpdf-manual.pdf ]; then \
	    doc/qpdf-manual.pdf $(DEST)/doc; \
	fi


package=native_protobuf
$(package)_version=2.5.0
$(package)_download_path=https://protobuf.googlecode.com/files
$(package)_file_name=protobuf-$($(package)_version).tar.bz2
$(package)_sha256_hash=13bfc5ae543cf3aa180ac2485c0bc89495e3ae711fc6fab4f8ffe90dfb4bb677

define $(package)_set_vars
$(package)_config_opts=--disable-shared
endef

define $(package)_config_cmds
  $($(package)_autoconf)
endef

define $(package)_build_cmds
  $(MAKE) -C src protoc
endef

define $(package)_stage_cmds
  $(MAKE) -C src DESTDIR=$($(package)_staging_dir) install-strip
endef

define $(package)_postprocess_cmds
  rm -rf lib include
endef

Update Protobuf 2.5.0 -> 2.6.1

package=native_protobuf
$(package)_version=2.6.1
$(package)_download_path=https://github.com/google/protobuf/releases/download/v$($(package)_version)
$(package)_file_name=protobuf-$($(package)_version).tar.bz2
$(package)_sha256_hash=ee445612d544d885ae240ffbcbf9267faa9f593b7b101f21d58beceb92661910

define $(package)_set_vars
$(package)_config_opts=--disable-shared
endef

define $(package)_config_cmds
  $($(package)_autoconf)
endef

define $(package)_build_cmds
  $(MAKE) -C src protoc
endef

define $(package)_stage_cmds
  $(MAKE) -C src DESTDIR=$($(package)_staging_dir) install-strip
endef

define $(package)_postprocess_cmds
  rm -rf lib include
endef


# IBM_PROLOG_BEGIN_TAG
# This is an automatically generated prolog.
#
# $Source: src/import/chips/p9/procedures/hwp/memory/p9_mss_memdiag.mk $
#
# OpenPOWER HostBoot Project
#
# Contributors Listed Below - COPYRIGHT 2015,2019
# [+] International Business Machines Corp.
#
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied. See the License for the specific language governing
# permissions and limitations under the License.
#
# IBM_PROLOG_END_TAG

PROCEDURE=p9_mss_memdiag
$(call BUILD_PROCEDURE)

Add c_str generic API and update makefiles

# IBM_PROLOG_BEGIN_TAG
# This is an automatically generated prolog.
#
# $Source: src/import/chips/p9/procedures/hwp/memory/p9_mss_memdiag.mk $
#
# OpenPOWER HostBoot Project
#
# Contributors Listed Below - COPYRIGHT 2015,2019
# [+] International Business Machines Corp.
#
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied. See the License for the specific language governing
# permissions and limitations under the License.
#
# IBM_PROLOG_END_TAG

# Include the macros and things for MSS procedures
-include 00common.mk

PROCEDURE=p9_mss_memdiag
$(eval $(call ADD_MEMORY_INCDIRS,$(PROCEDURE)))
$(call BUILD_PROCEDURE)


LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)
LOCAL_MODULE := libswscale
LOCAL_SRC_FILES := ffmpeg/$(TARGET_ARCH_ABI)/lib/$(LOCAL_MODULE).so
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/ffmpeg/$(TARGET_ARCH_ABI)/include
include $(PREBUILT_SHARED_LIBRARY)

include $(CLEAR_VARS)
LOCAL_MODULE := libavcodec
LOCAL_SRC_FILES := ffmpeg/$(TARGET_ARCH_ABI)/lib/$(LOCAL_MODULE).so
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/ffmpeg/$(TARGET_ARCH_ABI)/include
include $(PREBUILT_SHARED_LIBRARY)

include $(CLEAR_VARS)
LOCAL_MODULE := libavformat
LOCAL_SRC_FILES := ffmpeg/$(TARGET_ARCH_ABI)/lib/$(LOCAL_MODULE).so
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/ffmpeg/$(TARGET_ARCH_ABI)/include
include $(PREBUILT_SHARED_LIBRARY)

include $(CLEAR_VARS)
LOCAL_MODULE := libavutil
LOCAL_SRC_FILES := ffmpeg/$(TARGET_ARCH_ABI)/lib/$(LOCAL_MODULE).so
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/ffmpeg/$(TARGET_ARCH_ABI)/include
include $(PREBUILT_SHARED_LIBRARY)

LOCAL_PATH:= $(call my-dir)

Update code to use FFmpegMediaPlayer

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)
LOCAL_MODULE := libavcodec
LOCAL_SRC_FILES := ffmpeg/$(TARGET_ARCH_ABI)/lib/$(LOCAL_MODULE).so
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/ffmpeg/$(TARGET_ARCH_ABI)/include
include $(PREBUILT_SHARED_LIBRARY)

include $(CLEAR_VARS)
LOCAL_MODULE := libavformat
LOCAL_SRC_FILES := ffmpeg/$(TARGET_ARCH_ABI)/lib/$(LOCAL_MODULE).so
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/ffmpeg/$(TARGET_ARCH_ABI)/include
include $(PREBUILT_SHARED_LIBRARY)

include $(CLEAR_VARS)
LOCAL_MODULE := libavutil
LOCAL_SRC_FILES := ffmpeg/$(TARGET_ARCH_ABI)/lib/$(LOCAL_MODULE).so
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/ffmpeg/$(TARGET_ARCH_ABI)/include
include $(PREBUILT_SHARED_LIBRARY)

include $(CLEAR_VARS)
LOCAL_MODULE := libswresample
LOCAL_SRC_FILES := ffmpeg/$(TARGET_ARCH_ABI)/lib/$(LOCAL_MODULE).so
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/ffmpeg/$(TARGET_ARCH_ABI)/include
include $(PREBUILT_SHARED_LIBRARY)

include $(CLEAR_VARS)
LOCAL_MODULE := libswscale
LOCAL_SRC_FILES := ffmpeg/$(TARGET_ARCH_ABI)/lib/$(LOCAL_MODULE).so
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/ffmpeg/$(TARGET_ARCH_ABI)/include
include $(PREBUILT_SHARED_LIBRARY)

LOCAL_PATH:= $(call my-dir)


# Copyright (C) 2012 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

LOCAL_PATH := $(call my-dir)

# Here is the final static library that apps can link against.
# The R class is automatically excluded from the generated library.
# Applications that use this library must specify LOCAL_RESOURCE_DIR
# in their makefiles to include the resources in their package.
include $(CLEAR_VARS)
LOCAL_MODULE := android-support-v7-appcompat
LOCAL_SDK_VERSION := 19
LOCAL_SRC_FILES := $(call all-java-files-under,src)
LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res
LOCAL_JAVA_LIBRARIES += android-support-v4
include $(BUILD_STATIC_JAVA_LIBRARY)

Revert "Set SDK_VERSION to 19 instead of current."

# Copyright (C) 2012 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

LOCAL_PATH := $(call my-dir)

# Here is the final static library that apps can link against.
# The R class is automatically excluded from the generated library.
# Applications that use this library must specify LOCAL_RESOURCE_DIR
# in their makefiles to include the resources in their package.
include $(CLEAR_VARS)
LOCAL_MODULE := android-support-v7-appcompat
LOCAL_SDK_VERSION := current
LOCAL_SRC_FILES := $(call all-java-files-under,src)
LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res
LOCAL_JAVA_LIBRARIES += android-support-v4
include $(BUILD_STATIC_JAVA_LIBRARY)


USB_VID = 0x239a
USB_PID = 0x00a5
USB_PRODUCT = "ESP32-S2-Pico"
USB_MANUFACTURER = "Waveshare Electronics"

IDF_TARGET = esp32s2

INTERNAL_FLASH_FILESYSTEM = 1
LONGINT_IMPL = MPZ

# The default queue depth of 16 overflows on release builds,
# so increase it to 32.
CFLAGS += -DCFG_TUD_TASK_QUEUE_SZ=32

CIRCUITPY_ESP_FLASH_MODE = dio
CIRCUITPY_ESP_FLASH_FREQ = 80m
CIRCUITPY_ESP_FLASH_SIZE = 4MB

Add the one obtained from esp

USB_VID = 0x303a
USB_PID = 0x810a
USB_PRODUCT = "ESP32-S2-Pico"
USB_MANUFACTURER = "Waveshare Electronics"

IDF_TARGET = esp32s2

INTERNAL_FLASH_FILESYSTEM = 1
LONGINT_IMPL = MPZ

# The default queue depth of 16 overflows on release builds,
# so increase it to 32.
CFLAGS += -DCFG_TUD_TASK_QUEUE_SZ=32

CIRCUITPY_ESP_FLASH_MODE = dio
CIRCUITPY_ESP_FLASH_FREQ = 80m
CIRCUITPY_ESP_FLASH_SIZE = 4MB


LOCAL_PATH:= $(call my-dir)

include $(CLEAR_VARS)

LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/parameter-framework-plugins/Fs

LOCAL_SRC_FILES := \
    FSSubsystem.cpp \
    FSSubsystemBuilder.cpp \
    FSSubsystemObject.cpp

LOCAL_MODULE := libfs-subsystem

LOCAL_MODULE_TAGS := optional

TARGET_ERROR_FLAGS += -Wno-non-virtual-dtor

LOCAL_C_INCLUDES += $(LOCAL_PATH)/../parameter \
    $(LOCAL_PATH)/../xmlserializer/

LOCAL_C_INCLUDES += \
        external/stlport/stlport/ \
        bionic/libstdc++ \
        bionic/ \
        vendor/intel/hardware/include

LOCAL_C_INCLUDES +=

LOCAL_SHARED_LIBRARIES := libstlport libparameter libxmlserializer libcutils

LOCAL_LDLIBS +=
LOCAL_LDFLAGS +=

include $(BUILD_SHARED_LIBRARY)

Fix missing space before := in makefiles

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/parameter-framework-plugins/Fs

LOCAL_SRC_FILES := \
    FSSubsystem.cpp \
    FSSubsystemBuilder.cpp \
    FSSubsystemObject.cpp

LOCAL_MODULE := libfs-subsystem

LOCAL_MODULE_TAGS := optional

TARGET_ERROR_FLAGS += -Wno-non-virtual-dtor

LOCAL_C_INCLUDES += $(LOCAL_PATH)/../parameter \
    $(LOCAL_PATH)/../xmlserializer/

LOCAL_C_INCLUDES += \
        external/stlport/stlport/ \
        bionic/libstdc++ \
        bionic/ \
        vendor/intel/hardware/include

LOCAL_C_INCLUDES +=

LOCAL_SHARED_LIBRARIES := libstlport libparameter libxmlserializer libcutils

LOCAL_LDLIBS +=
LOCAL_LDFLAGS +=

include $(BUILD_SHARED_LIBRARY)


# src/backend/nls.mk
CATALOG_NAME     = postgres
AVAIL_LANGUAGES  = de es fr ja pt_BR tr zh_CN zh_TW
GETTEXT_FILES    = + gettext-files
GETTEXT_TRIGGERS = $(BACKEND_COMMON_GETTEXT_TRIGGERS) \
    GUC_check_errmsg GUC_check_errdetail GUC_check_errhint \
    write_stderr yyerror parser_yyerror
GETTEXT_FLAGS    = $(BACKEND_COMMON_GETTEXT_FLAGS) \
    GUC_check_errmsg:1:c-format \
    GUC_check_errdetail:1:c-format \
    GUC_check_errhint:1:c-format \
    write_stderr:1:c-format

gettext-files: distprep
	find $(srcdir)/ $(srcdir)/../port/ -name '*.c' -print >$@

my-maintainer-clean:
	rm -f gettext-files

.PHONY: my-maintainer-clean
maintainer-clean: my-maintainer-clean

Clean gettext-files file in clean target

# src/backend/nls.mk
CATALOG_NAME     = postgres
AVAIL_LANGUAGES  = de es fr ja pt_BR tr zh_CN zh_TW
GETTEXT_FILES    = + gettext-files
GETTEXT_TRIGGERS = $(BACKEND_COMMON_GETTEXT_TRIGGERS) \
    GUC_check_errmsg GUC_check_errdetail GUC_check_errhint \
    write_stderr yyerror parser_yyerror
GETTEXT_FLAGS    = $(BACKEND_COMMON_GETTEXT_FLAGS) \
    GUC_check_errmsg:1:c-format \
    GUC_check_errdetail:1:c-format \
    GUC_check_errhint:1:c-format \
    write_stderr:1:c-format

gettext-files: distprep
	find $(srcdir)/ $(srcdir)/../port/ -name '*.c' -print >$@

my-clean:
	rm -f gettext-files

.PHONY: my-clean
clean: my-clean


LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

LOCAL_MODULE    := internetmaprenderer
LOCAL_CFLAGS    := -Wall
LOCAL_SRC_FILES := jniapi.cpp renderer.cpp common/OpenGL.cpp common/DisplayLines.cpp common/DisplayNodes.cpp \
                   common/Program.cpp common/VertexBuffer.cpp common/Camera.cpp common/MapDisplay.cpp common/MapUtilities.cpp \
                   common/DefaultVisualization.cpp common/Connection.cpp common/Node.cpp \
                   common/IndexBox.cpp common/MapData.cpp common/MapController.cpp jsoncpp/jsoncpp.cpp
LOCAL_LDLIBS    := -llog -landroid -lEGL -lGLESv2
LOCAL_CPP_FEATURES += exceptions

include $(BUILD_SHARED_LIBRARY)

Add new visualizations to android build.

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

LOCAL_MODULE    := internetmaprenderer
LOCAL_CFLAGS    := -Wall
LOCAL_SRC_FILES := jniapi.cpp renderer.cpp common/OpenGL.cpp common/DisplayLines.cpp common/DisplayNodes.cpp \
                   common/Program.cpp common/VertexBuffer.cpp common/Camera.cpp common/MapDisplay.cpp common/MapUtilities.cpp \
                   common/DefaultVisualization.cpp common/TypeVisualization.cpp common/Connection.cpp common/Node.cpp \
                   common/IndexBox.cpp common/MapData.cpp common/MapController.cpp jsoncpp/jsoncpp.cpp common/GlobeVisualization.cpp
LOCAL_LDLIBS    := -llog -landroid -lEGL -lGLESv2
LOCAL_CPP_FEATURES += exceptions

include $(BUILD_SHARED_LIBRARY)


.PHONY: format clean all run versionning include

all: $(EXE)

include $(wildcard */rules.mk)

%.o: %.c | $(BUILT_SRCS)
	@echo "CC: $@"
	@$(CC) $(CFLAGS) -c $< -o $@

%.o: %.cpp | $(BUILT_SRCS)
	@echo "CPP: $@"
	@$(CPP) $(CPPFLAGS) -c $< -o $@

$(ELF): $(OBJS)
	@mkdir -p $(DISTDIR)
	@echo "CCLD: $@"
	@+$(CC) $(LDFLAGS) $^ -o $(ELF)

$(EXE): $(ELF)
	@mkdir -p $(DISTDIR)
	@echo "ZEHN: $@"
	@$(ZEHN) --input $(ELF) --output $(EXE) $(ZEHNFLAGS)

clean:
	@echo "Removing dist"
	@rm -rf $(DISTDIR)
	@echo "Removing object files"
	@rm -f $(OBJS)
	@echo "Removing other build artifacts"
	@rm -f $(CLEAN_SPEC)

format:
	@echo "Formatting source using clang-format"
	@clang-format -i -style=file $(SRCS_C) $(SRCS_CPP) $(wildcard $(addsuffix /*.h,$(INCLUDE)))

include:
	@echo $(addprefix -I ,$(INCLUDE))

run: all
	@echo "Sending $(EXE) to calculator"
	@tilp -ns $(EXE) > /dev/null

.FORCE:

Fix newline in make include since it's used for scripting

.PHONY: format clean all run versionning include

all: $(EXE)

include $(wildcard */rules.mk)

%.o: %.c | $(BUILT_SRCS)
	@echo "CC: $@"
	@$(CC) $(CFLAGS) -c $< -o $@

%.o: %.cpp | $(BUILT_SRCS)
	@echo "CPP: $@"
	@$(CPP) $(CPPFLAGS) -c $< -o $@

$(ELF): $(OBJS)
	@mkdir -p $(DISTDIR)
	@echo "CCLD: $@"
	@+$(CC) $(LDFLAGS) $^ -o $(ELF)

$(EXE): $(ELF)
	@mkdir -p $(DISTDIR)
	@echo "ZEHN: $@"
	@$(ZEHN) --input $(ELF) --output $(EXE) $(ZEHNFLAGS)

clean:
	@echo "Removing dist"
	@rm -rf $(DISTDIR)
	@echo "Removing object files"
	@rm -f $(OBJS)
	@echo "Removing other build artifacts"
	@rm -f $(CLEAN_SPEC)

format:
	@echo "Formatting source using clang-format"
	@clang-format -i -style=file $(SRCS_C) $(SRCS_CPP) $(wildcard $(addsuffix /*.h,$(INCLUDE)))

include:
	@echo -n $(addprefix -I ,$(INCLUDE))

run: all
	@echo "Sending $(EXE) to calculator"
	@tilp -ns $(EXE) > /dev/null

.FORCE:


LIBEXT = dylib
LIBFLAGS = -dynamiclib

LIBMAJOREXT = $(LIB_MAJOR).$(LIBEXT)
LIBMINOREXT = $(LIB_VERSION).$(LIBEXT)

Implement library versioning for macOS

LIBEXT = dylib
LIBFLAGS = -dynamiclib -Wl,-compatibility_version,$(LIB_MAJOR) -Wl,-current_version,$(LIB_VERSION)

LIBMAJOREXT = $(LIB_MAJOR).$(LIBEXT)
LIBMINOREXT = $(LIB_VERSION).$(LIBEXT)


# Common makefiles
include ../../mk/spksrc.common.mk
include ../../mk/spksrc.directories.mk

# Force build in native tool directrory, not cross directory.
WORK_DIR := $(PWD)/work-native

# Package dependend
URLS          = $(PKG_DIST_SITE)/$(PKG_DIST_NAME)
NAME          = native-$(PKG_NAME)
COOKIE_PREFIX = $(PKG_NAME)-
DIST_FILE     = $(DISTRIB_DIR)/$(PKG_DIST_NAME)
DIST_EXT      = $(PKG_EXT)

#####

include ../../mk/spksrc.native-env.mk

include ../../mk/spksrc.download.mk

include ../../mk/spksrc.depend.mk

checksum: download
include ../../mk/spksrc.checksum.mk

extract: checksum depend
include ../../mk/spksrc.extract.mk

patch: extract
include ../../mk/spksrc.patch.mk

configure: patch
include ../../mk/spksrc.configure.mk

compile: configure
include ../../mk/spksrc.compile.mk

.PHONY: cat_PLIST
cat_PLIST:
	@true

dependency-tree:
	@echo `perl -e 'print "\\\t" x $(MAKELEVEL),"\n"'`+ $(NAME)
	@for depend in $(DEPENDS) ; \
	do \
	  $(MAKE) --no-print-directory -C ../../$$depend dependency-tree ; \
	done

### Clean rules
clean:
	rm -fr $(WORK_DIR)

all: compile

Add install target for native

# Common makefiles
include ../../mk/spksrc.common.mk
include ../../mk/spksrc.directories.mk

# Force build in native tool directrory, not cross directory.
WORK_DIR := $(PWD)/work-native

# Package dependend
URLS          = $(PKG_DIST_SITE)/$(PKG_DIST_NAME)
NAME          = native-$(PKG_NAME)
COOKIE_PREFIX = $(PKG_NAME)-
DIST_FILE     = $(DISTRIB_DIR)/$(PKG_DIST_NAME)
DIST_EXT      = $(PKG_EXT)

#####

include ../../mk/spksrc.native-env.mk

include ../../mk/spksrc.download.mk

include ../../mk/spksrc.depend.mk

checksum: download
include ../../mk/spksrc.checksum.mk

extract: checksum depend
include ../../mk/spksrc.extract.mk

patch: extract
include ../../mk/spksrc.patch.mk

configure: patch
include ../../mk/spksrc.configure.mk

compile: configure
include ../../mk/spksrc.compile.mk

install: compile
include ../../mk/spksrc.install.mk

.PHONY: cat_PLIST
cat_PLIST:
	@true

dependency-tree:
	@echo `perl -e 'print "\\\t" x $(MAKELEVEL),"\n"'`+ $(NAME)
	@for depend in $(DEPENDS) ; \
	do \
	  $(MAKE) --no-print-directory -C ../../$$depend dependency-tree ; \
	done

### Clean rules
clean:
	rm -fr $(WORK_DIR)

all: install


if DEBUG
AM_CFLAGS=-O0 -g -Wall -Wextra --std=c99
else
AM_CFLAGS=-O2 -g --std=c99
endif

AM_CPPFLAGS = -I$(top_srcdir)/include

Add comment about gross autoconf bits

# This is really gross since we end up with "--std=gnu99 ... --std=c99" in the
# flags. I can't figure out how to tell autoconf to _not_ use gnu99.

if DEBUG
AM_CFLAGS=-O0 -g -Wall -Wextra --std=c99
else
AM_CFLAGS=-O2 -g --std=c99
endif

AM_CPPFLAGS = -I$(top_srcdir)/include


$(TARGET_LIB): $(OBJECTS) $(BUILD_LIB_DIR)
	$(AR) $(ARFLAGS) $@ $(OBJECTS)

$(TARGET_TEST): $(OBJECTS) $(BUILD_TEST_DIR)
	$(CC) $(LDFLGAS) $(LIBDIRS) $(LIBS) -o $@ $(OBJECTS)

$(BUILD_OBJ_DIR)/%.o:%.c $(BUILD_OBJ_DIR)
	$(CC) $(CFLAGS) $(INCLUDES) -o $@ -c $<

$(BUILD_OBJ_DIR):
	mkdir -p $@

$(BUILD_LIB_DIR):
	mkdir -p $@

$(BUILD_TEST_DIR):
	mkdir -p $@

-include $(DEPENDS)

Fix a problem that runs full-build is run when 'make all' after 'make build-test'

$(TARGET_LIB): $(OBJECTS)
	@[ -d $(BUILD_LIB_DIR) ] || mkdir -p $(BUILD_LIB_DIR)
	$(AR) $(ARFLAGS) $@ $(OBJECTS)

$(TARGET_TEST): $(OBJECTS)
	@[ -d $(BUILD_TEST_DIR) ] || mkdir -p $(BUILD_TEST_DIR)
	$(CC) $(LDFLGAS) $(LIBDIRS) $(LIBS) -o $@ $(OBJECTS)

$(BUILD_OBJ_DIR)/%.o:%.c
	@[ -d $(BUILD_OBJ_DIR) ] || mkdir -p $(BUILD_OBJ_DIR)
	$(CC) $(CFLAGS) $(INCLUDES) -o $@ -c $<

-include $(DEPENDS)


CFLAGS += \
  -D__MSP430F5529__ \
  -nostdlib -nostartfiles \
  -DCFG_TUSB_MCU=OPT_MCU_MSP430x5xx

# All source paths should be relative to the top level.
LD_FILE = hw/bsp/msp_exp430f5529lp/msp430f5529.ld
LDFLAGS += -L$(TOP)/hw/bsp/$(BOARD)

INC += $(TOP)/hw/bsp/$(BOARD)

# For TinyUSB port source
VENDOR = ti
CHIP_FAMILY = msp430x5xx

# Path to STM32 Cube Programmer CLI, should be added into system path
MSPDEBUG = mspdebug

# flash target using on-board stlink
flash: $(BUILD)/$(BOARD)-firmware.elf
	$(MSPDEBUG) tilib "prog $<"

Remove -nostdlib and -nostartfiles, as the compiler provides them.

CFLAGS += \
  -D__MSP430F5529__ \
  -DCFG_TUSB_MCU=OPT_MCU_MSP430x5xx

# All source paths should be relative to the top level.
LD_FILE = hw/bsp/msp_exp430f5529lp/msp430f5529.ld
LDFLAGS += -L$(TOP)/hw/bsp/$(BOARD)

INC += $(TOP)/hw/bsp/$(BOARD)

# For TinyUSB port source
VENDOR = ti
CHIP_FAMILY = msp430x5xx

# Path to STM32 Cube Programmer CLI, should be added into system path
MSPDEBUG = mspdebug

# flash target using on-board stlink
flash: $(BUILD)/$(BOARD)-firmware.elf
	$(MSPDEBUG) tilib "prog $<"


include build/platform-darwin.mk
CXX = clang++
CC = clang
SDK = 7.0
ifneq ($(filter %86 x86_64, $(ARCH)),)
SDKTYPE = iPhoneSimulator
else
SDKTYPE = iPhoneOS
endif
SDK_MIN = 5.1

SDKROOT = /Applications/Xcode.app/Contents/Developer/Platforms/$(SDKTYPE).platform/Developer/SDKs/$(SDKTYPE)$(SDK).sdk
CFLAGS += -arch $(ARCH) -isysroot $(SDKROOT) -miphoneos-version-min=$(SDK_MIN) -DAPPLE_IOS
LDFLAGS += -arch $(ARCH) -isysroot $(SDKROOT) -miphoneos-version-min=$(SDK_MIN)

Set the arch to armv7 by default when building for iOS

ARCH = armv7
include build/platform-darwin.mk
CXX = clang++
CC = clang
SDK = 7.0
ifneq ($(filter %86 x86_64, $(ARCH)),)
SDKTYPE = iPhoneSimulator
else
SDKTYPE = iPhoneOS
endif
SDK_MIN = 5.1

SDKROOT = /Applications/Xcode.app/Contents/Developer/Platforms/$(SDKTYPE).platform/Developer/SDKs/$(SDKTYPE)$(SDK).sdk
CFLAGS += -arch $(ARCH) -isysroot $(SDKROOT) -miphoneos-version-min=$(SDK_MIN) -DAPPLE_IOS
LDFLAGS += -arch $(ARCH) -isysroot $(SDKROOT) -miphoneos-version-min=$(SDK_MIN)


REGISTRY = quay.io
REPOSITORY = aptible/ruby

export TAG = $(RUBY_TAG)-$(FROM_OS)-$(FROM_TAG)
export FROM = aptible/$(FROM_OS):$(FROM_TAG)

# Now, we have to figure out aliases.
PUSH_TAGS = $(TAG) ruby-$(TAG)

ifeq "$(FROM_OS):$(FROM_TAG)" "ubuntu:12.04"
PUSH_TAGS = $(TAG)
endif

ifeq "$(FROM_OS):$(FROM_TAG)" "ubuntu:16.04"
# Ubuntu 16.04 gets the default Ubuntu tag, the ubuntu alias, the default
# VERSION alias, and the ruby-VERSION alias.
PUSH_TAGS = $(TAG) $(RUBY_TAG) $(RUBY_TAG)-ubuntu  ruby-$(RUBY_TAG)
endif

ifeq "$(FROM_OS):$(FROM_TAG)" "debian:wheezy"
# COMPATIBILITY: Wheezy gets the default Debian tag.
PUSH_TAGS = $(TAG) $(RUBY_TAG)-debian ruby-$(RUBY_TAG)-debian
endif

PUSH_REGISTRIES = $(REGISTRY) docker.io

# And now, we source $(RUBY_TAG)/config.mk to get the shasum.
-include $(RUBY_TAG)/config.mk

Use Debian Jessie in Ruby images

REGISTRY = quay.io
REPOSITORY = aptible/ruby

export TAG = $(RUBY_TAG)-$(FROM_OS)-$(FROM_TAG)
export FROM = aptible/$(FROM_OS):$(FROM_TAG)

# Now, we have to figure out aliases.
PUSH_TAGS = $(TAG) ruby-$(TAG)

ifeq "$(FROM_OS):$(FROM_TAG)" "ubuntu:16.04"
# Ubuntu 16.04 gets the default tag and the default Ubuntu tag.
PUSH_TAGS += $(RUBY_TAG) $(RUBY_TAG)-ubuntu ruby-$(RUBY_TAG)-ubuntu
endif

ifeq "$(FROM_OS):$(FROM_TAG)" "debian:jessie"
# Debian Jessie gets the default Debian tag.
PUSH_TAGS += $(RUBY_TAG)-debian ruby-$(RUBY_TAG)-debian
endif

PUSH_REGISTRIES = $(REGISTRY) docker.io

# And now, we source $(RUBY_TAG)/config.mk to get the shasum.
-include $(RUBY_TAG)/config.mk