SOURCE_ROOT = src
ENABLE_INSTALL_STATIC_LIBS = 1
ENABLE_INSTALL_DEBUG_LIBS  = 1
ENABLE_INSTALL_DEBUG_PROGS = 1

# Construct fat binaries on Darwin when using Clang
ifneq ($(TIGHTDB_ENABLE_FAT_BINARIES),)
ifneq ($(call CC_CXX_AND_LD_ARE,clang),)
ifeq ($(shell uname),Darwin)
CFLAGS_ARCH += -arch i386 -arch x86_64
endif
endif
endif

# FIXME: '-fno-elide-constructors' currently causes TightDB to fail
#CFLAGS_DEBUG   += -fno-elide-constructors
CFLAGS_PTHREAD += -pthread
CFLAGS_GENERAL += -Wextra -ansi -pedantic -Wno-long-long

ifneq ($(TIGHTDB_ENABLE_REPLICATION),)
PROJECT_CFLAGS += -DTIGHTDB_ENABLE_REPLICATION
endif

#PROJECT_CFLAGS_DEBUG = -DTIGHTDB_DEBUG -DTIGHTDB_MAX_LIST_SIZE=4
PROJECT_CFLAGS_DEBUG = -DTIGHTDB_DEBUG
PROJECT_CFLAGS_COVER = -DTIGHTDB_DEBUG -DTIGHTDB_MAX_LIST_SIZE=4

Revert "Temporarily setting TIGHTDB_MAX_LIST_SIZE=1000 in debug mode"

SOURCE_ROOT = src
ENABLE_INSTALL_STATIC_LIBS = 1
ENABLE_INSTALL_DEBUG_LIBS  = 1
ENABLE_INSTALL_DEBUG_PROGS = 1

# Construct fat binaries on Darwin when using Clang
ifneq ($(TIGHTDB_ENABLE_FAT_BINARIES),)
ifneq ($(call CC_CXX_AND_LD_ARE,clang),)
ifeq ($(shell uname),Darwin)
CFLAGS_ARCH += -arch i386 -arch x86_64
endif
endif
endif

# FIXME: '-fno-elide-constructors' currently causes TightDB to fail
#CFLAGS_DEBUG   += -fno-elide-constructors
CFLAGS_PTHREAD += -pthread
CFLAGS_GENERAL += -Wextra -ansi -pedantic -Wno-long-long

ifneq ($(TIGHTDB_ENABLE_REPLICATION),)
PROJECT_CFLAGS += -DTIGHTDB_ENABLE_REPLICATION
endif

PROJECT_CFLAGS_DEBUG = -DTIGHTDB_DEBUG -DTIGHTDB_MAX_LIST_SIZE=4
PROJECT_CFLAGS_COVER = -DTIGHTDB_DEBUG -DTIGHTDB_MAX_LIST_SIZE=4


#
# Copyright (C) 2009 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.
#

# This is a build configuration for a full-featured build of the
# Open-Source part of the tree. It's geared toward a US-centric
# build quite specifically for the emulator, and might not be
# entirely appropriate to inherit from for on-device configurations.

PRODUCT_PACKAGES := \
    VoiceDialer

PRODUCT_PROPERTY_OVERRIDES := \
    keyguard.no_require_sim=true \
    ro.com.android.dataroaming=false

PRODUCT_COPY_FILES := \
    device/generic/goldfish/data/etc/apns-conf.xml:system/etc/apns-conf.xml

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

Stop installing the sample APN list

#
# Copyright (C) 2009 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.
#

# This is a build configuration for a full-featured build of the
# Open-Source part of the tree. It's geared toward a US-centric
# build quite specifically for the emulator, and might not be
# entirely appropriate to inherit from for on-device configurations.

PRODUCT_PACKAGES := \
    VoiceDialer

PRODUCT_PROPERTY_OVERRIDES := \
    keyguard.no_require_sim=true \
    ro.com.android.dataroaming=false

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


APP_ABI := all
# The minimum API version we support is 14
APP_PLATFORM := android-14

# Workaround for MIPS toolchain linker being unable to find liblog.so dependency
APP_LDFLAGS := -llog

#CLANG_SANTITIZE := address

ifneq ($(CLANG_SANTITIZE),)
    APP_LDFLAGS := -fsanitize=$(CLANG_SANTITIZE)
    APP_CFLAGS := -fsanitize=$(CLANG_SANTITIZE) -g -fno-omit-frame-pointer
endif

Add -O1 to compiler arguments to prevent segfaults due to c stack overflow

APP_ABI := all
# The minimum API version we support is 14
APP_PLATFORM := android-14

# Workaround for MIPS toolchain linker being unable to find liblog.so dependency
APP_LDFLAGS := -llog

#CLANG_SANTITIZE := address
# This is necessary because the interpreter segfaults otherwise (possibly due to a c stack overflow)
APP_CFLAGS := -O1
ifneq ($(CLANG_SANTITIZE),)
    APP_LDFLAGS := -fsanitize=$(CLANG_SANTITIZE)
    APP_CFLAGS += -fsanitize=$(CLANG_SANTITIZE) -g -fno-omit-frame-pointer
endif


# Common variables.

PREFIX	?= /usr/local
SBINDIR	?= $(PREFIX)/sbin
LIBDIR	?= $(PREFIX)/lib
ETCDIR	?= $(PREFIX)/etc
TOPDIR	?= ..
INSTALL_STRIPPED ?= -s

LDFLAGS += -L$(TOPDIR)/lib -L$(PREFIX)/lib -lxbps
CPPFLAGS += -I$(TOPDIR)/include -D_BSD_SOURCE -D_XOPEN_SOURCE=600
CPPFLAGS += -D_GNU_SOURCE
WARNFLAGS ?= -pedantic -std=c99 -Wall -Wextra -Werror -Wshadow -Wformat=2
WARNFLAGS += -Wmissing-declarations -Wcomment -Wunused-macros -Wendif-labels
WARNFLAGS += -Wcast-qual -Wcast-align -Wconversion
CFLAGS += $(WARNFLAGS) -O2 -fPIC -DPIC

Use DESTDIR to install xbps, if defined.

# Common variables.

PREFIX	?= /usr/local
SBINDIR	?= $(DESTDIR)$(PREFIX)/sbin
LIBDIR	?= $(DESTDIR)$(PREFIX)/lib
ETCDIR	?= $(DESTDIR)$(PREFIX)/etc
TOPDIR	?= ..
INSTALL_STRIPPED ?= -s

LDFLAGS += -L$(TOPDIR)/lib -L$(PREFIX)/lib -lxbps
CPPFLAGS += -I$(TOPDIR)/include -D_BSD_SOURCE -D_XOPEN_SOURCE=600
CPPFLAGS += -D_GNU_SOURCE
WARNFLAGS ?= -pedantic -std=c99 -Wall -Wextra -Werror -Wshadow -Wformat=2
WARNFLAGS += -Wmissing-declarations -Wcomment -Wunused-macros -Wendif-labels
WARNFLAGS += -Wcast-qual -Wcast-align -Wconversion
CFLAGS += $(WARNFLAGS) -O2 -fPIC -DPIC


#/
# @license Apache-2.0
#
# Copyright (c) 2017 The Stdlib Authors.
#
# 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.
#/

# VARIABLES #

# Define the path of the executable:
LIST_PACKAGE_NAMESPACES ?= $(TOOLS_PKGS_DIR)/pkgs/namespaces/bin/cli

# Define the command flags:
LIST_PACKAGE_NAMESPACES_FLAGS ?=

# TARGETS #

# List all package namespaces.
#
# This target prints a list of all package namespaces.

list-pkgs-namespaces: $(LIST_PACKAGE_NAMESPACES) $(NODE_MODULES)
	$(QUIET) NODE_PATH="$(NODE_PATH)" $(NODE) $(LIST_PACKAGE_NAMESPACES) $(LIST_PACKAGE_NAMESPACES_FLAGS) $(SRC_DIR)

.PHONY: list-pkgs-namespaces

Update docs and support searching in a specified directory

#/
# @license Apache-2.0
#
# Copyright (c) 2017 The Stdlib Authors.
#
# 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.
#/

# VARIABLES #

# Define the path of the executable:
LIST_PACKAGE_NAMESPACES ?= $(TOOLS_PKGS_DIR)/pkgs/namespaces/bin/cli

# Define the command flags:
LIST_PACKAGE_NAMESPACES_FLAGS ?=

# Define the directory from which to search for namespaces:
LIST_PACKAGE_NAMESPACES_DIR ?= $(SRC_DIR)

# RULES #

#/
# Prints a list of all package namespaces.
#
# @example
# make list-pkgs-namespaces
#
# @example
# make list-pkgs-namespaces LIST_PACKAGE_NAMESPACES_DIR=$PWD/lib/node_modules/\@stdlib/utils
#/
list-pkgs-namespaces: $(LIST_PACKAGE_NAMESPACES) $(NODE_MODULES)
	$(QUIET) NODE_PATH="$(NODE_PATH)" $(NODE) $(LIST_PACKAGE_NAMESPACES) $(LIST_PACKAGE_NAMESPACES_FLAGS) $(LIST_PACKAGE_NAMESPACES_DIR)

.PHONY: list-pkgs-namespaces


#
# Copyright (C) 2008 The Android Open Source Project
# Copyright (C) 2015 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.
#

LOCAL_PATH := $(call my-dir)

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

Add flag to disable inclusion

#
# Copyright (C) 2008 The Android Open Source Project
# Copyright (C) 2015 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.
#

LOCAL_PATH := $(call my-dir)

ifeq ($(TARGET_USES_STAGEFRIGHT_PLUGINS),true)
include $(call first-makefiles-under,$(LOCAL_PATH))
endif


PWD = $(CURDIR)
OPTS = -DTHREADSAFE=ON -DBUILD_SHARED_LIBS=OFF \
       -DCMAKE_BUILD_TYPE=Release -DBUILD_CLAR=OFF
all:
	cmake build/libgit2 -G "Unix Makefiles" -B"$(OUT_DIR)" $(OPTS)
	make -C "$(OUT_DIR)" -j10

Build libgit2 with -fPIC and debug info

PWD = $(CURDIR)
OPTS = -DTHREADSAFE=ON -DBUILD_SHARED_LIBS=OFF \
       -DBUILD_CLAR=OFF -DCMAKE_C_FLAGS=-fPIC \
       -DCMAKE_BUILD_TYPE=RelWithDebInfo
all:
	cmake build/libgit2 -G "Unix Makefiles" -B"$(OUT_DIR)" $(OPTS)
	make -C "$(OUT_DIR)" -j10


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_CFLAGS := -D_POSIX_SOURCE

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)

Clean the _POSIX_C_SOURCE compilation flag

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)


# Copyright (C) 2011 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)

# Include all the java files.
LOCAL_SRC_FILES := $(call all-java-files-under, src)

# The name of the jar file to create.
LOCAL_MODULE := littlemock

# Build a static jar file.
include $(BUILD_STATIC_JAVA_LIBRARY)

Define SDK version for compiling LittleMock

# Copyright (C) 2011 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)

# Include all the java files.
LOCAL_SRC_FILES := $(call all-java-files-under, src)

LOCAL_SDK_VERSION := 14

# The name of the jar file to create.
LOCAL_MODULE := littlemock

# Build a static jar file.
include $(BUILD_STATIC_JAVA_LIBRARY)


HADDOCK_DOCS    = YES
SRC_CC_OPTS     = -Werror
SRC_HC_OPTS     = -Werror -H64m -Onot -fasm
GhcStage1HcOpts = -O -fasm
GhcStage2HcOpts = -Onot -fasm
GhcLibHcOpts    = -O -fasm
GhcLibWays      =
SplitObjs       = NO
NoFibWays       =
STRIP           = :
GhcBootLibs     = YES

Add -dcore-lint when validating libraries

HADDOCK_DOCS    = YES
SRC_CC_OPTS     = -Werror
SRC_HC_OPTS     = -Werror -H64m -Onot -fasm
GhcStage1HcOpts = -O -fasm
GhcStage2HcOpts = -Onot -fasm
GhcLibHcOpts    = -O -fasm -dcore-lint
GhcLibWays      =
SplitObjs       = NO
NoFibWays       =
STRIP           = :
GhcBootLibs     = YES


# Copyright 2007-2008 The Android Open Source Project

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

LOCAL_MODULE_TAGS := optional

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

LOCAL_PACKAGE_NAME := Mms

# Builds against the public SDK
#LOCAL_SDK_VERSION := current

LOCAL_STATIC_JAVA_LIBRARIES += android-common

LOCAL_REQUIRED_MODULES := SoundRecorder

LOCAL_PROGUARD_FLAGS := -include $(LOCAL_PATH)/proguard.flags

include $(BUILD_PACKAGE)

# This finds and builds the test apk as well, so a single make does both.
include $(call all-makefiles-under,$(LOCAL_PATH))

Fix proguard flag file dependency.

# Copyright 2007-2008 The Android Open Source Project

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

LOCAL_MODULE_TAGS := optional

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

LOCAL_PACKAGE_NAME := Mms

# Builds against the public SDK
#LOCAL_SDK_VERSION := current

LOCAL_STATIC_JAVA_LIBRARIES += android-common

LOCAL_REQUIRED_MODULES := SoundRecorder

LOCAL_PROGUARD_FLAG_FILES := proguard.flags

include $(BUILD_PACKAGE)

# This finds and builds the test apk as well, so a single make does both.
include $(call all-makefiles-under,$(LOCAL_PATH))


# Copyright (C) 2015 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 := SupportPercentDemos
LOCAL_MODULE_TAGS := samples
LOCAL_SDK_VERSION := current
LOCAL_SRC_FILES := $(call all-java-files-under, src)
LOCAL_STATIC_JAVA_LIBRARIES := \
        android-support-percent \
        android-support-v4 \
        android-support-v13
LOCAL_RESOURCE_DIR = \
        $(LOCAL_PATH)/res \
        frameworks/support/percent/res
LOCAL_AAPT_FLAGS := \
        --auto-add-overlay \
        --extra-packages android.support.percent
include $(BUILD_PACKAGE)

Fix up the makefiles and some samples.

# Copyright (C) 2015 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 := SupportPercentDemos
LOCAL_MODULE_TAGS := samples
LOCAL_SDK_VERSION := current
LOCAL_DEX_PREOPT := false
LOCAL_SRC_FILES := $(call all-java-files-under, src)
LOCAL_STATIC_JAVA_LIBRARIES := \
        android-support-percent \
        android-support-v4 \
        android-support-v13
LOCAL_RESOURCE_DIR = \
        $(LOCAL_PATH)/res \
        frameworks/support/percent/res
LOCAL_AAPT_FLAGS := \
        --auto-add-overlay \
        --extra-packages android.support.percent
include $(BUILD_PACKAGE)


ifeq ("$(HCLIB_ROOT)", "")
  $(error Please set teh HCLIB_ROOT environment variable.)
endif

PROJECT_CFLAGS=-I$(HCLIB_ROOT)/include $(shell xml2-config --cflags)
PROJECT_CXXFLAGS=-std=c++11 $(PROJECT_CFLAGS)
PROJECT_LDFLAGS=-L$(HCLIB_ROOT)/lib
PROJECT_LDLIBS=-lhclib -Wl,-rpath,$(HCLIB_ROOT)/lib $(shell xml2-config --libs)
ifdef TBB_MALLOC
  PROJECT_LDFLAGS+=-L$(TBB_MALLOC)
  PROJECT_LDLIBS+=-ltbbmalloc_proxy
endif
ifdef HC_CUDA_FLAGS
  PROJECT_LDFLAGS+=-L$(CUDA_HOME)/lib
  PROJECT_LDFLAGS+=-L$(CUDA_HOME)/lib64
  PROJECT_CFLAGS+=-I$(CUDA_HOME)/include
  PROJECT_LDLIBS+=-lcudart
  PROJECT_CFLAGS+=-DHC_CUDA
  PROJECT_CXXFLAGS+=-DHC_CUDA
endif

Add -std=c11 flag to default project CFLAGS

ifeq ("$(HCLIB_ROOT)", "")
  $(error Please set teh HCLIB_ROOT environment variable.)
endif

PROJECT_BASE_FLAGS := -I$(HCLIB_ROOT)/include $(shell xml2-config --cflags)
PROJECT_CFLAGS     := -std=c11 $(PROJECT_BASE_FLAGS)
PROJECT_CXXFLAGS   := -std=c++11 $(PROJECT_BASE_FLAGS)
PROJECT_LDFLAGS    := -L$(HCLIB_ROOT)/lib
PROJECT_LDLIBS     := -lhclib -Wl,-rpath,$(HCLIB_ROOT)/lib $(shell xml2-config --libs)
ifdef TBB_MALLOC
  PROJECT_LDFLAGS+=-L$(TBB_MALLOC)
  PROJECT_LDLIBS+=-ltbbmalloc_proxy
endif
ifdef HC_CUDA_FLAGS
  PROJECT_LDFLAGS+=-L$(CUDA_HOME)/lib
  PROJECT_LDFLAGS+=-L$(CUDA_HOME)/lib64
  PROJECT_CFLAGS+=-I$(CUDA_HOME)/include
  PROJECT_LDLIBS+=-lcudart
  PROJECT_CFLAGS+=-DHC_CUDA
  PROJECT_CXXFLAGS+=-DHC_CUDA
endif


compilers/nqp/nqp.pbc : $(PARROT) $(NQP_SOURCES) \
    $(LIBRARY_DIR)/PCT.pbc \
    $(LIBRARY_DIR)/PGE.pbc

compilers/nqp/src/Grammar_gen.pir : $(PARROT) $(LIBRARY_DIR)/PGE/Perl6Grammar.pir compilers/nqp/src/Grammar.pg $(LIBRARY_DIR)/PCT/HLLCompiler.pbc
	$(PARROT) $(LIBRARY_DIR)/PGE/Perl6Grammar.pir --output=$@ compilers/nqp/src/Grammar.pg

# Developer target to regnerate bootstrap. Unused?
nqp-boot: \
    compilers/nqp/bootstrap/nqp.pir \
    compilers/nqp/bootstrap/gen_actions.pir

compilers/nqp/bootstrap/gen_actions.pir : $(PARROT) \
    compilers/nqp/nqp.pbc \
    compilers/nqp/bootstrap/actions.pm
	$(PARROT) compilers/nqp/nqp.pbc --output=$@ --target=pir \
	    compilers/nqp/bootstrap/actions.pm

compilers/nqp/bootstrap/nqp.pbc : $(LIBRARY)/PCT.pbc

Add a missing dep, note that checkdepend.pl doesn't correctly detect this case yet.

compilers/nqp/nqp.pbc : $(PARROT) $(NQP_SOURCES) \
    $(LIBRARY_DIR)/PCT.pbc \
    $(LIBRARY_DIR)/PGE.pbc

compilers/nqp/src/Grammar_gen.pir : $(PARROT) $(LIBRARY_DIR)/PGE/Perl6Grammar.pir compilers/nqp/src/Grammar.pg $(LIBRARY_DIR)/PCT/HLLCompiler.pbc $(LIBRARY_DIR)/PGE.pbc
	$(PARROT) $(LIBRARY_DIR)/PGE/Perl6Grammar.pir --output=$@ compilers/nqp/src/Grammar.pg

# Developer target to regnerate bootstrap. Unused?
nqp-boot: \
    compilers/nqp/bootstrap/nqp.pir \
    compilers/nqp/bootstrap/gen_actions.pir

compilers/nqp/bootstrap/gen_actions.pir : $(PARROT) \
    compilers/nqp/nqp.pbc \
    compilers/nqp/bootstrap/actions.pm
	$(PARROT) compilers/nqp/nqp.pbc --output=$@ --target=pir \
	    compilers/nqp/bootstrap/actions.pm

compilers/nqp/bootstrap/nqp.pbc : $(LIBRARY)/PCT.pbc


# -*- makefile -*-
# Copyright 2016 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
# Minute-IA core build
#

# Select Minute-IA bare-metal toolchain
$(call set-option,CROSS_COMPILE,$(CROSS_COMPILE_i386),\
	/opt/coreboot-sdk/bin/i386-elf-)

# FPU compilation flags
CFLAGS_FPU-$(CONFIG_FPU)=

# CPU specific compilation flags
CFLAGS_CPU+=-O2 -fomit-frame-pointer -mno-accumulate-outgoing-args	\
	    -ffunction-sections -fdata-sections				\
	    -fno-builtin-printf -fno-builtin-sprintf			\
	    -fno-stack-protector -gdwarf-2  -fno-common -ffreestanding	\
	    -minline-all-stringops -fno-strict-aliasing

CFLAGS_CPU+=$(CFLAGS_FPU-y)

ifneq ($(CONFIG_LTO),)
CFLAGS_CPU+=-flto
LDFLAGS_EXTRA+=-flto
endif

core-y=cpu.o init.o interrupts.o
core-$(CONFIG_COMMON_PANIC_OUTPUT)+=panic.o
core-$(CONFIG_COMMON_RUNTIME)+=switch.o task.o
core-$(CONFIG_MPU)+=mpu.o

# for 64bit division
LDFLAGS_EXTRA+=-static-libgcc -lgcc

Disable flag when using clang

# -*- makefile -*-
# Copyright 2016 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
# Minute-IA core build
#

# Select Minute-IA bare-metal toolchain
$(call set-option,CROSS_COMPILE,$(CROSS_COMPILE_i386),\
	/opt/coreboot-sdk/bin/i386-elf-)

# FPU compilation flags
CFLAGS_FPU-$(CONFIG_FPU)=

# CPU specific compilation flags
CFLAGS_CPU+=-O2 -fomit-frame-pointer					\
	    -ffunction-sections -fdata-sections				\
	    -fno-builtin-printf -fno-builtin-sprintf			\
	    -fno-stack-protector -gdwarf-2  -fno-common -ffreestanding	\
	    -minline-all-stringops -fno-strict-aliasing
ifneq ($(cc-name),clang)
CFLAGS_CPU+=-mno-accumulate-outgoing-args
endif

CFLAGS_CPU+=$(CFLAGS_FPU-y)

ifneq ($(CONFIG_LTO),)
CFLAGS_CPU+=-flto
LDFLAGS_EXTRA+=-flto
endif

core-y=cpu.o init.o interrupts.o
core-$(CONFIG_COMMON_PANIC_OUTPUT)+=panic.o
core-$(CONFIG_COMMON_RUNTIME)+=switch.o task.o
core-$(CONFIG_MPU)+=mpu.o

# for 64bit division
LDFLAGS_EXTRA+=-static-libgcc -lgcc


#
# Copyright 2008 The Android Open Source Project
#
# Zip alignment tool
#

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

LOCAL_SRC_FILES := \
	ZipAlign.cpp \
	ZipEntry.cpp \
	ZipFile.cpp

LOCAL_C_INCLUDES += external/zlib

LOCAL_STATIC_LIBRARIES := \
	libutils \
	libcutils

LOCAL_LDLIBS := -lz

ifeq ($(HOST_OS),linux)
LOCAL_LDLIBS += -lrt
endif

# dunno if we need this, but some of the other tools include it
ifeq ($(HOST_OS),windows)
ifeq ($(strip $(USE_CYGWIN),),)
LOCAL_LDLIBS += -lws2_32
endif
endif

LOCAL_MODULE := zipalign

include $(BUILD_HOST_EXECUTABLE)

Make zipalign build for the Win SDK under Linux.

#
# Copyright 2008 The Android Open Source Project
#
# Zip alignment tool
#

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

LOCAL_SRC_FILES := \
	ZipAlign.cpp \
	ZipEntry.cpp \
	ZipFile.cpp

LOCAL_C_INCLUDES += external/zlib

LOCAL_STATIC_LIBRARIES := \
	libutils \
	libcutils

ifeq ($(HOST_OS),linux)
LOCAL_LDLIBS += -lrt
endif

ifneq ($(strip $(USE_MINGW)),)
LOCAL_STATIC_LIBRARIES += libz
else
LOCAL_LDLIBS += -lz
endif

LOCAL_MODULE := zipalign

include $(BUILD_HOST_EXECUTABLE)


# IBM_PROLOG_BEGIN_TAG
# This is an automatically generated prolog.
#
# $Source: src/import/chips/p9a/procedures/hwp/memory/p9a_mss_freq.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 L1 procedures for p9a and makefiles

# IBM_PROLOG_BEGIN_TAG
# This is an automatically generated prolog.
#
# $Source: src/import/chips/p9a/procedures/hwp/memory/p9a_mss_freq.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

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

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


ASM = nasm
CFLAGS += -Wno-deprecated-declarations -Werror -fPIC
LDFLAGS += -lpthread
ASMFLAGS += --prefix _ -DNOPREFIX
ifeq ($(ENABLE64BIT), Yes)
ASMFLAGS += -f macho64
else
ASMFLAGS += -f macho
endif

Define MACOS when building for OS X

ASM = nasm
CFLAGS += -Wno-deprecated-declarations -Werror -fPIC -DMACOS
LDFLAGS += -lpthread
ASMFLAGS += --prefix _ -DNOPREFIX
ifeq ($(ENABLE64BIT), Yes)
ASMFLAGS += -f macho64
else
ASMFLAGS += -f macho
endif


APP_PLATFORM=android-8
APP_ABI := armeabi-v7a
APP_STL := stlport_shared

Build native libraries for all platforms

APP_PLATFORM=android-8
APP_ABI := all
APP_STL := stlport_shared


SHELL := /usr/bin/env bash
TYPESCRIPT_SOURCE_FILES = $(shell find src test -type f -name "*.ts")

default: .tested .built
.PHONY: default

.deps: package-lock.json
	touch $@

.codegen:
	touch $@

.built: .deps .codegen $(TYPESCRIPT_SOURCE_FILES)
	npm run build
	touch $@

.tested: .deps .codegen $(TYPESCRIPT_SOURCE_FILES)
	TS_NODE_TRANSPILE_ONLY=1 npm run test
	touch $@

.linted: .deps .codegen $(TYPESCRIPT_SOURCE_FILES)
	npm run lint-fix
	touch $@

package-lock.json: package.json
	npm install
	touch $@

update-dependencies:
	npx npm-check-updates --upgrade

update-version:
ifdef NEW_VERSION
	npm --no-git-tag-version --allow-same-version version "$(NEW_VERSION)"
else
	@echo -e "\033[0;NEW_VERSION is not defined. Can't update version :-(\033[0m"
	exit 1
endif

publish:
	npm publish
.PHONY: publish

clean: clean-javascript
.PHONY: clean

clean-javascript:
	rm -rf .codegen .built .tested .linted package-lock.json node_modules coverage dist
.PHONY: clean-javascript

Remove Makefile duplication. Fix some target dependencies.

SHELL := /usr/bin/env bash
TYPESCRIPT_SOURCE_FILES = $(shell find src test -type f -name "*.ts")

default: .tested .built
.PHONY: default

.deps: package-lock.json
	touch $@

.codegen:
	touch $@

.built: .deps .codegen $(TYPESCRIPT_SOURCE_FILES)
	npm run build
	touch $@

.tested: .deps .codegen $(TYPESCRIPT_SOURCE_FILES)
	TS_NODE_TRANSPILE_ONLY=1 npm run test
	touch $@

.linted: .deps .codegen $(TYPESCRIPT_SOURCE_FILES)
	npm run lint-fix
	touch $@

package-lock.json: package.json
	npm install
	touch $@

update-dependencies:
	npx npm-check-updates --upgrade

update-version:
ifdef NEW_VERSION
	npm --no-git-tag-version --allow-same-version version "$(NEW_VERSION)"
else
	@echo -e "\033[0;NEW_VERSION is not defined. Can't update version :-(\033[0m"
	exit 1
endif
.PHONY: update-version

publish: .deps
	npm publish
.PHONY: publish

clean: clean-javascript
.PHONY: clean

clean-javascript:
	rm -rf .codegen .built .tested .linted package-lock.json node_modules coverage dist
.PHONY: clean-javascript


OPTS = -DTHREADSAFE=ON -DBUILD_SHARED_LIBS=OFF \
       -DBUILD_CLAR=OFF -DCMAKE_C_FLAGS=-fPIC \
       -DCMAKE_BUILD_TYPE=RelWithDebInfo -DBUILD_EXAMPLES=OFF
all:
	cmake build/libgit2 -G "Unix Makefiles" -B"$(OUT_DIR)" $(OPTS)
	make -C "$(OUT_DIR)" -j10

Fix cross compilation to 32-bit targets

ifneq ($(findstring i686,$(TARGET)),)
FLAGS=-m32
else
FLAGS=-m64
endif
OPTS = -DTHREADSAFE=ON -DBUILD_SHARED_LIBS=OFF \
       -DBUILD_CLAR=OFF \
       -DCMAKE_BUILD_TYPE=RelWithDebInfo -DBUILD_EXAMPLES=OFF \
       -DCMAKE_C_FLAGS="$(FLAGS) -fPIC"
all:
	cmake build/libgit2 -G "Unix Makefiles" -B"$(OUT_DIR)" $(OPTS)
	make -C "$(OUT_DIR)" -j10


#
# %CopyrightBegin%
#
# Copyright Ericsson AB 1997-2011. All Rights Reserved.
#
# The contents of this file are subject to the Erlang Public License,
# Version 1.1, (the "License"); you may not use this file except in
# compliance with the License. You should have received a copy of the
# Erlang Public License along with this software. If not, it can be
# retrieved online at http://www.erlang.org/.
#
# Software distributed under the License is distributed on an "AS IS"
# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
# the License for the specific language governing rights and limitations
# under the License.
#
# %CopyrightEnd%
#

VSN = 5.9
SYSTEM_VSN = R15A

# Port number 4365 in 4.2
# Port number 4366 in 4.3
# Port number 4368 in 4.4.0 - 4.6.2
# Port number 4369 in 4.6.3 -

ERLANG_DAEMON_PORT = 4369

Update system version to R15B

#
# %CopyrightBegin%
#
# Copyright Ericsson AB 1997-2011. All Rights Reserved.
#
# The contents of this file are subject to the Erlang Public License,
# Version 1.1, (the "License"); you may not use this file except in
# compliance with the License. You should have received a copy of the
# Erlang Public License along with this software. If not, it can be
# retrieved online at http://www.erlang.org/.
#
# Software distributed under the License is distributed on an "AS IS"
# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
# the License for the specific language governing rights and limitations
# under the License.
#
# %CopyrightEnd%
#

VSN = 5.9
SYSTEM_VSN = R15B

# Port number 4365 in 4.2
# Port number 4366 in 4.3
# Port number 4368 in 4.4.0 - 4.6.2
# Port number 4369 in 4.6.3 -

ERLANG_DAEMON_PORT = 4369


foo: audio_playback_request

sleeping_state: &sleeping_request $battery $idle
	$sleeping_state = prolog(set_sleeping_state, &sleeping_request, $batter, $idle)

cpu_frequency: sleeping_state &min_cpu_frequency &max_cpu_frequency $battery $temperature
	$cpu_frequency = set_cpu_frequency(&min_cpu_frequency, &max_cpu_frequency)

audio_route: $current_profile $privacy_override $connected $audio_active_policy_group
	$audio_route = prolog(set_routes)

audio_volume_limit: audio_route $active_policy_group $audio_active_policy_group
	$volume_limit = prolog(set_volume_limits)

audio_cork: audio_route $audio_active_policy_group
	$audio_cork = prolog(set_corks)

audio_playback: cpu_frequency audio_route volume_limit audio_cork $cpu_load &audio_playback_request
	prolog(cpu_frequency_check, min, 300)
	prolog(cpu_load_check, max, 40)
	$audio_playback = prolog(playback_request, &audio_playback_request.policy_group, &audio_playback_request.media)

audio_playback_request:
	dres(audio_playback, &audio_playback_request = play, &min_cpu_frequency = 300)

Split lines over 80 characters to multiple lines.

foo: audio_playback_request

sleeping_state: &sleeping_request $battery $idle
	$sleeping_state = prolog(set_sleeping_state, &sleeping_request, \
                                 $battery, $idle)

cpu_frequency: sleeping_state \
               &min_cpu_frequency &max_cpu_frequency $battery $temperature
	$cpu_frequency = set_cpu_frequency(&min_cpu_frequency, \
                                           &max_cpu_frequency)

audio_route: $current_profile $privacy_override $connected \
             $audio_active_policy_group
	$audio_route = prolog(set_routes)

audio_volume_limit: audio_route $active_policy_group $audio_active_policy_group
	$volume_limit = prolog(set_volume_limits)

audio_cork: audio_route $audio_active_policy_group
	$audio_cork = prolog(set_corks)

audio_playback: cpu_frequency audio_route audio_volume_limit audio_cork \
                $cpu_load &audio_playback_request
	prolog(cpu_frequency_check, min, 300)
	prolog(cpu_load_check, max, 40)
	$audio_playback = prolog(playback_request, \
                                 &audio_playback_request.policy_group, \
                                 &audio_playback_request.media)

audio_playback_request:
	dres(audio_playback, \
             &audio_playback_request = play, \
             &min_cpu_frequency = 300)


# IBM_PROLOG_BEGIN_TAG
# This is an automatically generated prolog.
#
# $Source: src/import/chips/p9/procedures/hwp/memory/p9_mss_freq_system.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_freq_system
$(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_freq_system.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_freq_system
$(eval $(call ADD_MEMORY_INCDIRS,$(PROCEDURE)))
$(call BUILD_PROCEDURE)


PLUGIN_VAPIS := \
	plugins/shotwell-spit-1.0.vapi \
	plugins/shotwell-transitions-1.0.vapi

PLUGIN_HEADERS := $(PLUGIN_VAPIS:.vapi=.h)
PLUGIN_DEPS := $(PLUGIN_VAPIS:.vapi=.deps)

$(PLUGIN_HEADERS): %.h: %.vapi

plugins/shotwell-spit-1.0.deps: plugins/shotwell-spit-1.0.vapi
	@echo "" > $@

plugins/shotwell-spit-1.0.vapi: src/plugins/SpitInterfaces.vala
	$(call check_valac_version)
	$(VALAC) -c $(VALAFLAGS) -X -I. --includedir=plugins --vapi=$@ --header=$(basename $@).h $<

plugins/shotwell-transitions-1.0.deps: plugins/shotwell-transitions-1.0.vapi
	@printf "gdk-2.0\nshotwell-spit-1.0\n" > $@

plugins/shotwell-transitions-1.0.vapi: src/plugins/TransitionsInterfaces.vala plugins/shotwell-spit-1.0.vapi
	$(call check_valac_version)
	$(VALAC) -c $(VALAFLAGS) -X -I. --pkg=gdk-2.0 --pkg=shotwell-spit-1.0 --includedir=plugins --vapi=$@ --header=$(basename $@).h $<

Build system now removes temp file leftover during VAPI creation.

PLUGIN_VAPIS := \
	plugins/shotwell-spit-1.0.vapi \
	plugins/shotwell-transitions-1.0.vapi

PLUGIN_HEADERS := $(PLUGIN_VAPIS:.vapi=.h)
PLUGIN_DEPS := $(PLUGIN_VAPIS:.vapi=.deps)

$(PLUGIN_HEADERS): %.h: %.vapi

plugins/shotwell-spit-1.0.deps: plugins/shotwell-spit-1.0.vapi
	@echo "" > $@

plugins/shotwell-spit-1.0.vapi: src/plugins/SpitInterfaces.vala
	$(call check_valac_version)
	$(VALAC) -c $(VALAFLAGS) -X -I. --includedir=plugins --vapi=$@ --header=$(basename $@).h $<
	rm $(notdir $<).o

plugins/shotwell-transitions-1.0.deps: plugins/shotwell-transitions-1.0.vapi
	@printf "gdk-2.0\nshotwell-spit-1.0\n" > $@

plugins/shotwell-transitions-1.0.vapi: src/plugins/TransitionsInterfaces.vala plugins/shotwell-spit-1.0.vapi
	$(call check_valac_version)
	$(VALAC) -c $(VALAFLAGS) -X -I. --pkg=gdk-2.0 --pkg=shotwell-spit-1.0 --includedir=plugins --vapi=$@ --header=$(basename $@).h $<
	rm $(notdir $<).o


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 grep '^\s*version' $(SELF_DIR)/build.sbt | sed -e 's/.*"\(.*\)".*/\1/')
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 `git describe` to get version number

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


include platforms/rocket_v0.1/platform.mk
include platforms/ch.mk

# Include directory for unit_config.hpp
CONFINC += units/hera

hera: all

Convert hera to aerial_v3 for now.

include platforms/aerial_v3/platform.mk
include platforms/ch.mk

# Include directory for unit_config.hpp
CONFINC += units/hera

hera: all


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

ifeq "$(Windows)" "YES"
utils/haddock_dist_PROG = haddock
else
utils/haddock_dist_PROG = haddock-real

$(INPLACE_BIN)/haddock: $(INPLACE_BIN)/haddock-real
	$(RM) -f $@
	echo '#!$(SHELL)' >> $@
	echo 'executablename=$(FPTOOLS_TOP_ABS)/$<' >> $@
	echo 'datadir=$(FPTOOLS_TOP_ABS)/inplace/lib' >> $@
	cat utils/haddock/haddock.wrapper >> $@
	$(EXECUTABLE_FILE) $@
endif

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

utils/haddock_dist_MODULES += Paths_haddock

Create inplace/lib/html in the new GHC build system

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

ifeq "$(Windows)" "YES"
utils/haddock_dist_PROG = haddock
else
utils/haddock_dist_PROG = haddock-real

$(INPLACE_BIN)/haddock: $(INPLACE_BIN)/haddock-real
	$(RM) -f $@
	echo '#!$(SHELL)' >> $@
	echo 'executablename=$(FPTOOLS_TOP_ABS)/$<' >> $@
	echo 'datadir=$(FPTOOLS_TOP_ABS)/inplace/lib' >> $@
	cat utils/haddock/haddock.wrapper >> $@
	$(EXECUTABLE_FILE) $@
endif

$(INPLACE_BIN)/$(utils/haddock_dist_PROG): inplace/lib/html

inplace/lib/html:
	$(RM) -rf $@
	cp -a utils/haddock/html $@

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

utils/haddock_dist_MODULES += Paths_haddock


# see http://mobile.tutsplus.com/tutorials/android/ndk-tutorial/

LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_LDLIBS := -llog
LOCAL_MODULE    := sqlc-native-driver
LOCAL_C_INCLUDES := $(LOCAL_PATH)/../sqlite-amalgamation
LOCAL_CFLAGS += -DSQLITE_TEMP_STORE=2 -DSQLITE_ENABLE_FTS3 -DSQLITE_ENABLE_FTS3_PARENTHESIS -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_RTREE
LOCAL_SRC_FILES := ../native/sqlc_all.c
include $(BUILD_SHARED_LIBRARY)

Set default threading to 'Multi-threaded'

# see http://mobile.tutsplus.com/tutorials/android/ndk-tutorial/

LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_LDLIBS := -llog
LOCAL_MODULE    := sqlc-native-driver
LOCAL_C_INCLUDES := $(LOCAL_PATH)/../sqlite-amalgamation
LOCAL_CFLAGS += -DSQLITE_TEMP_STORE=2 -DSQLITE_THREADSAFE=2
LOCAL_CFLAGS += -DSQLITE_ENABLE_FTS3 -DSQLITE_ENABLE_FTS3_PARENTHESIS -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_RTREE
LOCAL_SRC_FILES := ../native/sqlc_all.c
include $(BUILD_SHARED_LIBRARY)


# Copyright (C) 2008 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)

# Apicheck is now part of Doclava -- See external/doclava.

Fix for building apicheck tool

# Copyright (C) 2007-2008 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)

# We use copy-file-to-new-target so that the installed
# script file's timestamp is at least as new as the
# .jar file it wraps.

#TODO(dbort): add a template to do this stuff; share with jx

# the hat script
# ============================================================
include $(CLEAR_VARS)
LOCAL_IS_HOST_MODULE := true
LOCAL_MODULE_CLASS := EXECUTABLES
LOCAL_MODULE := apicheck

include $(BUILD_SYSTEM)/base_rules.mk

$(LOCAL_BUILT_MODULE): $(HOST_OUT_JAVA_LIBRARIES)/doclava$(COMMON_JAVA_PACKAGE_SUFFIX)
$(LOCAL_BUILT_MODULE): $(LOCAL_PATH)/etc/apicheck | $(ACP)
	@echo "Copy: $(PRIVATE_MODULE) ($@)"
	$(copy-file-to-new-target)
	$(hide) chmod 755 $@

# Apicheck is now part of Doclava -- See external/doclava.


# Utility function for recursively finding files, e.g.
# ‘$(call rwildcard, path/to/dir, *.c *.h)’.
rwildcard=$(foreach d,$(wildcard $1*),$(call rwildcard,$d/,$2) $(filter $(subst *,%,$2),$d))

# Given a file name, produce the corresponding dependency file
# (e.g. ‘foo/bar.o’ becomes ‘foo/.bar.o.dep’).
filename-to-dep = $(dir $1).$(notdir $1).dep

Add a function for looking up programs in $PATH

# Utility function for recursively finding files, e.g.
# ‘$(call rwildcard, path/to/dir, *.c *.h)’.
rwildcard=$(foreach d,$(wildcard $1*),$(call rwildcard,$d/,$2) $(filter $(subst *,%,$2),$d))

# Given a file name, produce the corresponding dependency file
# (e.g. ‘foo/bar.o’ becomes ‘foo/.bar.o.dep’).
filename-to-dep = $(dir $1).$(notdir $1).dep

# Return the full path to a program by looking it up in $PATH, or the
# empty string if not found.
find-program = $(shell for i in $$(IFS=: ; echo $$PATH); do p=$$i/$(strip $1); if [ -e $$p ]; then echo $$p; break; fi; done)


LOCAL_DIR := $(GET_LOCAL_DIR)

ARCH    := arm
ARM_CPU := cortex-a8
CPU     := generic

DEFINES += ARM_CPU_CORE_KRAIT

MMC_SLOT         := 1

DEFINES += PERIPH_BLK_BLSP=1
DEFINES += WITH_CPU_EARLY_INIT=0 WITH_CPU_WARM_BOOT=0 \
	   MMC_SLOT=$(MMC_SLOT)

INCLUDES += -I$(LOCAL_DIR)/include -I$(LK_TOP_DIR)/platform/msm_shared/include

DEVS += fbcon
MODULES += dev/fbcon

OBJS += \
	$(LOCAL_DIR)/platform.o \
	$(LOCAL_DIR)/acpuclock.o \
	$(LOCAL_DIR)/msm8974-clock.o \
	$(LOCAL_DIR)/gpio.o

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

include platform/msm_shared/rules.mk

Add Support to enable/disable SSD feature

LOCAL_DIR := $(GET_LOCAL_DIR)

ARCH    := arm
ARM_CPU := cortex-a8
CPU     := generic

DEFINES += ARM_CPU_CORE_KRAIT

MMC_SLOT         := 1

DEFINES += PERIPH_BLK_BLSP=1
DEFINES += WITH_CPU_EARLY_INIT=0 WITH_CPU_WARM_BOOT=0 \
	   MMC_SLOT=$(MMC_SLOT) SSD_ENABLE

INCLUDES += -I$(LOCAL_DIR)/include -I$(LK_TOP_DIR)/platform/msm_shared/include

DEVS += fbcon
MODULES += dev/fbcon

OBJS += \
	$(LOCAL_DIR)/platform.o \
	$(LOCAL_DIR)/acpuclock.o \
	$(LOCAL_DIR)/msm8974-clock.o \
	$(LOCAL_DIR)/gpio.o

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

include platform/msm_shared/rules.mk


CXXFLAGS_$(d) += \
    -I$(SOURCE_ROOT)/extern/fmtlib/fmt/include \
    -DFMT_HEADER_ONLY \
    -Wno-strict-overflow

Fix compilation of {fmt} with GCC 12

CXXFLAGS_$(d) += \
    -I$(SOURCE_ROOT)/extern/fmtlib/fmt/include \
    -DFMT_HEADER_ONLY \
    -Wno-inline \
    -Wno-strict-overflow


srcs-y += memchr.c
cflags-remove-memchr.c-y += -Wcast-align
cflags-memchr.c-y += -Wno-sign-compare

srcs-y += memcmp.c
cflags-remove-memcmp.c-y += -Wcast-align

srcs-y += memcpy.c
cflags-remove-memcpy.c-y += -Wcast-align

srcs-y += memmove.c
cflags-remove-memmove.c-y += -Wcast-align

srcs-y += memset.c
cflags-remove-memset.c-y += -Wcast-align
cflags-memset.c-y += -Wno-sign-compare

srcs-y += strcmp.c
cflags-remove-strcmp.c-y += -Wcast-align

srcs-y += strncmp.c
cflags-remove-strncmp.c-y += -Wcast-align

srcs-y += strlen.c
cflags-remove-strlen.c-y += -Wcast-align

srcs-y += strnlen.c

srcs-y += abs.c

Add -ffreestanding to newlib files

srcs-y += memchr.c
cflags-remove-memchr.c-y += -Wcast-align
cflags-memchr.c-y += -Wno-sign-compare

srcs-y += memcmp.c
cflags-remove-memcmp.c-y += -Wcast-align

srcs-y += memcpy.c
cflags-remove-memcpy.c-y += -Wcast-align

srcs-y += memmove.c
cflags-remove-memmove.c-y += -Wcast-align

srcs-y += memset.c
cflags-remove-memset.c-y += -Wcast-align
cflags-memset.c-y += -Wno-sign-compare

srcs-y += strcmp.c
cflags-remove-strcmp.c-y += -Wcast-align

srcs-y += strncmp.c
cflags-remove-strncmp.c-y += -Wcast-align

srcs-y += strlen.c
cflags-remove-strlen.c-y += -Wcast-align

srcs-y += strnlen.c

srcs-y += abs.c

cflags-y += -ffreestanding


# -*- mode:make; tab-width:2; -*-

include $(HEADER)

NAME     := vincenty
VERSION  := 1.0.0
RELEASE  := 1
REQUIRES :=
$(call setup_requires)

TARGETS := libvincenty.so

_CXXFLAGS := -march=native

libvincenty.so_SRCS := $(call getsource,src,*.cpp)

include $(FOOTER)

Remove explicit assignment for source files

# -*- mode:make; tab-width:2; -*-

include $(HEADER)

NAME     := vincenty
VERSION  := 1.0.0
RELEASE  := 1
REQUIRES :=
$(call setup_requires)

_CXXFLAGS := -march=native

TARGETS := libvincenty.so

include $(FOOTER)


# -*- mode:make; tab-width:2; -*-

include $(HEADER)

NAME     := vincenty
VERSION  := 1.0.0
RELEASE  := 1
REQUIRES :=
$(call setup_requires)

_CXXFLAGS := -march=native

TARGETS := libvincenty.so

include $(FOOTER)

Use new style setup macro

# -*- mode:make; tab-width:2; -*-

include $(HEADER)

NAME     := vincenty
VERSION  := 1.0.0
RELEASE  := 1
REQUIRES := # Nothing
$(call setup)

_CXXFLAGS := -march=native

TARGETS := libvincenty.so

include $(FOOTER)


LOCAL_PATH := $(call my-dir)

common_cflags := \
	-DANDROID \
	-DHAVE_CONFIG_H

include $(CLEAR_VARS)
LOCAL_C_INCLUDES := \
	$(LOCAL_PATH) \
	$(LOCAL_PATH)/src \
	$(LOCAL_PATH)/../pcsc-lite-1.8.6/src/PCSC \
	$(LOCAL_PATH)/../pcsc-lite-1.8.6/src/ \
	$(LOCAL_PATH)/../libusb-1.0.3/libusb \
	$(LOCAL_PATH)/../libusb-1.0.3/libusb/os

LOCAL_SRC_FILES:= \
	src/ccid.c \
        src/commands.c \
        src/ifdhandler.c \
        src/utils.c \
        src/ccid_usb.c \
        src/towitoko/atr.c \
        src/towitoko/pps.c \
        src/openct/buffer.c \
        src/openct/checksum.c \
        src/openct/proto-t1.c \
        src/tokenparser.c \
        src/strlcpy.c \
        src/debug.c \

LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/

LOCAL_MODULE_TAGS = eng
LOCAL_MODULE:= libccid
LOCAL_SHARED_LIBRARIES := libc libdl libpcsclite
LOCAL_STATIC_LIBRARIES := libusb
LOCAL_PRELINK_MODULE := false
include $(BUILD_SHARED_LIBRARY)

Add missing simclist to mk file

LOCAL_PATH := $(call my-dir)

common_cflags := \
	-DANDROID \
	-DHAVE_CONFIG_H

include $(CLEAR_VARS)
LOCAL_C_INCLUDES := \
	$(LOCAL_PATH) \
	$(LOCAL_PATH)/src \
	$(LOCAL_PATH)/../pcsc-lite-1.8.6/src/PCSC \
	$(LOCAL_PATH)/../pcsc-lite-1.8.6/src/ \
	$(LOCAL_PATH)/../libusb-1.0.3/libusb \
	$(LOCAL_PATH)/../libusb-1.0.3/libusb/os

LOCAL_SRC_FILES:= \
	src/ccid.c \
        src/commands.c \
        src/ifdhandler.c \
        src/utils.c \
        src/ccid_usb.c \
        src/towitoko/atr.c \
        src/towitoko/pps.c \
        src/openct/buffer.c \
        src/openct/checksum.c \
        src/openct/proto-t1.c \
        src/tokenparser.c \
        src/strlcpy.c \
        src/simclist.c \
        src/debug.c

LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/

LOCAL_MODULE_TAGS = eng
LOCAL_MODULE:= libccid
LOCAL_SHARED_LIBRARIES := libc libdl libpcsclite
LOCAL_STATIC_LIBRARIES := libusb
LOCAL_PRELINK_MODULE := false
include $(BUILD_SHARED_LIBRARY)


DIST ?= jessie
REPOSITORIES ?= Debian Bluefalls
DIST_ARCH ?= armhf
ARCH ?= 0
UNAME ?= pi
UPASS ?= pi
RPASS ?= pi
LOCALE ?= en_US.UTF-8
IMAGE_MB ?= -1
BOOT_MB ?= 38

REPOBASE := Debian

ifeq ($(ARCH),0)
	ifeq ($(DIST_ARCH),armel)
		ARCH := rpi
	else ifeq ($(DIST_ARCH),arm64)
		ARCH := rpi3
	else
		ARCH := rpi2
	endif
	REPOBASE := Bluefalls
endif

ifeq ($(findstring Debian,$(REPOSITORIES)),)
	REPOS := Debian $(REPOSITORIES)
else
	REPOS := $(REPOSITORIES)
endif

ifeq ($(findstring Raspbian,$(REPOSITORIES)),Raspbian)
	REPOS := Foundation Raspbian
	DIST_ARCH := armhf
	REPOBASE := Raspbian
	ARCH := Raspbian
endif

ifeq ($(shell test $(BOOT_MB) -lt 38; echo $$?),0)
	BOOT_MB := 38
endif
ifeq ($(IMAGE_MB),-1)
	ROOT_MB := -1
else
	ROOT_MB := $(shell expr $(IMAGE_MB) - $(BOOT_MB))
endif

ROOT_DEV := /dev/mmcblk0p2
BOOT_DIR := boot
ROOTFS_DIR := rootfs
IMAGE_FILE := $(DIST)-$(ARCH).img

Add repobase name to image file name

DIST ?= jessie
REPOSITORIES ?= Debian Bluefalls
DIST_ARCH ?= armhf
ARCH ?= 0
UNAME ?= pi
UPASS ?= pi
RPASS ?= pi
LOCALE ?= en_US.UTF-8
IMAGE_MB ?= -1
BOOT_MB ?= 38

REPOBASE := Debian

ifeq ($(ARCH),0)
	ifeq ($(DIST_ARCH),armel)
		ARCH := rpi
	else ifeq ($(DIST_ARCH),arm64)
		ARCH := rpi3
	else
		ARCH := rpi2
	endif
	REPOBASE := Bluefalls
endif

ifeq ($(findstring Debian,$(REPOSITORIES)),)
	REPOS := Debian $(REPOSITORIES)
else
	REPOS := $(REPOSITORIES)
endif

ifeq ($(findstring Raspbian,$(REPOSITORIES)),Raspbian)
	REPOS := Foundation Raspbian
	DIST_ARCH := armhf
	REPOBASE := Raspbian
	ARCH := Raspbian
endif

ifeq ($(shell test $(BOOT_MB) -lt 38; echo $$?),0)
	BOOT_MB := 38
endif
ifeq ($(IMAGE_MB),-1)
	ROOT_MB := -1
else
	ROOT_MB := $(shell expr $(IMAGE_MB) - $(BOOT_MB))
endif

ROOT_DEV := /dev/mmcblk0p2
BOOT_DIR := boot
ROOTFS_DIR := rootfs
IMAGE_FILE := $(REPOBASE)-$(DIST)-$(ARCH).img


# slock version
VERSION = 1.2

# Customize below to fit your system

# paths
PREFIX = /usr/local

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

# includes and libs
INCS = -I. -I/usr/include -I${X11INC}
LIBS = -L/usr/lib -lc -lcrypt -L${X11LIB} -lX11 -lXext

# flags
CPPFLAGS = -DVERSION=\"${VERSION}\" -DHAVE_SHADOW_H -DCOLOR1=\"black\" -DCOLOR2=\"\#005577\" -DCOLOR3=\"\#550000\"
CFLAGS = -std=c99 -pedantic -Wall -Os ${INCS} ${CPPFLAGS}
LDFLAGS = -s ${LIBS}

# On *BSD remove -DHAVE_SHADOW_H from CPPFLAGS and add -DHAVE_BSD_AUTH
# On OpenBSD and Darwin remove -lcrypt from LIBS

# compiler and linker
CC = cc

# Install mode. On BSD systems MODE=2755 and GROUP=auth
# On others MODE=4755 and GROUP=root
#MODE=2755
#GROUP=auth

Make running slock distinguishable from switched off display

# slock version
VERSION = 1.2

# Customize below to fit your system

# paths
PREFIX = /usr/local

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

# includes and libs
INCS = -I. -I/usr/include -I${X11INC}
LIBS = -L/usr/lib -lc -lcrypt -L${X11LIB} -lX11 -lXext

# flags
CPPFLAGS = -DVERSION=\"${VERSION}\" -DHAVE_SHADOW_H -DCOLOR1=\"\#888a85\" -DCOLOR2=\"\#babdb6\" -DCOLOR3=\"\#a40000\"
CFLAGS = -std=c99 -pedantic -Wall -Os ${INCS} ${CPPFLAGS}
LDFLAGS = -s ${LIBS}

# On *BSD remove -DHAVE_SHADOW_H from CPPFLAGS and add -DHAVE_BSD_AUTH
# On OpenBSD and Darwin remove -lcrypt from LIBS

# compiler and linker
CC = cc

# Install mode. On BSD systems MODE=2755 and GROUP=auth
# On others MODE=4755 and GROUP=root
#MODE=2755
#GROUP=auth


# NMake Makefile to build Introspection Files for GtkSourceView

!include detectenv-msvc.mak

APIVERSION = 4

CHECK_PACKAGE = gtk+-4.0

built_install_girs = GtkSource-$(APIVERSION).gir
built_install_typelibs = GtkSource-$(APIVERSION).typelib

!include introspection-msvc.mak

!if "$(BUILD_INTROSPECTION)" == "TRUE"
all: setgirbuildenv $(built_install_girs) $(built_install_typelibs)

setgirbuildenv:
	@set PYTHONPATH=$(PREFIX)\lib\gobject-introspection
	@set PATH=vs$(VSVER)\$(CFG)\$(PLAT)\bin;$(PREFIX)\bin;$(PATH)
	@set PKG_CONFIG_PATH=$(PKG_CONFIG_PATH)
	@set LIB=vs$(VSVER)\$(CFG)\$(PLAT)\bin;$(LIB)

!include introspection.body.mak

install-introspection: setgirbuildenv $(built_install_girs) $(built_install_typelibs)
	@-copy *.gir $(G_IR_INCLUDEDIR)
	@-copy /b *.typelib $(G_IR_TYPELIBDIR)

!else
all:
	@-echo $(ERROR_MSG)
!endif

clean:
	@-del /f/q *.typelib
	@-del /f/q *.gir

Fix introspection on Visual Studio

# NMake Makefile to build Introspection Files for GtkSourceView

!include detectenv-msvc.mak

APIVERSION = 4

CHECK_PACKAGE = gtk+-3.0

built_install_girs = GtkSource-$(APIVERSION).gir
built_install_typelibs = GtkSource-$(APIVERSION).typelib

!include introspection-msvc.mak

!if "$(BUILD_INTROSPECTION)" == "TRUE"
all: setgirbuildenv $(built_install_girs) $(built_install_typelibs)

setgirbuildenv:
	@set PYTHONPATH=$(PREFIX)\lib\gobject-introspection
	@set PATH=vs$(VSVER)\$(CFG)\$(PLAT)\bin;$(PREFIX)\bin;$(PATH)
	@set PKG_CONFIG_PATH=$(PKG_CONFIG_PATH)
	@set LIB=vs$(VSVER)\$(CFG)\$(PLAT)\bin;$(LIB)

!include introspection.body.mak

install-introspection: setgirbuildenv $(built_install_girs) $(built_install_typelibs)
	@-copy *.gir $(G_IR_INCLUDEDIR)
	@-copy /b *.typelib $(G_IR_TYPELIBDIR)

!else
all:
	@-echo $(ERROR_MSG)
!endif

clean:
	@-del /f/q *.typelib
	@-del /f/q *.gir


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

LOCAL_ARM_MODE := arm

LOCAL_SRC_FILES := \
    src/dump.c \
    src/error.c \
    src/hashtable.c \
    src/hashtable_seed.c \
    src/load.c \
    src/memory.c \
    src/pack_unpack.c \
    src/strbuffer.c \
    src/strconv.c \
    src/utf.c \
    src/value.c

LOCAL_C_INCLUDES += \
        $(LOCAL_PATH) \
        $(LOCAL_PATH)/android \
        $(LOCAL_PATH)/src

LOCAL_EXPORT_C_INCLUDES := $(LOCAL_C_INCLUDES)

LOCAL_MODULE_TAGS := optional
LOCAL_SHARED_LIBRARIES := libc
LOCAL_CFLAGS += -O3 -DHAVE_STDINT_H

LOCAL_MODULE:= libjansson

include $(BUILD_SHARED_LIBRARY)

Build static lib instead of shared

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

LOCAL_ARM_MODE := arm

LOCAL_SRC_FILES := \
    src/dump.c \
    src/error.c \
    src/hashtable.c \
    src/hashtable_seed.c \
    src/load.c \
    src/memory.c \
    src/pack_unpack.c \
    src/strbuffer.c \
    src/strconv.c \
    src/utf.c \
    src/value.c

LOCAL_C_INCLUDES += \
        $(LOCAL_PATH) \
        $(LOCAL_PATH)/android \
        $(LOCAL_PATH)/src

LOCAL_EXPORT_C_INCLUDES := $(LOCAL_C_INCLUDES)

LOCAL_MODULE_TAGS := optional
LOCAL_SHARED_LIBRARIES := libc
LOCAL_CFLAGS += -O3 -DHAVE_STDINT_H

LOCAL_MODULE:= libjansson

include $(BUILD_STATIC_LIBRARY)


ROOT_PATH := $(call my-dir)
include $(ROOT_PATH)/breakpad/android/google_breakpad/Android.mk

LOCAL_PATH := $(ROOT_PATH)
include $(CLEAR_VARS)

LOCAL_MODULE    := countly_native
LOCAL_SRC_FILES := countly_breakpad.cpp
LOCAL_LDLIBS := -llog
LOCAL_STATIC_LIBRARIES += breakpad_client

include $(BUILD_SHARED_LIBRARY)

Use LOCAL_MODULE_FILENAME to prevent NDK full rebuild everytime.

ROOT_PATH := $(call my-dir)
include $(ROOT_PATH)/breakpad/android/google_breakpad/Android.mk

LOCAL_PATH := $(ROOT_PATH)
include $(CLEAR_VARS)

LOCAL_MODULE    := breakpad
LOCAL_MODULE_FILENAME := countly_native
LOCAL_SRC_FILES := countly_breakpad.cpp
LOCAL_LDLIBS := -llog
LOCAL_STATIC_LIBRARIES += breakpad_client

include $(BUILD_SHARED_LIBRARY)


#
# Copyright (C) 2008 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.
#

#
# Defines branch-specific values.
#

# BUILD_ID is usually used to specify the branch name
# (like "MAIN") or a branch name and a release candidate
# (like "TC1-RC5").  It must be a single word, and is
# capitalized by convention.
#
BUILD_ID := MASTER

# DISPLAY_BUILD_NUMBER should only be set for development branches,
# If set, the BUILD_NUMBER (cl) is appended to the BUILD_ID for
# a more descriptive BUILD_ID_DISPLAY, otherwise BUILD_ID_DISPLAY
# is the same as BUILD_ID
DISPLAY_BUILD_NUMBER := true

Set default build ID to eclair (usually this is overridden). Please do not merge.

#
# Copyright (C) 2008 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.
#

#
# Defines branch-specific values.
#

# BUILD_ID is usually used to specify the branch name
# (like "MAIN") or a branch name and a release candidate
# (like "TC1-RC5").  It must be a single word, and is
# capitalized by convention.
#
BUILD_ID := ECLAIR

# DISPLAY_BUILD_NUMBER should only be set for development branches,
# If set, the BUILD_NUMBER (cl) is appended to the BUILD_ID for
# a more descriptive BUILD_ID_DISPLAY, otherwise BUILD_ID_DISPLAY
# is the same as BUILD_ID
DISPLAY_BUILD_NUMBER := true


# mimasv2 loading

TARGET ?= base
# FIXME(mithro): Detect the real serial port/add see udev rules to HDMI2USB-mode-switch...
PORT ?= /dev/ttyACM0

gateware-load-mimasv2:
	python3 $$(which MimasV2Config.py) $(PORT) $(TARGET_BUILD_DIR)/gateware/top.bin

image-load-mimasv2:
	python mkimage.py
	python3 $$(which MimasV2Config.py) $(PORT) $(TARGET_BUILD_DIR)/flash.bin

firmware-load-mimasv2:
	flterm --port=$(PORT) --kernel=$(TARGET_BUILD_DIR)/software/firmware/firmware.bin --speed=19200

firmware-connect-mimasv2:
	flterm --port=$(PORT) --speed=19200

.PHONY: gateware-load-mimasv2 firmware-load-mimasv2

Make BAUD a variable too

# mimasv2 loading

TARGET ?= base
# FIXME(mithro): Detect the real serial port/add see udev rules to HDMI2USB-mode-switch...
PORT ?= /dev/ttyACM0
BAUD ?= 19200

gateware-load-mimasv2:
	python3 $$(which MimasV2Config.py) $(PORT) $(TARGET_BUILD_DIR)/gateware/top.bin

image-load-mimasv2:
	python mkimage.py
	python3 $$(which MimasV2Config.py) $(PORT) $(TARGET_BUILD_DIR)/flash.bin

firmware-load-mimasv2:
	flterm --port=$(PORT) --kernel=$(TARGET_BUILD_DIR)/software/firmware/firmware.bin --speed=$(BAUD)

firmware-connect-mimasv2:
	flterm --port=$(PORT) --speed=$(BAUD)

.PHONY: gateware-load-mimasv2 firmware-load-mimasv2


# swc: protocol/local.mk

dir := protocol

PROTOCOL_EXTENSIONS =           \
    $(dir)/swc.xml              \
    $(dir)/wayland-drm.xml

$(dir)_TARGETS := $(PROTOCOL_EXTENSIONS:%.xml=%-protocol.c) \
                  $(PROTOCOL_EXTENSIONS:%.xml=%-server-protocol.h)

$(dir)/%-protocol.c: $(dir)/%.xml
	$(call quiet,GEN,$(WAYLAND_SCANNER)) code < $< > $@

$(dir)/%-server-protocol.h: $(dir)/%.xml
	$(call quiet,GEN,$(WAYLAND_SCANNER)) server-header < $< > $@

install-protocol: | $(DESTDIR)$(DATADIR)/swc
	install -m0644 protocol/swc.xml "$(DESTDIR)$(DATADIR)/swc"

include common.mk

Add missing wayland-server CFLAGS for protocol/*-protocol.o

# swc: protocol/local.mk

dir := protocol

PROTOCOL_EXTENSIONS =           \
    $(dir)/swc.xml              \
    $(dir)/wayland-drm.xml

$(dir)_TARGETS := $(PROTOCOL_EXTENSIONS:%.xml=%-protocol.c) \
                  $(PROTOCOL_EXTENSIONS:%.xml=%-server-protocol.h)
$(dir)_PACKAGES := wayland-server

$(dir)/%-protocol.c: $(dir)/%.xml
	$(call quiet,GEN,$(WAYLAND_SCANNER)) code < $< > $@

$(dir)/%-server-protocol.h: $(dir)/%.xml
	$(call quiet,GEN,$(WAYLAND_SCANNER)) server-header < $< > $@

install-protocol: | $(DESTDIR)$(DATADIR)/swc
	install -m0644 protocol/swc.xml "$(DESTDIR)$(DATADIR)/swc"

include common.mk


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

LOCAL_SRC_FILES:= \
        BlitRowTest.cpp \
        GeometryTest.cpp \
        MathTest.cpp \
        MatrixTest.cpp \
        PackBitsTest.cpp \
        Sk64Test.cpp \
        StringTest.cpp \
        Test.cpp UtilsTest.cpp \
        PathTest.cpp \
        SrcOverTest.cpp \
        StreamTest.cpp \
        SortTest.cpp \
        PathMeasureTest.cpp

# The name of the file with a main function must
# match native test's naming rule: xxx_test.cpp.
LOCAL_SRC_FILES += \
        skia_test.cpp

LOCAL_MODULE:= skia_test

LOCAL_C_INCLUDES := \
        external/skia/include/core \
        external/skia/include/effects \
        external/skia/include/images \
        external/skia/include/ports \
        external/skia/include/utils \
        external/skia/src/core

LOCAL_SHARED_LIBRARIES := \
        libskia

LOCAL_MODULE_TAGS := eng tests

include $(BUILD_EXECUTABLE)

Add missing library in command line to the linker. Currently this library is included implicitly via inter-library dependency. The library is also used by the main executable.

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

LOCAL_SRC_FILES:= \
        BlitRowTest.cpp \
        GeometryTest.cpp \
        MathTest.cpp \
        MatrixTest.cpp \
        PackBitsTest.cpp \
        Sk64Test.cpp \
        StringTest.cpp \
        Test.cpp UtilsTest.cpp \
        PathTest.cpp \
        SrcOverTest.cpp \
        StreamTest.cpp \
        SortTest.cpp \
        PathMeasureTest.cpp

# The name of the file with a main function must
# match native test's naming rule: xxx_test.cpp.
LOCAL_SRC_FILES += \
        skia_test.cpp

LOCAL_MODULE:= skia_test

LOCAL_C_INCLUDES := \
        external/skia/include/core \
        external/skia/include/effects \
        external/skia/include/images \
        external/skia/include/ports \
        external/skia/include/utils \
        external/skia/src/core

LOCAL_SHARED_LIBRARIES := \
        libskia libcutils

LOCAL_MODULE_TAGS := eng tests

include $(BUILD_EXECUTABLE)


#HC=/tmp/ghc/bin/ghc
HC=ghc
setup: Setup.lhs
	$(HC) -cpp --make -i../.. Setup.lhs -o setup 2>out.build
clean:
	rm -f setup a.out .setup-config register.sh unregister.sh out.build
	rm -rf ,tmp* dist
	find . -name "*.o" |xargs rm -f
	find . -name "*.hi" |xargs rm -f
	find . -name "*~" | xargs rm -f
check: setup
	./setup configure --user --prefix=/tmp/foo
	./setup build
	./setup install --install-prefix=/tmp/bar
	ls /tmp/bar*
	# install w/ register!
	./setup install
#	ls /tmp/foo*
	./setup sdist
	ls dist

Make system tweaks to avoid cabal thinking it isn't bootstrapped when running the testsuite

# Some hacks
HC = $(shell grep "^HC=" ../../Makefile | sed "s/HC=//")
comma = ,
CABALVERSION = $(shell grep "^CABALVERSION=" ../../Makefile | sed "s/CABALVERSION=//")

setup: Setup.lhs
	$(HC) -cpp -DCABAL_VERSION=$(subst .,$(comma),$(CABALVERSION)) --make -i../.. Setup.lhs -o setup 2>out.build
clean:
	rm -f setup a.out .setup-config register.sh unregister.sh out.build
	rm -rf ,tmp* dist
	find . -name "*.o" |xargs rm -f
	find . -name "*.hi" |xargs rm -f
	find . -name "*~" | xargs rm -f
check: setup
	./setup configure --user --prefix=/tmp/foo
	./setup build
	./setup install --install-prefix=/tmp/bar
	ls /tmp/bar*
	# install w/ register!
	./setup install
#	ls /tmp/foo*
	./setup sdist
	ls dist


SRC_DIRS_$(d) := \
    fly/coders \
    fly/coders/base64 \
    fly/coders/huffman \
    fly/config \
    fly/logger \
    fly/parser \
    fly/path \
    fly/socket \
    fly/system \
    fly/task \
    fly/types/bit_stream \
    fly/types/bit_stream/detail \
    fly/types/json

# Add libfly.a and libfly.so to the archived release package.
$(eval $(call ADD_REL_LIB))

# Add all header files to the archived release package.
$(eval $(call ADD_REL_INC, $(d), *.hpp, fly))

# Add build system files to thearchived release package.
$(eval $(call ADD_REL_SRC, $(BUILD_ROOT), *.mk, fly))

Remove now unneeded release tarball command


.PHONY: image tag show-tag
default: push

ORG?=linuxkit
HASH?=$(shell git ls-tree --full-tree HEAD -- $(CURDIR) | awk '{print $$3}')
BASE_DEPS=Dockerfile Makefile

DIRTY=$(shell git diff-index --quiet HEAD -- $(CURDIR) || echo "-dirty")
TAG=$(ORG)/$(IMAGE):$(HASH)$(DIRTY)

# Get a release tag, if present
RELEASE=$(shell git tag -l --points-at HEAD)

ifdef NETWORK
NET_OPT=
else
NET_OPT=--network=none
endif

show-tag:
	@echo $(TAG)

tag: $(BASE_DEPS) $(DEPS)
	DOCKER_CONTENT_TRUST=1 docker pull $(TAG) || \
	docker build $(NET_OPT) -t $(TAG) .

push: tag
ifneq ($(DIRTY),)
	$(error Your repository is not clean. Will not push package image.)
endif
	DOCKER_CONTENT_TRUST=1 docker pull $(TAG) || \
	DOCKER_CONTENT_TRUST=1 docker push $(TAG)
ifneq ($(RELEASE),)
	docker tag $(TAG) $(ORG)/$(IMAGE):$(RELEASE)
	DOCKER_CONTENT_TRUST=1 docker push $(ORG)/$(IMAGE):$(RELEASE)
endif

Allow override of commit to calculate hash for show-tag

.PHONY: image tag show-tag
default: push

ORG?=linuxkit
HASH_COMMIT?=HEAD # Setting this is only really useful with the show-tag target
HASH?=$(shell git ls-tree --full-tree $(HASH_COMMIT) -- $(CURDIR) | awk '{print $$3}')
BASE_DEPS=Dockerfile Makefile

ifneq ($(HASH_COMMIT),HEAD) # Others can't be dirty by definition
DIRTY=$(shell git diff-index --quiet HEAD -- $(CURDIR) || echo "-dirty")
endif
TAG=$(ORG)/$(IMAGE):$(HASH)$(DIRTY)

# Get a release tag, if present
RELEASE=$(shell git tag -l --points-at HEAD)

ifdef NETWORK
NET_OPT=
else
NET_OPT=--network=none
endif

show-tag:
	@echo $(TAG)

tag: $(BASE_DEPS) $(DEPS)
	DOCKER_CONTENT_TRUST=1 docker pull $(TAG) || \
	docker build $(NET_OPT) -t $(TAG) .

push: tag
ifneq ($(DIRTY),)
	$(error Your repository is not clean. Will not push package image.)
endif
	DOCKER_CONTENT_TRUST=1 docker pull $(TAG) || \
	DOCKER_CONTENT_TRUST=1 docker push $(TAG)
ifneq ($(RELEASE),)
	docker tag $(TAG) $(ORG)/$(IMAGE):$(RELEASE)
	DOCKER_CONTENT_TRUST=1 docker push $(ORG)/$(IMAGE):$(RELEASE)
endif


-load luamake.so

ifdef WINDIR
# ASSUMES we have makenew and libgnumake-1.dll.a in this directory
platform_opts = -L. -lgnumake-1.dll
endif

ifeq ($(shell uname),Darwin)
platform_opts = -undefined dynamic_lookup
endif

luamake.so: luamake.c
	gcc -Wall -shared -o $@ $^ $(platform_opts) -llua5.3 -I/usr/include/lua5.3

.PHONY: test

$(lua require,luamake)

test:
	# Call module function directly
	$(info $(lua proc,hi,another hello))
	# Use eval to convert to string for display
	$(info result is $(lua eval,tostring(55)))

Update link options for Linux

-load luamake.so

ifdef WINDIR
# ASSUMES we have makenew and libgnumake-1.dll.a in this directory
platform_opts = -L. -lgnumake-1.dll
endif

ifeq ($(shell uname),Darwin)
platform_opts = -undefined dynamic_lookup
endif

ifeq ($(shell uname),Linux)
platform_opts = -fPIC
endif

luamake.so: luamake.c
	gcc -Wall -shared -o $@ $^ $(platform_opts) -llua5.3 -I/usr/include/lua5.3

.PHONY: test

$(lua require,luamake)

test:
	# Call module function directly
	$(info $(lua proc,hi,another hello))
	# Use eval to convert to string for display
	$(info result is $(lua eval,tostring(55)))


packages:=boost openssl
native_packages := native_ccache native_comparisontool

qt_native_packages = native_protobuf
qt_packages = qrencode protobuf

qt46_linux_packages = qt46 expat dbus libxcb xcb_proto libXau xproto freetype libX11 xextproto libXext xtrans libICE libSM
qt5_linux_packages= qt expat dbus libxcb xcb_proto libXau xproto freetype fontconfig libX11 xextproto libXext xtrans

qt_darwin_packages=qt
qt_mingw32_packages=qt

qt_linux_$(USE_LINUX_STATIC_QT5):=$(qt5_linux_packages)
qt_linux_:=$(qt46_linux_packages)
qt_linux_packages:=$(qt_linux_$(USE_LINUX_STATIC_QT5))

wallet_packages=bdb

upnp_packages=miniupnpc

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

Remove old qt46 support, use qt5 only.

packages:=boost openssl
native_packages := native_ccache native_comparisontool

qt_native_packages = native_protobuf
qt_packages = qrencode protobuf

qt5_linux_packages= qt expat dbus libxcb xcb_proto libXau xproto freetype fontconfig libX11 xextproto libXext xtrans

qt_darwin_packages=qt
qt_mingw32_packages=qt

qt_linux_$(USE_LINUX_STATIC_QT5):=$(qt5_linux_packages)

qt_linux_packages:=$(qt_linux_$(USE_LINUX_STATIC_QT5))

wallet_packages=bdb

upnp_packages=miniupnpc

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


PRJ=..$/..

PRJNAME=oox
TARGET=export
AUTOSEG=true

ENABLE_EXCEPTIONS=TRUE

# --- Settings -----------------------------------------------------

.INCLUDE :  settings.mk
.INCLUDE: $(PRJ)$/util$/makefile.pmk

# --- Files --------------------------------------------------------

SLOFILES =	\
        $(SLO)$/drawingml.obj \
        $(SLO)$/shapes.obj \
        $(SLO)$/vmlexport.obj \
        $(SLO)$/vmlexport-shape-types.obj

# --- Targets -------------------------------------------------------

.INCLUDE :  target.mk

$(MISC)$/vmlexport-shape-types.cxx : preset-definitions-to-shape-types.pl presetShapeDefinitions.xml presetTextWarpDefinitions.xml
    $(PERL) $< > $@.in_progress 2> $(MISC)$/vmlexport-shape-types.log && mv $@.in_progress $@

Add dependency for generated vmlexport-shape-types

PRJ=..$/..

PRJNAME=oox
TARGET=export
AUTOSEG=true

ENABLE_EXCEPTIONS=TRUE

# --- Settings -----------------------------------------------------

.INCLUDE :  settings.mk
.INCLUDE: $(PRJ)$/util$/makefile.pmk

# --- Files --------------------------------------------------------

SLOFILES =	\
        $(SLO)$/drawingml.obj \
        $(SLO)$/shapes.obj \
        $(SLO)$/vmlexport.obj \
        $(SLO)$/vmlexport-shape-types.obj

# --- Targets -------------------------------------------------------

.INCLUDE :  target.mk

$(MISC)$/vmlexport-shape-types.cxx : preset-definitions-to-shape-types.pl presetShapeDefinitions.xml presetTextWarpDefinitions.xml
    $(PERL) $< > $@.in_progress 2> $(MISC)$/vmlexport-shape-types.log && mv $@.in_progress $@

$(SLO)$/vmlexport-shape-types.obj : $(MISC)$/vmlexport-shape-types.cxx


PLATFORM_FLAVOR ?= developerbox

$(call force,CFG_GENERIC_BOOT,y)
$(call force,CFG_SECURE_TIME_SOURCE_CNTPCT,y)
$(call force,CFG_GIC,y)
$(call force,CFG_PL011,y)
$(call force,CFG_PM_STUBS,y)

include core/arch/arm/cpu/cortex-armv8-0.mk
$(call force,CFG_TEE_CORE_NB_CORE,24)
CFG_TZDRAM_START ?= 0xfc000000
CFG_TZDRAM_SIZE ?= 0x03c00000
CFG_SHMEM_START ?= 0xffc00000
CFG_SHMEM_SIZE ?= 0x00400000

$(call force,CFG_WITH_ARM_TRUSTED_FW,y)

$(call force,CFG_WITH_LPAE,y)
$(call force,CFG_ARM64_core,y)
ta-targets = ta_arm64

CFG_CRYPTO_SIZE_OPTIMIZATION ?= n
CFG_WITH_STACK_CANARIES ?= y
$(call force,CFG_ARM_GICV3,y)
$(call force,CFG_CORE_CLUSTER_SHIFT,1)

Set default number of threads to 8

PLATFORM_FLAVOR ?= developerbox

$(call force,CFG_GENERIC_BOOT,y)
$(call force,CFG_SECURE_TIME_SOURCE_CNTPCT,y)
$(call force,CFG_GIC,y)
$(call force,CFG_PL011,y)
$(call force,CFG_PM_STUBS,y)

include core/arch/arm/cpu/cortex-armv8-0.mk
$(call force,CFG_TEE_CORE_NB_CORE,24)
CFG_NUM_THREADS ?= 8
CFG_TZDRAM_START ?= 0xfc000000
CFG_TZDRAM_SIZE ?= 0x03c00000
CFG_SHMEM_START ?= 0xffc00000
CFG_SHMEM_SIZE ?= 0x00400000

$(call force,CFG_WITH_ARM_TRUSTED_FW,y)

$(call force,CFG_WITH_LPAE,y)
$(call force,CFG_ARM64_core,y)
ta-targets = ta_arm64

CFG_CRYPTO_SIZE_OPTIMIZATION ?= n
CFG_WITH_STACK_CANARIES ?= y
$(call force,CFG_ARM_GICV3,y)
$(call force,CFG_CORE_CLUSTER_SHIFT,1)


#
# Copyright 2008 The Android Open Source Project
#
# Zip alignment tool
#

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

LOCAL_SRC_FILES := \
	ZipAlign.cpp \
	ZipEntry.cpp \
	ZipFile.cpp

LOCAL_C_INCLUDES += external/zlib

LOCAL_STATIC_LIBRARIES := \
	libutils \
	libcutils

LOCAL_LDLIBS := -lz

ifeq ($(HOST_OS),linux)
LOCAL_LDLIBS += -lrt
endif

# dunno if we need this, but some of the other tools include it
ifeq ($(HOST_OS),windows)
ifeq ($(strip $(USE_CYGWIN),),)
LOCAL_LDLIBS += -lws2_32
endif
endif

LOCAL_MODULE := zipalign

include $(BUILD_HOST_EXECUTABLE)

Make zipalign build for the Win SDK under Linux.

#
# Copyright 2008 The Android Open Source Project
#
# Zip alignment tool
#

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

LOCAL_SRC_FILES := \
	ZipAlign.cpp \
	ZipEntry.cpp \
	ZipFile.cpp

LOCAL_C_INCLUDES += external/zlib

LOCAL_STATIC_LIBRARIES := \
	libutils \
	libcutils

ifeq ($(HOST_OS),linux)
LOCAL_LDLIBS += -lrt
endif

ifneq ($(strip $(USE_MINGW)),)
LOCAL_STATIC_LIBRARIES += libz
else
LOCAL_LDLIBS += -lz
endif

LOCAL_MODULE := zipalign

include $(BUILD_HOST_EXECUTABLE)


LOCAL_PATH := $(call my-dir)

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

include $(CLEAR_VARS)

LOCAL_CATEGORY_PATH := mykonos3/libs
LOCAL_MODULE := libARDiscovery
LOCAL_DESCRIPTION := ARSDK Discovery and Connection Management Layer

LOCAL_LIBRARIES := libARSAL
LOCAL_EXPORT_LDLIBS := -lardiscovery

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

ifeq ("$(TARGET_PBUILD_FORCE_STATIC)","1")
LOCAL_AUTOTOOLS_CONFIGURE_ARGS += --disable-shared
endif

# 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 avahi Alchemy dependency for compilation purposes

LOCAL_PATH := $(call my-dir)

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

include $(CLEAR_VARS)

LOCAL_CATEGORY_PATH := mykonos3/libs
LOCAL_MODULE := libARDiscovery
LOCAL_DESCRIPTION := ARSDK Discovery and Connection Management Layer

LOCAL_LIBRARIES := libARSAL avahi
LOCAL_EXPORT_LDLIBS := -lardiscovery

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

ifeq ("$(TARGET_PBUILD_FORCE_STATIC)","1")
LOCAL_AUTOTOOLS_CONFIGURE_ARGS += --disable-shared
endif

# 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


#
# Determine operating system / architecture name in OSGI format
#

# Update OS names to canonical format
OS=$(shell sh -c 'uname -s 2>/dev/null || echo not')

ifeq ($(OS),Darwin)
	OS=macosx
endif
ifeq ($(OS),Linux)
	OS=linux
endif

# Update processor names to canonical format
ARCH=$(shell uname -p)

ifeq ($(ARCH),i386)
	ARCH=x86
endif
ifeq ($(ARCH),amd64)
	ARCH=x86_64
endif

#  What to call shared libraries
SO_EXTENSION=so

ifeq ($(OS),macosx)
	SO_EXTENSION=dylib
endif

ifeq ($(OS),macosx)
	ARCH_PATH=$(OS)
else
	ARCH_PATH=$(OS)/$(ARCH)
endif

# Create quad-fat binaries on Mac OS
ifeq ($(OS),macosx)
	ARCH_CFLAGS=-arch i386 -arch x86_64

	ifeq ($(ARCH),ppc)
		ARCH_CFLAGS+=-arch ppc
	endif

	ifeq ($(ARCH),ppc64)
		ARCH_CFLAGS+=-arch ppc -arch ppc64
	endif
endif

Use uname -m instead of -p

#
# Determine operating system / architecture name in OSGI format
#

# Update OS names to canonical format
OS=$(shell sh -c 'uname -s 2>/dev/null || echo not')

ifeq ($(OS),Darwin)
	OS=macosx
endif
ifeq ($(OS),Linux)
	OS=linux
endif

# Update processor names to canonical format
ARCH=$(shell uname -m)

ifeq ($(ARCH),i386)
	ARCH=x86
endif
ifeq ($(ARCH),amd64)
	ARCH=x86_64
endif

#  What to call shared libraries
SO_EXTENSION=so

ifeq ($(OS),macosx)
	SO_EXTENSION=dylib
endif

ifeq ($(OS),macosx)
	ARCH_PATH=$(OS)
else
	ARCH_PATH=$(OS)/$(ARCH)
endif

# Create quad-fat binaries on Mac OS
ifeq ($(OS),macosx)
	ARCH_CFLAGS=-arch i386 -arch x86_64

	ifeq ($(ARCH),ppc)
		ARCH_CFLAGS+=-arch ppc
	endif

	ifeq ($(ARCH),ppc64)
		ARCH_CFLAGS+=-arch ppc -arch ppc64
	endif
endif


include $(SRC_PATH)build/arch.mk
SHAREDLIBSUFFIX = so
SHAREDLIBSUFFIXVER=$(SHAREDLIBSUFFIX).$(SHAREDLIBVERSION)
SHLDFLAGS = -Wl,-soname,$(LIBPREFIX)$(PROJECT_NAME).$(SHAREDLIBSUFFIXVER)
CFLAGS += -Wall -fno-strict-aliasing -fPIC -MMD -MP
LDFLAGS += -lpthread
ifeq ($(ASM_ARCH), x86)
ifeq ($(ARCH), x86_64)
ASMFLAGS += -f elf64
else
ASMFLAGS += -f elf
endif
endif
ifeq ($(ASM_ARCH), arm)
ASMFLAGS += -march=armv7-a -mfpu=neon
endif

Enable -Wc++11-compat-reserved-user-defined-literal when building with clang on linux

include $(SRC_PATH)build/arch.mk
SHAREDLIBSUFFIX = so
SHAREDLIBSUFFIXVER=$(SHAREDLIBSUFFIX).$(SHAREDLIBVERSION)
SHLDFLAGS = -Wl,-soname,$(LIBPREFIX)$(PROJECT_NAME).$(SHAREDLIBSUFFIXVER)
CFLAGS += -Wall -fno-strict-aliasing -fPIC -MMD -MP
LDFLAGS += -lpthread
ifeq ($(ASM_ARCH), x86)
ifeq ($(ARCH), x86_64)
ASMFLAGS += -f elf64
else
ASMFLAGS += -f elf
endif
endif
ifeq ($(ASM_ARCH), arm)
ASMFLAGS += -march=armv7-a -mfpu=neon
endif

ifeq ($(CXX), clang++)
CXXFLAGS += -Wc++11-compat-reserved-user-defined-literal
endif


ifeq ($(filter msm8610,$(TARGET_BOARD_PLATFORM)),)
ifneq ($(BUILD_TINY_ANDROID),true)
LOCAL_PATH := $(call my-dir)

# HAL module implemenation stored in
include $(CLEAR_VARS)

ifneq ($(filter msm8610,$(TARGET_BOARD_PLATFORM)),)
  LOCAL_MODULE := sensors.$(TARGET_BOARD_PLATFORM)
  LOCAL_CFLAGS := -DTARGET_8610
else
  LOCAL_MODULE := sensors.msm8930
endif

LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/hw

LOCAL_MODULE_TAGS := optional

LOCAL_CFLAGS += -DLOG_TAG=\"Sensors\"
ifeq ($(call is-board-platform,msm8960),true)
  LOCAL_CFLAGS += -DTARGET_8930
endif

LOCAL_SRC_FILES :=	\
		sensors.cpp 			\
		SensorBase.cpp			\
		LightSensor.cpp			\
		ProximitySensor.cpp		\
		AkmSensor.cpp			\
		Accelerometer.cpp				\
		Mpu3050.cpp				\
		Bmp180.cpp				\
		InputEventReader.cpp

LOCAL_SHARED_LIBRARIES := liblog libcutils libdl

include $(BUILD_SHARED_LIBRARY)

endif #BUILD_TINY_ANDROID
endif

Revert "sensors: disable sensors HAL for 8610"


all: $(objdir)/kernel.x86.elf

Add qemu convienence targets to x86 makefile

all: $(objdir)/kernel.x86.elf

# Boot the kernel in qemu:
qemu-run: all
	qemu-system-i386 -kernel $(objdir)/kernel.x86.elf -serial stdio
# Same thing, but wait for gdb to attach:
qemu-gdb: all
	qemu-system-i386 -kernel $(objdir)/kernel.x86.elf -serial stdio -s -S


all: setup expat expatw expat_static expatw_static elements outline xmlwf

setup:
 setup

expat:
 make -l -fexpat.mak

expatw:
 make -l -fexpatw.mak

expat_static:
 make -l -fexpat_static.mak

expatw_static:
 make -l -fexpatw_static.mak

elements:
 make -l -felements.mak

outline:
 make -l -foutline.mak

xmlwf:
 make -l -fxmlwf.mak

clean:
# works on Win98/ME
 deltree /y release\obj
# works on WinNT/2000
# del /s/f/q release\obj

distclean:
# works on Win98/ME
 deltree /y release\*.*
# works on WinNT/2000
# del /s/f/q release\*

Change to support Windows 2000 behaviour by default

all: setup expat expatw expat_static expatw_static elements outline xmlwf

setup:
 setup

expat:
 make -l -fexpat.mak

expatw:
 make -l -fexpatw.mak

expat_static:
 make -l -fexpat_static.mak

expatw_static:
 make -l -fexpatw_static.mak

elements:
 make -l -felements.mak

outline:
 make -l -foutline.mak

xmlwf:
 make -l -fxmlwf.mak

clean:
# works on Win98/ME
# deltree /y release\obj
# works on WinNT/2000
 del /s/f/q release\obj

distclean:
# works on Win98/ME
# deltree /y release\*.*
# works on WinNT/2000
 del /s/f/q release\*


LOCAL_PATH:= $(call my-dir)

include $(CLEAR_VARS)

LOCAL_SRC_FILES:= \
	main.cpp \
	TestPlatform.cpp

LOCAL_MODULE:= test-platform

LOCAL_MODULE_TAGS := optional

# Ignore non virtual destructor error
TARGET_ERROR_FLAGS += -Wno-non-virtual-dtor

LOCAL_C_INCLUDES += \
	external/stlport/stlport \
	bionic/libstdc++ \
	bionic

LOCAL_C_INCLUDES += \
	$(LOCAL_PATH)/../../parameter \
	$(LOCAL_PATH)/../../remote-processor/

LOCAL_SHARED_LIBRARIES := \
	libparameter \
	libremote-processor \
	libstlport

include $(BUILD_EXECUTABLE)

Fix incorect use of tabs, replace by spaces


# IBM_PROLOG_BEGIN_TAG
# This is an automatically generated prolog.
#
# $Source: src/import/chips/p9/procedures/hwp/initfiles/p9_npu_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_npu_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_npu_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_npu_scom
lib$(PROCEDURE)_COMMONFLAGS+=-fno-var-tracking-assignments
$(call BUILD_PROCEDURE)


# Copyright 2016 Palmer Dabbelt <palmer@dabbelt.com>

ifeq ($(SYNOPSYS_HOME),)
$(error Running VCS requires SYNOPSYS_HOME to be set)
endif

ifeq ($(VCS_VERSION),)
$(error Specify a VCS version as VCS_VERSION)
endif

VCS_HOME = $(SYNOPSYS_HOME)/vcs/$(VCS_VERSION)
VCS_BIN = $(VCS_HOME)/bin/vcs

ifeq ($(wildcard $(VCS_BIN)),)
$(error Cannot find VCS at $(VCS_BIN))
endif

Check for a Synopsys license file before running VCS

# Copyright 2016 Palmer Dabbelt <palmer@dabbelt.com>

ifeq ($(SYNOPSYS_HOME),)
$(error Running VCS requires SYNOPSYS_HOME to be set)
endif

ifeq ($(VCS_VERSION),)
$(error Specify a VCS version as VCS_VERSION)
endif

ifeq ($(SNPSLMD_LICENSE_FILE),)
$(error SNPSLMD_LICENSE_FILE needs to be exported for VCS to run)
endif

VCS_HOME = $(SYNOPSYS_HOME)/vcs/$(VCS_VERSION)
VCS_BIN = $(VCS_HOME)/bin/vcs

ifeq ($(wildcard $(VCS_BIN)),)
$(error Cannot find VCS at $(VCS_BIN))
endif


# Function:    timing
# Description: Measure the execution time of a command a put it in a file
# Argument $1: Command (in a string) to execute and time
# Argument $2: File where the timing should be stored
define timing
	@start=$$(date +%s); \
	eval $(1); \
	end=$$(date +%s); \
	T=$$(($$end-$$start)); \
	printf "%02d:%02d:%02d" "$$((T/3600%24))" "$$((T/60%60))" "$$((T%60))" > $(2);
endef

# Binary arguments
ITER=200000

Store seconds instead of formated time in timing file

# Function:    timing
# Description: Measure the execution time of a command a put it in a file
# Argument $1: Command (in a string) to execute and time
# Argument $2: File where the timing should be stored
define timing
	@start=$$(date +%s); \
	eval $(1); \
	end=$$(date +%s); \
	T=$$(($$end-$$start)); \
	printf "$$T" > $(2);
endef

# Binary arguments
ITER=200000


# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
#
# This file is part of the LibreOffice project.
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#

$(eval $(call gb_Package_Package,chart2_opengl_shader,$(SRCDIR)/chart2/opengl))

$(eval $(call gb_Package_set_outdir,chart2_opengl_shader,$(INSTDIR)/program))

$(eval $(call gb_Package_add_files,chart2_opengl_shader,opengl,\
	backgroundFragmentShader.glsl \
	backgroundVertexShader.glsl \
	commonFragmentShader.glsl \
	commonVertexShader.glsl \
	debugFragmentShader.glsl \
	debugVertexShader.glsl \
	renderFragmentShader.glsl \
	renderVertexShader.glsl \
	symbolFragmentShader.glsl \
	symbolVertexShader.glsl \
	textFragmentShader.glsl \
	textVertexShader.glsl \
))

# vim: set noet sw=4 ts=4:

Fix target of .glsl files on Mac OS X

# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
#
# This file is part of the LibreOffice project.
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#

$(eval $(call gb_Package_Package,chart2_opengl_shader,$(SRCDIR)/chart2/opengl))

$(eval $(call gb_Package_set_outdir,chart2_opengl_shader,$(INSTROOT)/program))

$(eval $(call gb_Package_add_files,chart2_opengl_shader,opengl,\
	backgroundFragmentShader.glsl \
	backgroundVertexShader.glsl \
	commonFragmentShader.glsl \
	commonVertexShader.glsl \
	debugFragmentShader.glsl \
	debugVertexShader.glsl \
	renderFragmentShader.glsl \
	renderVertexShader.glsl \
	symbolFragmentShader.glsl \
	symbolVertexShader.glsl \
	textFragmentShader.glsl \
	textVertexShader.glsl \
))

# vim: set noet sw=4 ts=4:


$(BUILD_APP_DIR)/spi_buf.elf: $(call rwildcard,$(SRC_DIR)apps/spi_buf/,*.c) $(BUILD_DIR)/arch.o $(BUILD_APP_DIR)/firestorm.o $(BUILD_APP_DIR)/tock.o $(BUILD_APP_DIR)/crt1.o $(BUILD_APP_DIR)/sys.o $(BUILD_APP_DIR)/arch.o $(APP_LIBC)
	@echo "Building $@"
	@$(CC) $(LDFLAGS) $(CFLAGS_APPS) -g -Os -T $(SRC_DIR)apps/spi_buf/loader.ld -o $@ -ffreestanding -nostdlib $^

$(BUILD_APP_DIR)/spi_buf.bin: $(BUILD_APP_DIR)/spi_buf.elf
	@echo "Extracting binary $@"
	@$(OBJCOPY) --gap-fill 0xff -O binary $< $@

$(BUILD_APP_DIR)/spi_buf.bin.o: $(BUILD_APP_DIR)/spi_buf.bin
	@echo "Linking $@"
	@$(LD) -r -b binary -o $@ $<
	@$(OBJCOPY) --rename-section .data=.app.2 $@

Make spi_buf app at least compile

$(BUILD_APP_DIR)/spi_buf.elf: $(call rwildcard,$(SRC_DIR)apps/spi_buf/,*.c) $(BUILD_APP_DIR)/firestorm.o $(BUILD_APP_DIR)/tock.o $(BUILD_APP_DIR)/crt1.o $(BUILD_APP_DIR)/sys.o $(BUILD_APP_DIR)/arch.o $(APP_LIBC)
	@echo "Building $@"
	@$(CC) $(CFLAGS_BASE) $(CFLAGS_APPS) -g -Os -T $(SRC_DIR)apps/spi_buf/loader.ld -o $@ -ffreestanding -nostdlib -Wl,-Map=$(BUILD_APP_DIR)/app.Map $^
	@$(OBJDUMP) $(OBJDUMP_FLAGS) $@ > $(BUILD_APP_DIR)/app.lst

$(BUILD_APP_DIR)/spi_buf.bin: $(BUILD_APP_DIR)/spi_buf.elf
	@echo "Extracting binary $@"
	@$(OBJCOPY) --gap-fill 0xff -O binary $< $@

$(BUILD_APP_DIR)/spi_buf.bin.o: $(BUILD_APP_DIR)/spi_buf.bin
	@echo "Linking $@"
	@$(LD) -r -b binary -o $@ $<
	@$(OBJCOPY) --rename-section .data=.app.2 $@


<select name="release_id" id="release_select" onChange="${w.on_change}(this)">
 % for i, release in enumerate(w.releases_table):
   <% selected = i == 0 and 'selected="selected"' or '' %>
   <option ${selected} value="${str(release['value'])}">${release['label']}</option>
 % endfor
</select>

Add consistent labels to our release filter

Release:

<select name="release_id" id="release_select" onChange="${w.on_change}(this)">
 % for i, release in enumerate(w.releases_table):
   <% selected = i == 0 and 'selected="selected"' or '' %>
   <option ${selected} value="${str(release['value'])}">${release['label']}</option>
 % endfor
</select>


PP_INPUTS = $(wildcard $(addprefix $(S)src/lib/,*.rs */*.rs)) \
            $(wildcard $(addprefix $(S)src/comp/,*.rs */*.rs */*/*.rs)) \
            $(wildcard $(S)src/test/*/*.rs   \
                       $(S)src/test/*/*/*.rs)

PP_INPUTS_FILTERED = $(shell echo $(PP_INPUTS) | xargs grep -L no-reformat)

reformat: $(SREQ1)
	@$(call E, reformat [stage1]: $@)
	for i in $(PP_INPUTS_FILTERED);  \
    do $(call CFG_RUN_TARG,stage1,stage1/rustc$(X)) \
       --pretty normal $$i >$$i.tmp; \
    if cmp --silent $$i.tmp $$i; \
        then echo no changes to $$i; rm $$i.tmp; \
        else mv $$i.tmp $$i; fi \
    done

Add fuzzer to reformat make target

PP_INPUTS = $(wildcard $(addprefix $(S)src/lib/,*.rs */*.rs)) \
            $(wildcard $(addprefix $(S)src/comp/,*.rs */*.rs */*/*.rs)) \
            $(wildcard $(S)src/test/*/*.rs   \
                       $(S)src/test/*/*/*.rs) \
            $(wildcard $(S)src/fuzzer/*.rs)

PP_INPUTS_FILTERED = $(shell echo $(PP_INPUTS) | xargs grep -L no-reformat)

reformat: $(SREQ1)
	@$(call E, reformat [stage1]: $@)
	for i in $(PP_INPUTS_FILTERED);  \
    do $(call CFG_RUN_TARG,stage1,stage1/rustc$(X)) \
       --pretty normal $$i >$$i.tmp; \
    if cmp --silent $$i.tmp $$i; \
        then echo no changes to $$i; rm $$i.tmp; \
        else mv $$i.tmp $$i; fi \
    done


# IBM_PROLOG_BEGIN_TAG
# This is an automatically generated prolog.
#
# $Source: src/import/chips/p9/procedures/hwp/initfiles/p9_xbus_g1_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_xbus_g1_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_xbus_g1_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_xbus_g1_scom
lib$(PROCEDURE)_COMMONFLAGS+=-fno-var-tracking-assignments
$(call BUILD_PROCEDURE)


## -*- coding: utf-8 -*-
<%inherit file="netprofile:templates/ddl_trigger.mak"/>\
<%block name="sql">\
	SET NEW.mby := @accessuid;
</%block>

Fix before-update trigger for tasks

## -*- coding: utf-8 -*-
<%inherit file="netprofile:templates/ddl_trigger.mak"/>\
<%block name="sql">\
	IF @accessuid > 0 THEN
		SET NEW.mby := @accessuid;
	END IF;
</%block>


HAVE_STACK := $(shell command -v stack 2> /dev/null)
ifdef HAVE_STACK
HS_TO_COQ = stack exec hs-to-coq --
else
ifeq ($(HS_TO_COQ_COVERAGE),True)
	CABAL_OPTS = --enable-coverage
endif
HS_TO_COQ = cabal new-run -v0 $(CABAL_OPTS) exe:hs-to-coq --
endif
SHELL = bash

Make the cabal-based setup more robust

HAVE_STACK := $(shell command -v stack 2> /dev/null)

ifdef HAVE_STACK
HS_TO_COQ = stack exec hs-to-coq --
else
ifeq ($(HS_TO_COQ_COVERAGE),True)
	CABAL_OPTS = --enable-coverage
endif
TOP := $(dir $(lastword $(MAKEFILE_LIST)))
HS_TO_COQ = cabal new-run --project-file=$(TOP)/cabal.project  -v0 $(CABAL_OPTS) exe:hs-to-coq --
endif

SHELL = bash


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

Support any builds on subdirs

ifndef SUBDIR
SUBDIR := ./
endif

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


build_linux_SHA256SUM = sha256sum
build_linux_DOWNLOAD = wget --timeout=$(DOWNLOAD_CONNECT_TIMEOUT) --tries=$(DOWNLOAD_RETRIES) -nv -O

Use curl for fetching on Linux

build_linux_SHA256SUM = sha256sum
build_linux_DOWNLOAD = curl --connect-timeout $(DOWNLOAD_CONNECT_TIMEOUT) --retry $(DOWNLOAD_RETRIES) -L -o


USB_VID = 0x239A
USB_PID = 0x80F2
USB_PRODUCT = "Feather RP2040"
USB_MANUFACTURER = "Adafruit"

CHIP_VARIANT = RP2040
CHIP_FAMILY = rp2

EXTERNAL_FLASH_DEVICES = "GD25Q64C"

Add winbond to Feather RP2040

USB_VID = 0x239A
USB_PID = 0x80F2
USB_PRODUCT = "Feather RP2040"
USB_MANUFACTURER = "Adafruit"

CHIP_VARIANT = RP2040
CHIP_FAMILY = rp2

EXTERNAL_FLASH_DEVICES = "GD25Q64C,W25Q64JVxQ"


# -*- makefile -*-

# CFLAGS += -Werror -Wformat
INCFLAGS += -I$(BUILD_DIR) -I$(LIBFFI_BUILD_DIR)/include
CPPFLAGS += -I$(BUILD_DIR) -I$(LIBFFI_BUILD_DIR)/include
# CPPFLAGS += -mwin32
LOCAL_LIBS += $(LIBFFI)
# LOCAL_LIBS += -lpthread

FFI_CFLAGS = $(FFI_MMAP_EXEC)
BUILD_DIR = $(shell pwd)
LIBFFI_SRC_DIR = $(abspath $(srcdir))/libffi
LIBFFI_BUILD_DIR = $(BUILD_DIR)/libffi
LIBFFI = $(LIBFFI_BUILD_DIR)/.libs/libffi_convenience.a
FFI_CONFIGURE = $(LIBFFI_SRC_DIR)/configure --disable-static \
	--with-pic=yes --disable-dependency-tracking

$(OBJS):	$(LIBFFI)

Add work around for lack of $(abspath) function on older gnu make

# -*- makefile -*-

# CFLAGS += -Werror -Wformat
INCFLAGS += -I$(BUILD_DIR) -I$(LIBFFI_BUILD_DIR)/include
CPPFLAGS += -I$(BUILD_DIR) -I$(LIBFFI_BUILD_DIR)/include
# CPPFLAGS += -mwin32
LOCAL_LIBS += $(LIBFFI)
# LOCAL_LIBS += -lpthread

FFI_CFLAGS = $(FFI_MMAP_EXEC)
BUILD_DIR := $(shell pwd)
ifeq ($(srcdir),.)
  LIBFFI_SRC_DIR := $(shell pwd)/$(srcdir)/libffi
else
  LIBFFI_SRC_DIR := $(srcdir)/libffi
endif
LIBFFI_BUILD_DIR = $(BUILD_DIR)/libffi
LIBFFI = $(LIBFFI_BUILD_DIR)/.libs/libffi_convenience.a
FFI_CONFIGURE = $(LIBFFI_SRC_DIR)/configure --disable-static \
	--with-pic=yes --disable-dependency-tracking

$(OBJS):	$(LIBFFI)


# DEPENDENCIES #

ifeq ($(MARKDOWN_LINTER), remark)
	include $(TOOLS_MAKE_LIB_DIR)/lint/remark.mk
endif

# TARGETS #

# Lint.
#
# This target lints all Markdown files.

lint-markdown: $(NODE_MODULES)
	$(QUIET) $(MARKDOWN_LINT) $(MARKDOWN_LINT_FLAGS) $(MARKDOWN_FILES)

.PHONY: lint-markdown

# Lint.
#
# This target lints Markdown files according to a specified file list. Note that we expect `$FILES` to be a Markdown file list.

lint-markdown-files: $(NODE_MODULES)
	$(QUIET) $(MARKDOWN_LINT) $(MARKDOWN_LINT_FLAGS) $(FILES)

.PHONY: lint-markdown-files

Refactor recipe to iterate over file list

# DEPENDENCIES #

ifeq ($(MARKDOWN_LINTER), remark)
	include $(TOOLS_MAKE_LIB_DIR)/lint/remark.mk
endif

# TARGETS #

# Lint.
#
# This target lints all Markdown files.

lint-markdown: $(NODE_MODULES)
	$(QUIET) $(FIND_MARKDOWN_CMD) | grep '^[\/]\|^[a-zA-Z]:[/\]' | while read -r file; do \
		echo ''; \
		echo "Linting file: $$file"; \
		$(MARKDOWN_LINT) $(MARKDOWN_LINT_FLAGS) $$file || exit 1; \
	done

.PHONY: lint-markdown

# Lint.
#
# This target lints Markdown files according to a specified file list. Note that we expect `$FILES` to be a Markdown file list.

lint-markdown-files: $(NODE_MODULES)
	$(QUIET) for file in $(FILES); do \
		echo ''; \
		echo "Linting file: $$file"; \
		$(MARKDOWN_LINT) $(MARKDOWN_LINT_FLAGS) $$file || exit 1; \
	done

.PHONY: lint-markdown-files