########################################################################
# conf/googlebenchmark.mk                                              #
# =========================                                            #
#                                                                      #
# Dependencies and compilation requirements for gbenchmark.            #
# -------------------------------------------------------------------- #
# MAINTEINER_NAME := Renato Cordeiro Ferreira                          #
# MAINTEINER_MAIL := renato.cferreira@hotmail.com                      #
# DESCRIPTION     := `gbenchmark` is a microbenchmark support library, #
#                    which support unit-tests alike benchmarking. To   #
#                    create the benchmark binary, just set `BENCHBIN`  #
#                    with the name of the file that contains the main  #
#                    function for the benchmarks.                      #
#                    For further info about the library, access:       #
#                    https://code.google.com/p/googletest/             #
########################################################################

ifndef GOOGLE_BENCHMARK_MK
override GOOGLE_BENCHMARK_MK := T

# Dependencies
# ==============
GIT_DEPENDENCY  += \
    gbenchmark => https://github.com/google/benchmark.git \
                  mkdir -p build && cd build && cmake .. && make

# Paths
# =======
CXXLIBS         += -I external/gbenchmark/include/
LDLIBS          += -L external/gbenchmark/build/src

# Flags
# =======
LDBENCH         += -lbenchmark

endif # ifndef GOOGLE_BENCHMARK_MK

Set build type of gbenchmark as 'Release'.

########################################################################
# conf/googlebenchmark.mk                                              #
# =========================                                            #
#                                                                      #
# Dependencies and compilation requirements for gbenchmark.            #
# -------------------------------------------------------------------- #
# MAINTEINER_NAME := Renato Cordeiro Ferreira                          #
# MAINTEINER_MAIL := renato.cferreira@hotmail.com                      #
# DESCRIPTION     := `gbenchmark` is a microbenchmark support library, #
#                    which support unit-tests alike benchmarking. To   #
#                    create the benchmark binary, just set `BENCHBIN`  #
#                    with the name of the file that contains the main  #
#                    function for the benchmarks.                      #
#                    For further info about the library, access:       #
#                    https://code.google.com/p/googletest/             #
########################################################################

ifndef GOOGLE_BENCHMARK_MK
override GOOGLE_BENCHMARK_MK := T

# Dependencies
# ==============
GIT_DEPENDENCY  += \
    gbenchmark => https://github.com/google/benchmark.git \
                  mkdir -p build && cd build && cmake -DCMAKE_BUILD_TYPE=Release .. && make

# Paths
# =======
CXXLIBS         += -I external/gbenchmark/include/
LDLIBS          += -L external/gbenchmark/build/src

# Flags
# =======
LDBENCH         += -lbenchmark

endif # ifndef GOOGLE_BENCHMARK_MK


ifneq ($(TARGET_SIMULATOR),true)
LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)
LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk

LOCAL_CPP_EXTENSION := .cc

# Set up the target identity
LOCAL_MODULE := proxy_resolver_v8_unittest

LOCAL_SRC_FILES := \
  proxy_resolver_v8_unittest.cc

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

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

LOCAL_SHARED_LIBRARIES := libpac libutils liblog

include $(BUILD_NATIVE_TEST)

endif

Remove unsed check for simulator


# VARIABLES #

# Define the path of the linter executable:
FILENAME_LINTER ?= $(TOOLS_DIR)/lint/filenames/bin/cli

# Define the command-line options to be used when invoking the executable:
FILENAME_LINTER_FLAGS ?=

# TARGETS #

# Lint filenames.
#
# This target lints filenames.

lint-filenames:
	$(QUIET) $(MAKE_EXECUTABLE) $(FILENAME_LINTER)
	$(QUIET) $(FILENAME_LINTER) $(FILENAME_LINTER_FLAGS) $(ROOT_DIR)

.PHONY: lint-filenames

Add recipe for ensuring header file basename uniqueness

# VARIABLES #

# Define the path of the linter executable:
FILENAME_LINTER ?= $(TOOLS_DIR)/lint/filenames/bin/cli

# Define the command-line options to be used when invoking the executable:
FILENAME_LINTER_FLAGS ?=

# Define the path of the linter executable for header filenames:
HEADER_FILENAME_LINTER ?= $(TOOLS_PKGS_DIR)/lint/header-filenames/bin/cli

# Define the command-line options to be used when invoking the executable:
HEADER_FILENAME_LINTER_FLAGS ?=

# TARGETS #

# Lint filenames.
#
# This target lints filenames.

lint-filenames:
	$(QUIET) $(MAKE_EXECUTABLE) $(FILENAME_LINTER)
	$(QUIET) $(FILENAME_LINTER) $(FILENAME_LINTER_FLAGS) $(ROOT_DIR)

.PHONY: lint-filenames

# Lint header filenames.
#
# This target lints header filenames for basename uniqueness.

lint-header-filenames:
	$(QUIET) $(MAKE_EXECUTABLE) $(HEADER_FILENAME_LINTER)
	$(QUIET) $(HEADER_FILENAME_LINTER) $(HEADER_FILENAME_LINTER_FLAGS) $(ROOT_DIR)

.PHONY: lint-header-filenames


# mimasv2 loading

TARGET ?= base

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

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

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

firmware-connect-mimasv2:
	flterm --port=/dev/ttyACM0 --speed=19200

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

Make serial port path configurable

# mimasv2 loading

TARGET ?= base
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


EXTERNAL_WARNINGS_NOT_ERRORS := TRUE

PRJ=..$/..$/..$/..$/..$/..

PRJNAME=libwps
TARGET=wpslib
ENABLE_EXCEPTIONS=TRUE
LIBTARGET=NO

.INCLUDE :  settings.mk

.IF "$(GUI)$(COM)"=="WNTMSC"
CFLAGS+=-GR
.ENDIF
.IF "$(COM)"=="GCC"
CFLAGSCXX+=-frtti
.ENDIF

.IF "$(SYSTEM_LIBWPD)" == "YES"
INCPRE+=$(LIBWPD_CFLAGS) -I..
.ELSE
INCPRE+=$(SOLARVER)$/$(UPD)$/$(INPATH)$/inc$/libwpd
.ENDIF

SLOFILES= \
	$(SLO)$/libwps_internal.obj \
	$(SLO)$/WPS4.obj \
	$(SLO)$/WPS8.obj \
	$(SLO)$/WPSContentListener.obj \
	$(SLO)$/WPSDocument.obj \
	$(SLO)$/WPSHeader.obj \
	$(SLO)$/WPSPageSpan.obj \
	$(SLO)$/WPSParser.obj

LIB1ARCHIV=$(LB)$/libwpslib.a
LIB1TARGET=$(SLB)$/$(TARGET).lib
LIB1OBJFILES= $(SLOFILES)

.INCLUDE :  target.mk

Fix build inside a new LibreOffice

EXTERNAL_WARNINGS_NOT_ERRORS := TRUE

PRJ=..$/..$/..$/..$/..$/..

PRJNAME=libwps
TARGET=wpslib
ENABLE_EXCEPTIONS=TRUE
LIBTARGET=NO

.INCLUDE :  settings.mk

.IF "$(GUI)$(COM)"=="WNTMSC"
CFLAGS+=-GR
.ENDIF
.IF "$(COM)"=="GCC"
CFLAGSCXX+=-frtti
.ENDIF

.IF "$(SYSTEM_LIBWPD)" == "YES"
INCPRE+=$(WPD_CFLAGS) -I..
.ELSE
INCPRE+=$(SOLARVER)$/$(UPD)$/$(INPATH)$/inc$/libwpd
.ENDIF

SLOFILES= \
	$(SLO)$/libwps_internal.obj \
	$(SLO)$/WPS4.obj \
	$(SLO)$/WPS8.obj \
	$(SLO)$/WPSContentListener.obj \
	$(SLO)$/WPSDocument.obj \
	$(SLO)$/WPSHeader.obj \
	$(SLO)$/WPSPageSpan.obj \
	$(SLO)$/WPSParser.obj

LIB1ARCHIV=$(LB)$/libwpslib.a
LIB1TARGET=$(SLB)$/$(TARGET).lib
LIB1OBJFILES= $(SLOFILES)

.INCLUDE :  target.mk


ifneq ($(SDL),0)
sdl2_pkg_config ?= $(shell $(SDL2_PKGCONFIG) $1 $2)
SDL_VERSION := $(call sdl2_pkg_config,--modversion,sdl2)
ifneq ($(SDL_VERSION),)
PDEVICES_SDL += sdlled sdlvga
PDEVICES += $(PDEVICES_SDL)
# Mark SDL header includes as system includes to avoid subjecting them to full
# pedantry
libtenyrsdl%$(DYLIB_SUFFIX) $(PDEVICES_SDL:%=devices/%.d): \
    CPPFLAGS += $(patsubst -I%,-isystem %,$(call sdl2_pkg_config,--cflags-only-I,sdl2 SDL2_image))
libtenyrsdl%$(DYLIB_SUFFIX) $(PDEVICES_SDL:%=devices/%.d): \
    CPPFLAGS += $(call sdl2_pkg_config,--cflags-only-other,sdl2 SDL2_image)
libtenyrsdl%$(DYLIB_SUFFIX): LDLIBS += $(call sdl2_pkg_config,--libs,sdl2 SDL2_image)
libtenyrsdlvga$(DYLIB_SUFFIX): | $(TOP)rsrc/font10x15/invert.font10x15.png
$(TOP)rsrc/font10x15/%:
	$(MAKE) -C $(@D) $(@F)

# Do not halt the build for platforms on which the feature-flag _BSD_SOURCE is
# unused.
sdl%.o: CFLAGS += -W$(PEDANTRY_EXCEPTION)unused-macros -W'$(PEDANTRY_EXCEPTION)\#warnings'
endif
endif

Add directory separators where missing

ifneq ($(SDL),0)
sdl2_pkg_config ?= $(shell $(SDL2_PKGCONFIG) $1 $2)
SDL_VERSION := $(call sdl2_pkg_config,--modversion,sdl2)
ifneq ($(SDL_VERSION),)
PDEVICES_SDL += sdlled sdlvga
PDEVICES += $(PDEVICES_SDL)
# Mark SDL header includes as system includes to avoid subjecting them to full
# pedantry
libtenyrsdl%$(DYLIB_SUFFIX) $(PDEVICES_SDL:%=devices/%.d): \
    CPPFLAGS += $(patsubst -I%,-isystem %,$(call sdl2_pkg_config,--cflags-only-I,sdl2 SDL2_image))
libtenyrsdl%$(DYLIB_SUFFIX) $(PDEVICES_SDL:%=devices/%.d): \
    CPPFLAGS += $(call sdl2_pkg_config,--cflags-only-other,sdl2 SDL2_image)
libtenyrsdl%$(DYLIB_SUFFIX): LDLIBS += $(call sdl2_pkg_config,--libs,sdl2 SDL2_image)
libtenyrsdlvga$(DYLIB_SUFFIX): | $(TOP)/rsrc/font10x15/invert.font10x15.png
$(TOP)/rsrc/font10x15/%:
	$(MAKE) -C $(@D) $(@F)

# Do not halt the build for platforms on which the feature-flag _BSD_SOURCE is
# unused.
sdl%.o: CFLAGS += -W$(PEDANTRY_EXCEPTION)unused-macros -W'$(PEDANTRY_EXCEPTION)\#warnings'
endif
endif


# Template for making Jupyter notebooks. Will get included
# by Makefiles in subdirectories.

RSTs=  $(NBs:.ipynb=.rst)

JUPYTER ?= jupyter
TIMEOUT = 600

.PHONY: rst
rst: $(RSTs)

%.rst: %.ipynb
	jupyter nbconvert --execute --ExecutePreprocessor.timeout=$(TIMEOUT) --to rst $<

%.html: %.rst
	${RST2HTML} $(<:.rstw=.rst)  > $@

.PHONY: clean
clean:
	rm -f ${RSTs}

Increase timeout for notebook conversion

# Template for making Jupyter notebooks. Will get included
# by Makefiles in subdirectories.

RSTs=  $(NBs:.ipynb=.rst)

JUPYTER ?= jupyter
TIMEOUT = 1800

.PHONY: rst
rst: $(RSTs)

%.rst: %.ipynb
	jupyter nbconvert --execute --ExecutePreprocessor.timeout=$(TIMEOUT) --to rst $<

%.html: %.rst
	${RST2HTML} $(<:.rstw=.rst)  > $@

.PHONY: clean
clean:
	rm -f ${RSTs}


# -*- 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 = $(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)

Convert $(srcdir) to an absolute path so the gem install works again

# -*- 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)


# Dependencies
# ==============
GIT_DEPENDENCY  += \
    gbenchmark => https://github.com/google/benchmark.git \
                  mkdir build && cd build && cmake .. && make

# Paths
# =======
CXXLIBS         += -I external/benchmark/include/
LDLIBS          += -L external/benchmark/build/src

# Flags
# =======
LDFLAGS         += -lbenchmark

Fix paths and avoid mkdir fail

# Dependencies
# ==============
GIT_DEPENDENCY  += \
    gbenchmark => https://github.com/google/benchmark.git \
                  mkdir -p build && cd build && cmake .. && make

# Paths
# =======
CXXLIBS         += -I external/gbenchmark/include/
LDLIBS          += -L external/gbenchmark/build/src

# Flags
# =======
LDFLAGS         += -lbenchmark


# VARIABLES #

# Define the command for Node:
NODE ?= node

# Define the root directory from which to search for modules:
MODULE_NAMES_DIR ?= $(ROOT_DIR)/lib/node_modules

# Define the path of the executable:
LIST_MODULE_NAMES ?= $(TOOLS_DIR)/ls/module-names/bin/cli

# Define the command flags:
LIST_MODULE_NAMES_FLAGS ?= \
	--dir $(MODULE_NAMES_DIR)

# TARGETS #

# List all module names.
#
# This target prints a list of all module names.

list-module-names: $(LIST_MODULE_NAMES)
	$(QUIET) $(LIST_MODULE_NAMES) $(LIST_MODULE_NAMES_FLAGS)

.PHONY: list-module-names

Use `node` command to run script

# VARIABLES #

# Define the command for `node`:
NODE ?= node

# Define the root directory from which to search for modules:
MODULE_NAMES_DIR ?= $(ROOT_DIR)/lib/node_modules

# Define the path of the executable:
LIST_MODULE_NAMES ?= $(TOOLS_DIR)/ls/module-names/bin/cli

# Define the command flags:
LIST_MODULE_NAMES_FLAGS ?= \
	--dir $(MODULE_NAMES_DIR)

# TARGETS #

# List all module names.
#
# This target prints a list of all module names.

list-module-names: $(LIST_MODULE_NAMES)
	$(QUIET) $(NODE) $(LIST_MODULE_NAMES) $(LIST_MODULE_NAMES_FLAGS)

.PHONY: list-module-names


WAYS = seq par

AUTO_BINARY = $(notdir $@)
AUTO_WAY  = $(patsubst %/,%,$(dir $@))

DPH_BINARIES = $(foreach binary, $(BINARIES), $(if $($(binary)_DPH), $(foreach way, $(WAYS), $(way)/$(binary))))

include $(TOPDIR)/mk/common.mk

ifeq (,$(BINARY))
.PHONY: all $(DPH_BINARIES) force

all: $(DPH_BINARIES)

$(DPH_BINARIES): force
	$(MAKE) BINARY=$(AUTO_BINARY) WAY=$(AUTO_WAY)

force:
else

ifeq ($($(BINARY)_DPH),prim)
WAY_FLAGS = -package dph-prim-$(WAY) -odir $(WAY) -hidir $(WAY)
else
WAY_FLAGS = -fdph-$(WAY) -package dph-$(WAY) -package dph-prim-$(WAY) -odir $(WAY) -hidir $(WAY)
endif

$(WAY)/$(BINARY): $($(BINARY)_SOURCES) $(BENCH_DEP)
	@mkdir $(WAY) || true
	$(HC) -o $@ --make $< $(DPH_FLAGS) $(WAY_FLAGS) $(BENCH_FLAGS)

endif

.PHONY: clean

clean:
	$(RM) -r $(WAYS)

.PHONY: bench

$(BENCH_DEP):
	cd $(BENCH_DIR) && $(MAKE)

Simplify flags for compiling examples

WAYS = seq par

AUTO_BINARY = $(notdir $@)
AUTO_WAY  = $(patsubst %/,%,$(dir $@))

DPH_BINARIES = $(foreach binary, $(BINARIES), $(if $($(binary)_DPH), $(foreach way, $(WAYS), $(way)/$(binary))))

include $(TOPDIR)/mk/common.mk

ifeq (,$(BINARY))
.PHONY: all $(DPH_BINARIES) force

all: $(DPH_BINARIES)

$(DPH_BINARIES): force
	$(MAKE) BINARY=$(AUTO_BINARY) WAY=$(AUTO_WAY)

force:
else

WAY_FLAGS = -fdph-$(WAY) -odir $(WAY) -hidir $(WAY)

$(WAY)/$(BINARY): $($(BINARY)_SOURCES) $(BENCH_DEP)
	@mkdir $(WAY) || true
	$(HC) -o $@ --make $< $(DPH_FLAGS) $(WAY_FLAGS) $(BENCH_FLAGS)

endif

.PHONY: clean

clean:
	$(RM) -r $(WAYS)

.PHONY: bench

$(BENCH_DEP):
	cd $(BENCH_DIR) && $(MAKE)


# TARGETS #

# Run fixture runners.
#
# This target runs scripts written in C to generate test fixtures.

test-fixtures-c:
	$(QUIET) $(FIND_C_TESTS_FIXTURES_CMD) | grep '^[\/]\|^[a-zA-Z]:[/\]' | while read -r file; do \
		echo ""; \
		echo "Generating test fixtures: $$file"; \
		cd `dirname $$file` && \
		$(MAKE) clean && \
		$(MAKE) && \
		$(MAKE) run || exit 1; \
	done

.PHONY: test-fixtures-c

# Run fixture runners.
#
# This target runs a list of scripts written in C to generate fixtures.

test-fixtures-c-files:
	$(QUIET) for file in $(FILES); do \
		echo ""; \
		echo "Generating test fixtures: $$file"; \
		cd `dirname $$file` && \
		$(MAKE) clean && \
		$(MAKE) && \
		$(MAKE) run || exit 1; \
	done

.PHONY: test-fixtures-c-files

Add support for generating test fixtures via Cephes

# TARGETS #

# Run fixture runners.
#
# This target runs scripts written in C to generate test fixtures.

test-fixtures-c:
	$(QUIET) $(FIND_C_TESTS_FIXTURES_CMD) | grep '^[\/]\|^[a-zA-Z]:[/\]' | while read -r file; do \
		echo ""; \
		echo "Generating test fixtures: $$file"; \
		cd `dirname $$file` && \
		$(MAKE) clean && \
		CEPHES=$(DEPS_CEPHES_BUILD_OUT) CEPHES_SRC="$(DEPS_CEPHES_SRC)" $(MAKE) && \
		$(MAKE) run || exit 1; \
	done

.PHONY: test-fixtures-c

# Run fixture runners.
#
# This target runs a list of scripts written in C to generate fixtures.

test-fixtures-c-files:
	$(QUIET) for file in $(FILES); do \
		echo ""; \
		echo "Generating test fixtures: $$file"; \
		cd `dirname $$file` && \
		$(MAKE) clean && \
		CEPHES=$(DEPS_CEPHES_BUILD_OUT) CEPHES_SRC="$(DEPS_CEPHES_SRC)" $(MAKE) && \
		$(MAKE) run || exit 1; \
	done

.PHONY: test-fixtures-c-files


# 28 april 2015

osMFILES = \
	darwin/alloc.m \
	darwin/bin.m \
	darwin/button.m \
	darwin/checkbox.m \
	darwin/container.m \
	darwin/entry.m \
	darwin/init.m \
	darwin/label.m \
	darwin/main.m \
	darwin/menu.m \
	darwin/newcontrol.m \
	darwin/tab.m \
	darwin/text.m \
	darwin/util.m \
	darwin/window.m

osHFILES = \
	darwin/uipriv_darwin.h

osCFLAGS = -mmacosx-version-min=10.7 -DMACOSX_DEPLOYMENT_TARGET=10.7
osLDFLAGS = -mmacosx-version-min=10.7 -lobjc -framework Foundation -framework AppKit

# the gcc flags don't work with Apple's linker
# fortunately, we don't need any; Apple's linker warns about undefined symbols in -shared builds!
osLDWarnUndefinedFlags =

osLIBSUFFIX = .dylib
osEXESUFFIX =

Set up a shortcut for 32-bit builds on OS X.

# 28 april 2015

osMFILES = \
	darwin/alloc.m \
	darwin/bin.m \
	darwin/button.m \
	darwin/checkbox.m \
	darwin/container.m \
	darwin/entry.m \
	darwin/init.m \
	darwin/label.m \
	darwin/main.m \
	darwin/menu.m \
	darwin/newcontrol.m \
	darwin/tab.m \
	darwin/text.m \
	darwin/util.m \
	darwin/window.m

osHFILES = \
	darwin/uipriv_darwin.h

osCFLAGS = -mmacosx-version-min=10.7 -DMACOSX_DEPLOYMENT_TARGET=10.7
osLDFLAGS = -mmacosx-version-min=10.7 -lobjc -framework Foundation -framework AppKit

# the gcc flags don't work with Apple's linker
# fortunately, we don't need any; Apple's linker warns about undefined symbols in -shared builds!
osLDWarnUndefinedFlags =

osLIBSUFFIX = .dylib
osEXESUFFIX =

ifeq ($(ARCH),386)
	osCFLAGS += -m32
	osLDFLAGS += -m32
endif


# 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)

Add missing LOCAL_MIN_SDK_VERSION for Support Library demos

# 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_MIN_SDK_VERSION := 7
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)


mutate: test ## Run mutation tests
	@echo "Running mutation tests"
	@MUTATING=true bundle exec mutant --include lib \
		$(addprefix --require ,$(REQUIRE)) \
		$(addprefix --ignore-subject ,$(IGNORE)) \
		--use rspec "$(SUBJECT)"

mutate-fast: ## Run mutation tests with --fail-fast
	@echo "Running mutation tests"
	@MUTATING=true bundle exec mutant --include lib \
		$(addprefix --require ,$(REQUIRE)) \
		$(addprefix --ignore-subject ,$(IGNORE)) \
		--fail-fast \
		--use rspec "$(SUBJECT)"

mutate-changes: ## Run mutation tests for all changes since origin/HEAD
	@echo "Running mutation tests"
	@MUTATING=true bundle exec mutant --include lib \
		$(addprefix --require ,$(REQUIRE)) \
		$(addprefix --ignore-subject ,$(IGNORE)) \
		--since origin/HEAD \
		--use rspec "$(SUBJECT)"

Fix implicit DATABASE_URL for mutation testing.

mutate: test ## Run mutation tests
	@echo "Running mutation tests"
	@MUTATING=true DATABASE_URL=$(DATABASE_URL) bundle exec mutant --include lib \
		$(addprefix --require ,$(REQUIRE)) \
		$(addprefix --ignore-subject ,$(IGNORE)) \
		--use rspec "$(SUBJECT)"

mutate-fast: ## Run mutation tests with --fail-fast
	@echo "Running mutation tests"
	@MUTATING=true DATABASE_URL=$(DATABASE_URL) bundle exec mutant --include lib \
		$(addprefix --require ,$(REQUIRE)) \
		$(addprefix --ignore-subject ,$(IGNORE)) \
		--fail-fast \
		--use rspec "$(SUBJECT)"

mutate-changes: ## Run mutation tests for all changes since origin/HEAD
	@echo "Running mutation tests"
	@MUTATING=true DATABASE_URL=$(DATABASE_URL) bundle exec mutant --include lib \
		$(addprefix --require ,$(REQUIRE)) \
		$(addprefix --ignore-subject ,$(IGNORE)) \
		--since origin/HEAD \
		--use rspec "$(SUBJECT)"


build/fetch.tag: cookbook installer prefix $(FILESYSTEM_CONFIG)
	$(HOST_CARGO) build --manifest-path cookbook/Cargo.toml --release
	$(HOST_CARGO) build --manifest-path installer/Cargo.toml --release
	PACKAGES="$$($(INSTALLER) --list-packages -c $(FILESYSTEM_CONFIG))" && \
	cd cookbook && \
	./fetch.sh "$${PACKAGES}"
	touch $@

build/repo.tag: build/fetch.tag
	$(HOST_CARGO) build --manifest-path cookbook/Cargo.toml --release
	$(HOST_CARGO) build --manifest-path installer/Cargo.toml --release
	export PATH="$(PREFIX_PATH):$$PATH" && \
	PACKAGES="$$($(INSTALLER) --list-packages -c $(FILESYSTEM_CONFIG))" && \
	cd cookbook && \
	./repo.sh "$${PACKAGES}"
	mkdir -p build
	touch $@

Fix missing build directory when making fetch tag

build/fetch.tag: cookbook installer prefix $(FILESYSTEM_CONFIG)
	$(HOST_CARGO) build --manifest-path cookbook/Cargo.toml --release
	$(HOST_CARGO) build --manifest-path installer/Cargo.toml --release
	PACKAGES="$$($(INSTALLER) --list-packages -c $(FILESYSTEM_CONFIG))" && \
	cd cookbook && \
	./fetch.sh "$${PACKAGES}"
	mkdir -p build
	touch $@

build/repo.tag: build/fetch.tag
	$(HOST_CARGO) build --manifest-path cookbook/Cargo.toml --release
	$(HOST_CARGO) build --manifest-path installer/Cargo.toml --release
	export PATH="$(PREFIX_PATH):$$PATH" && \
	PACKAGES="$$($(INSTALLER) --list-packages -c $(FILESYSTEM_CONFIG))" && \
	cd cookbook && \
	./repo.sh "$${PACKAGES}"
	mkdir -p build
	touch $@


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


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

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

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

LOCAL_C_INCLUDES +=

LOCAL_SHARED_LIBRARIES := libstlport libparameter

LOCAL_LDLIBS +=
LOCAL_LDFLAGS +=

include $(BUILD_SHARED_LIBRARY)

Update CFLAGS to add Wall, Werror, Wextra everywhere

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

LOCAL_CFLAGS += \
        -Wall \
        -Werror \
        -Wextra \
        -Wno-unused-parameter

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

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

LOCAL_C_INCLUDES +=

LOCAL_SHARED_LIBRARIES := libstlport libparameter

LOCAL_LDLIBS +=
LOCAL_LDFLAGS +=

include $(BUILD_SHARED_LIBRARY)


# DO NOT EDIT!  Instead, create a file mk/validate.mk, whose settings will
# override these.  See also mk/custom-settings.mk.

WERROR          = -Werror

HADDOCK_DOCS    = YES
SRC_CC_OPTS     += -Wall $(WERROR)
SRC_HC_OPTS     += -Wall $(WERROR) -H64m -O0 -fasm

# Temporary hack until we fix the libraries. See #3263 for details.
GhcLibHcOpts    += -fno-warn-unused-do-bind

GhcStage1HcOpts += -O -fasm

GhcStage2HcOpts += -O -fasm
# Using -O (rather than -O0) here bringes my validate down from 22mins to 16 mins.
# Compiling stage2 takes longer, but we gain a faster haddock, faster
# running of the tests, and faster building of the utils to be installed

GhcLibHcOpts    += -O -fasm -dcore-lint
GhcLibWays      = v
SplitObjs       = NO
NoFibWays       =
STRIP           = :

ifeq "$(ValidateHpc)" "YES"
GhcStage2HcOpts += -fhpc -hpcdir $(TOP)/testsuite/hpc_output/
endif
ifeq "$(ValidateSlow)" "YES"
GhcStage2HcOpts += -XGenerics -DDEBUG
GhcLibHcOpts    += -XGenerics
endif

Stop using -fno-warn-unused-do-bind when compiling the libraries They're now fixed to not generate those warnings

# DO NOT EDIT!  Instead, create a file mk/validate.mk, whose settings will
# override these.  See also mk/custom-settings.mk.

WERROR          = -Werror

HADDOCK_DOCS    = YES
SRC_CC_OPTS     += -Wall $(WERROR)
SRC_HC_OPTS     += -Wall $(WERROR) -H64m -O0 -fasm

GhcStage1HcOpts += -O -fasm

GhcStage2HcOpts += -O -fasm
# Using -O (rather than -O0) here bringes my validate down from 22mins to 16 mins.
# Compiling stage2 takes longer, but we gain a faster haddock, faster
# running of the tests, and faster building of the utils to be installed

GhcLibHcOpts    += -O -fasm -dcore-lint
GhcLibWays      = v
SplitObjs       = NO
NoFibWays       =
STRIP           = :

ifeq "$(ValidateHpc)" "YES"
GhcStage2HcOpts += -fhpc -hpcdir $(TOP)/testsuite/hpc_output/
endif
ifeq "$(ValidateSlow)" "YES"
GhcStage2HcOpts += -XGenerics -DDEBUG
GhcLibHcOpts    += -XGenerics
endif


# config.mk
#
# Product-specific compile-time definitions.
#

# The generic product target doesn't have any hardware-specific pieces.
TARGET_NO_BOOTLOADER := true
TARGET_NO_KERNEL := true
TARGET_CPU_ABI := armeabi
HAVE_HTC_AUDIO_DRIVER := true
BOARD_USES_GENERIC_AUDIO := true

# no hardware camera
USE_CAMERA_STUB := true

# Set /system/bin/sh to mksh, not ash, to test the transition.
TARGET_SHELL := mksh

Build emulator platform images as ARMv7-A

# config.mk
#
# Product-specific compile-time definitions.
#

# The generic product target doesn't have any hardware-specific pieces.
TARGET_NO_BOOTLOADER := true
TARGET_NO_KERNEL := true

# Note: we build the platform images for ARMv7-A _without_ NEON.
#
# Technically, the emulator supports ARMv7-A _and_ NEON instructions, but
# emulated NEON code paths typically ends up 2x slower than the normal C code
# it is supposed to replace (unlike on real devices where it is 2x to 3x
# faster).
#
# What this means is that the platform image will not use NEON code paths
# that are slower to emulate. On the other hand, it is possible to emulate
# application code generated with the NDK that uses NEON in the emulator.
#
TARGET_ARCH_VARIANT := armv7-a
TARGET_CPU_ABI := armeabi-v7a
TARGET_CPU_ABI2 := armeabi

HAVE_HTC_AUDIO_DRIVER := true
BOARD_USES_GENERIC_AUDIO := true

# no hardware camera
USE_CAMERA_STUB := true

# Set /system/bin/sh to mksh, not ash, to test the transition.
TARGET_SHELL := mksh


SKIP_SQUASH?=0

build = hack/build.sh

ifeq ($(TARGET),rhel7)
	OS := rhel7
else
	OS := centos7
endif

script_env = \
	SKIP_SQUASH=$(SKIP_SQUASH)                      \
	UPDATE_BASE=$(UPDATE_BASE)                      \
	VERSIONS="$(VERSIONS)"                          \
	OS=$(OS)                                        \
	VERSION=$(VERSION)                              \
	BASE_IMAGE_NAME=$(BASE_IMAGE_NAME)              \
	OPENSHIFT_NAMESPACES="$(OPENSHIFT_NAMESPACES)"

.PHONY: build
build:
	$(script_env) $(build)

.PHONY: test
test:
	$(script_env) TAG_ON_SUCCESS=$(TAG_ON_SUCCESS) TEST_MODE=true $(build)

Fix selecting versions to build

SKIP_SQUASH?=0

build = hack/build.sh

ifeq ($(TARGET),rhel7)
	OS := rhel7
else
	OS := centos7
endif

script_env = \
	SKIP_SQUASH=$(SKIP_SQUASH)                      \
	UPDATE_BASE=$(UPDATE_BASE)                      \
	VERSIONS="$(VERSIONS)"                          \
	OS=$(OS)                                        \
	VERSION="$(VERSION)"                            \
	BASE_IMAGE_NAME=$(BASE_IMAGE_NAME)              \
	OPENSHIFT_NAMESPACES="$(OPENSHIFT_NAMESPACES)"

.PHONY: build
build:
	$(script_env) $(build)

.PHONY: test
test:
	$(script_env) TAG_ON_SUCCESS=$(TAG_ON_SUCCESS) TEST_MODE=true $(build)


<%inherit file="../master.mak" />

LN

Lecture Notes: Agenda-y type things to keep the train on the tracks

Notes

            % for lecture in lectures:

Week ${lecture[1]} - Class
              ${lecture[3]}

            % endfor

Change template to account for double-digit week numbers. @qalthos++

<%inherit file="../master.mak" />

LN

Lecture Notes: Agenda-y type things to keep the train on the tracks

Notes

            % for lecture in lectures:

Week ${lecture[1:3]} - Class
              ${lecture[4]}

            % endfor


# velox: protocol/local.mk

dir := protocol

PROTOCOL_EXTENSIONS =                                       \
    $(dir)/velox.xml                                        \
    $(call pkgconfig,swc,variable=datadir,DATADIR)/swc.xml

protocol = $(foreach extension,$(1),protocol/$(extension)-protocol.o)
client_protocol = $(foreach extension,$(1),protocol/$(extension)-client-protocol.h)

define protocol_rules

$(dir)/$$(basename $$(notdir $(1)))-protocol.c: $(1)
	$$(call quiet,GEN,$(WAYLAND_SCANNER)) code < $$< > $$@
$(dir)/$$(basename $$(notdir $(1)))-client-protocol.h: $(1)
	$$(call quiet,GEN,$(WAYLAND_SCANNER)) client-header < $$< > $$@
$(dir)/$$(basename $$(notdir $(1)))-server-protocol.h: $(1)
	$$(call quiet,GEN,$(WAYLAND_SCANNER)) server-header < $$< > $$@

CLEAN_FILES += $(foreach type,protocol.c client-protocol.h server-protocol.h, \
                 $(dir)/$$(basename $$(notdir $(1)))-$(type))

endef

$(eval $(foreach extension,$(PROTOCOL_EXTENSIONS),$(call protocol_rules,$(extension))))

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

include common.mk

Add wayland-server dependency to protocol objects

# velox: protocol/local.mk

dir := protocol

PROTOCOL_EXTENSIONS =                                       \
    $(dir)/velox.xml                                        \
    $(call pkgconfig,swc,variable=datadir,DATADIR)/swc.xml

$(dir)_PACKAGES = wayland-server

protocol = $(foreach extension,$(1),protocol/$(extension)-protocol.o)
client_protocol = $(foreach extension,$(1),protocol/$(extension)-client-protocol.h)

define protocol_rules

$(dir)/$$(basename $$(notdir $(1)))-protocol.c: $(1)
	$$(call quiet,GEN,$(WAYLAND_SCANNER)) code < $$< > $$@
$(dir)/$$(basename $$(notdir $(1)))-client-protocol.h: $(1)
	$$(call quiet,GEN,$(WAYLAND_SCANNER)) client-header < $$< > $$@
$(dir)/$$(basename $$(notdir $(1)))-server-protocol.h: $(1)
	$$(call quiet,GEN,$(WAYLAND_SCANNER)) server-header < $$< > $$@

CLEAN_FILES += $(foreach type,protocol.c client-protocol.h server-protocol.h, \
                 $(dir)/$$(basename $$(notdir $(1)))-$(type))

endef

$(eval $(foreach extension,$(PROTOCOL_EXTENSIONS),$(call protocol_rules,$(extension))))

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

include common.mk


# This file is intentially left empty to indicate that, while this target is
# supported, it's not supported using plain GNU Make builds. Use a --rustbuild
# instead.

Add config for musl-based arm builds

# arm-unknown-linux-musleabi configuration
CROSS_PREFIX_arm-unknown-linux-musleabi=arm-linux-musleabi-
CC_arm-unknown-linux-musleabi=gcc
CXX_arm-unknown-linux-musleabi=g++
CPP_arm-unknown-linux-musleabi=gcc -E
AR_arm-unknown-linux-musleabi=ar
CFG_LIB_NAME_arm-unknown-linux-musleabi=lib$(1).so
CFG_STATIC_LIB_NAME_arm-unknown-linux-musleabi=lib$(1).a
CFG_LIB_GLOB_arm-unknown-linux-musleabi=lib$(1)-*.so
CFG_LIB_DSYM_GLOB_arm-unknown-linux-musleabi=lib$(1)-*.dylib.dSYM
CFG_JEMALLOC_CFLAGS_arm-unknown-linux-musleabi := -D__arm__ $(CFLAGS)
CFG_GCCISH_CFLAGS_arm-unknown-linux-musleabi := -Wall -g -fPIC -D__arm__ $(CFLAGS)
CFG_GCCISH_CXXFLAGS_arm-unknown-linux-musleabi := -fno-rtti $(CXXFLAGS)
CFG_GCCISH_LINK_FLAGS_arm-unknown-linux-musleabi := -shared -fPIC -g
CFG_GCCISH_DEF_FLAG_arm-unknown-linux-musleabi := -Wl,--export-dynamic,--dynamic-list=
CFG_LLC_FLAGS_arm-unknown-linux-musleabi :=
CFG_INSTALL_NAME_arm-unknown-linux-musleabi =
CFG_EXE_SUFFIX_arm-unknown-linux-musleabi :=
CFG_WINDOWSY_arm-unknown-linux-musleabi :=
CFG_UNIXY_arm-unknown-linux-musleabi := 1
CFG_LDPATH_arm-unknown-linux-musleabi :=
CFG_RUN_arm-unknown-linux-musleabi=$(2)
CFG_RUN_TARG_arm-unknown-linux-musleabi=$(call CFG_RUN_arm-unknown-linux-musleabi,,$(2))
RUSTC_FLAGS_arm-unknown-linux-musleabi :=
RUSTC_CROSS_FLAGS_arm-unknown-linux-musleabi :=
CFG_GNU_TRIPLE_arm-unknown-linux-musleabi := arm-unknown-linux-musleabi
# This file is intentially left empty to indicate that, while this target is
# supported, it's not supported using plain GNU Make builds. Use a --rustbuild
# instead.


# Helper for get npm package release notes for Github

REPO_LINK := https://github.com/user/repo

### Get current version from package.json
current:
	$(eval LAST_VERSION := $(shell npm ls --depth=0 2>/dev/null | head -n 1 | awk 'match($$0, /@([0-9.]+)/, arr) { print arr[1]; }'))
	@echo Current version is $(LAST_VERSION)

### Save new version number/string
ifeq (version,$(firstword $(MAKECMDGOALS)))
  NEW_VERSION := $(wordlist 2,$(words $(MAKECMDGOALS)),$(MAKECMDGOALS))
  $(eval $(NEW_VERSION):;@:)
endif

### Update version
version:: current
	$(eval NEW_VERSION_TAG := $(shell npm version $(NEW_VERSION)))
	@echo
	@echo "[Full diff]($(REPO_LINK)/compare/v$(LAST_VERSION)...$(NEW_VERSION_TAG))"
	@git log --skip=1 --format='%h %s @%an' v$(LAST_VERSION)..$(NEW_VERSION_TAG)

Add usage info for npm github release

# Helper for get npm package release notes for Github
# usage:
#     make current - show current version
#     make version <patch | minor | major | 3.4.5> — increase npm package version

REPO_LINK := https://github.com/user/repo

### Get current version from package.json
current:
	$(eval LAST_VERSION := $(shell npm ls --depth=0 2>/dev/null | head -n 1 | awk 'match($$0, /@([0-9.]+)/, arr) { print arr[1]; }'))
	@echo Current version is $(LAST_VERSION)

### Save new version number/string
ifeq (version,$(firstword $(MAKECMDGOALS)))
  NEW_VERSION := $(wordlist 2,$(words $(MAKECMDGOALS)),$(MAKECMDGOALS))
  $(eval $(NEW_VERSION):;@:)
endif

### Update version
version:: current
	$(eval NEW_VERSION_TAG := $(shell npm version $(NEW_VERSION)))
	@echo
	@echo "[Full diff]($(REPO_LINK)/compare/v$(LAST_VERSION)...$(NEW_VERSION_TAG))"
	@git log --skip=1 --format='%h %s @%an' v$(LAST_VERSION)..$(NEW_VERSION_TAG)


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

include $(HEADER)

ZEROMQ_HOME := /opt/zeromq/latest

# --------------------------------------------------
NAME     := zmqtest
VERSION  := 1.0.0
RELEASE  := 1
REQUIRES := zeromq
$(call setup)
# --------------------------------------------------

_CXXFLAGS := -std=c++11
_LDFLAGS  := -rdynamic -Wl,-rpath=../lib -Wl,-rpath=./lib -Wl,-rpath=$(TGTDIR)

TARGETS := recordertest servertest foo

recordertest_SRCS := \
	src/main_recorder.cpp \
	src/RecorderBase.cpp \
	src/RecorderTypes.cpp \
	src/RecorderHDF5.cpp

recordertest_USES := zeromq protobuf
recordertest_LINK := zmq protobuf pthread boost_program_options

servertest_SRCS := src/main_server.cpp
servertest_USES := zeromq
servertest_LINK := zmq pthread

foo_SRCS := src/main_foo.cpp

include $(FOOTER)

Add ORIGIN to link flags

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

include $(HEADER)

ZEROMQ_HOME := /opt/zeromq/latest

# --------------------------------------------------
NAME     := zmqtest
VERSION  := 1.0.0
RELEASE  := 1
REQUIRES := zeromq
$(call setup)
# --------------------------------------------------

_CXXFLAGS := -std=c++11
_LDFLAGS  := \
	-rdynamic \
	-Wl,-z,origin \
	-Wl,-rpath=\$$$$ORIGIN/../lib \
	-Wl,-rpath=$(TGTDIR) \
	-Wl,-rpath=$(ZEROMQ_HOME)/lib

TARGETS := recordertest servertest foo

recordertest_SRCS := \
	src/main_recorder.cpp \
	src/RecorderBase.cpp \
	src/RecorderTypes.cpp \
	src/RecorderHDF5.cpp

recordertest_USES := zeromq protobuf
recordertest_LINK := zmq protobuf pthread boost_program_options

servertest_SRCS := src/main_server.cpp
servertest_USES := zeromq
servertest_LINK := zmq pthread

foo_SRCS := src/main_foo.cpp

include $(FOOTER)


SRC	 ?= $(wildcard *.el)
COMPILED  = $(patsubst %.el,$(DEST)/%.elc,$(SRC))

EMACS = emacs
EMACS_FLAGS = -q --no-site-file --batch
EMACS_FLAGS += --eval "(add-to-list 'load-path \".\")"
EMACS_FLAGS += --eval "(load \"$(CURDIR)/../emacs.d/pmade-loadpath\")"
EMACS_FLAGS += -f batch-byte-compile

.PHONEY: all

all: $(DEST) $(COMPILED) $(addprefix $(DEST)/,$(TO_REMOVE))
	@:

uninstall:
	rm -f $(COMPILED)

.SUFFIXES: .el .elc

$(DEST)/%.elc: %.el
	@ echo emacs compile $<
	@ $(EMACS) $(EMACS_FLAGS) $< #2> /dev/null
	@ mv $(<:.el=.elc) $@

$(DEST):
	mkdir -p $@

$(addprefix $(DEST)/,$(TO_REMOVE))::
	@ rm -f $@

Fix makefiles for *.el files

SRC	 ?= $(wildcard *.el)
COMPILED  = $(patsubst %.el,$(DEST)/%.elc,$(SRC))
PMADE_LOAD_PATH ?= $(CURDIR)/../emacs.d/pmade-loadpath

EMACS = emacs
EMACS_FLAGS = -q --no-site-file --batch
EMACS_FLAGS += --eval "(add-to-list 'load-path \".\")"
EMACS_FLAGS += --eval "(load \"$(PMADE_LOAD_PATH)\")"
EMACS_FLAGS += -f batch-byte-compile

.PHONEY: all

all: $(DEST) $(COMPILED) $(addprefix $(DEST)/,$(TO_REMOVE))
	@:

uninstall:
	rm -f $(COMPILED)

.SUFFIXES: .el .elc

$(DEST)/%.elc: %.el
	@ echo emacs compile $<
	@ $(EMACS) $(EMACS_FLAGS) $< #2> /dev/null
	@ mv $(<:.el=.elc) $@

$(DEST):
	mkdir -p $@

$(addprefix $(DEST)/,$(TO_REMOVE))::
	@ rm -f $@


include snel-variables.mk

ifndef PROTOCOL
    PROTOCOL := ssh
endif
ifndef USER
    $(error Variable USER is not set)
endif
ifndef HOST
    $(error Variable HOST is not set)
endif
ifndef REMOTE_DIR
    REMOTE_DIR := /home/$(USER)/public_html
endif
ifndef PORT
ifeq ($(PROTOCOL),ssh)
    PORT := 22
else
    PORT := 20
endif
endif

upload: upload-$(PROTOCOL)

upload-ftp:
	read -s -p 'FTP password: ' password && \
	lftp -u "$(USER),$$password" -p "$(PORT)" \
	-e "mirror --reverse --only-newer --verbose --dry-run --exclude $(CACHE) $(DEST) $(REMOTE_DIR)" \
	$(HOST)

upload-ssh:
	rsync -e "ssh -p $(PORT)" \
		--recursive --times --copy-links --verbose --progress \
		--exclude="$(CACHE)" \
		 $(HOST) $(USER)@$(HOST):'$(REMOTE_DIR)'

Fix mistake --- had put the wrong directory.

include snel-variables.mk

ifndef PROTOCOL
    PROTOCOL := ssh
endif
ifndef USER
    $(error Variable USER is not set)
endif
ifndef HOST
    $(error Variable HOST is not set)
endif
ifndef REMOTE_DIR
    REMOTE_DIR := /home/$(USER)/public_html
endif
ifndef PORT
ifeq ($(PROTOCOL),ssh)
    PORT := 22
else
    PORT := 20
endif
endif

upload: upload-$(PROTOCOL)

upload-ftp:
	read -s -p 'FTP password: ' password && \
	lftp -u "$(USER),$$password" -p "$(PORT)" \
	-e "mirror --reverse --only-newer --verbose --dry-run --exclude $(CACHE) $(DEST) $(REMOTE_DIR)" \
	$(HOST)

upload-ssh:
	rsync -e "ssh -p $(PORT)" \
		--recursive --times --copy-links --verbose --progress \
		--exclude="$(CACHE)" \
		"$(DEST)/" $(USER)@$(HOST):'$(REMOTE_DIR)/'


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

LOCAL_PATH := $(call my-dir)

# Here is the final static library that apps can link against.
# Applications that use this library must specify
#
#   LOCAL_STATIC_ANDROID_LIBRARIES := android-support-v7-cardview
#
# in their makefiles to include the resources in their package.
include $(CLEAR_VARS)
LOCAL_USE_AAPT2 := true
LOCAL_MODULE := android-support-v7-cardview
LOCAL_SDK_VERSION := $(SUPPORT_CURRENT_SDK_VERSION)
LOCAL_SRC_FILES := \
    $(call all-java-files-under,src/main/java)
LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res
LOCAL_JAVA_LIBRARIES := \
    android-support-annotations
LOCAL_JAR_EXCLUDE_FILES := none
LOCAL_JAVA_LANGUAGE_VERSION := 1.7
LOCAL_AAPT_FLAGS := --add-javadoc-annotation doconly
include $(BUILD_STATIC_JAVA_LIBRARY)

Make cardview aapt2 only library.

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

LOCAL_PATH := $(call my-dir)

# Here is the final static library that apps can link against.
# Applications that use this library must specify
#
#   LOCAL_STATIC_ANDROID_LIBRARIES := android-support-v7-cardview
#
# in their makefiles to include the resources in their package.
include $(CLEAR_VARS)
LOCAL_USE_AAPT2 := true
LOCAL_AAPT2_ONLY := true
LOCAL_MODULE := android-support-v7-cardview
LOCAL_SDK_VERSION := $(SUPPORT_CURRENT_SDK_VERSION)
LOCAL_SRC_FILES := \
    $(call all-java-files-under,src/main/java)
LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res
LOCAL_JAVA_LIBRARIES := \
    android-support-annotations
LOCAL_JAR_EXCLUDE_FILES := none
LOCAL_JAVA_LANGUAGE_VERSION := 1.7
LOCAL_AAPT_FLAGS := --add-javadoc-annotation doconly
include $(BUILD_STATIC_JAVA_LIBRARY)


# -*- 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_Library_Library,pdfimport))

$(eval $(call gb_Library_set_componentfile,pdfimport,sdext/source/pdfimport/pdfimport))

$(eval $(call gb_Library_use_sdk_api,pdfimport))

$(eval $(call gb_Library_set_include,pdfimport,\
    -I$(SRCDIR)/sdext/source/pdfimport/inc \
    $$(INCLUDE) \
))

$(eval $(call gb_Library_use_libraries,pdfimport,\
    basegfx \
    vcl \
    cppu \
    cppuhelper \
    sal \
))

$(eval $(call gb_Library_use_static_libraries,pdfimport,\
    pdfimport_s \
))

$(eval $(call gb_Library_use_externals,pdfimport,\
	boost_headers \
    $(if $(filter-out WNT MACOSX,$(OS)),fontconfig) \
    zlib \
    poppler \
))

$(eval $(call gb_Library_add_exception_objects,pdfimport,\
    sdext/source/pdfimport/services \
))

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

Correct linker library sequence for pdfimport

# -*- 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_Library_Library,pdfimport))

$(eval $(call gb_Library_set_componentfile,pdfimport,sdext/source/pdfimport/pdfimport))

$(eval $(call gb_Library_use_sdk_api,pdfimport))

$(eval $(call gb_Library_set_include,pdfimport,\
    -I$(SRCDIR)/sdext/source/pdfimport/inc \
    $$(INCLUDE) \
))

$(eval $(call gb_Library_use_libraries,pdfimport,\
    basegfx \
    vcl \
    cppu \
    cppuhelper \
    sal \
))

$(eval $(call gb_Library_use_static_libraries,pdfimport,\
    pdfimport_s \
))

$(eval $(call gb_Library_use_externals,pdfimport,\
	boost_headers \
    zlib \
    poppler \
    $(if $(filter-out WNT MACOSX,$(OS)),fontconfig) \
))

$(eval $(call gb_Library_add_exception_objects,pdfimport,\
    sdext/source/pdfimport/services \
))

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


L_CFLAGS = -nostdlib -emain -fpie -N

$(LOADABLE_DIR)/$(DST) : | $(LOADABLE_DIR)
$(LOADABLE_DIR)/$(DST) : $(SRC)
	$(EMBOX_CROSS_COMPILE)gcc $(EMBOX_CFLAGS) $(L_CFLAGS) -o $@ $<

$(LOADABLE_DIR) :
	mkdir -p $@

Fix compilation for loadable apps

L_CFLAGS = -nostdlib -emain -fpie -static

$(LOADABLE_DIR)/$(DST) : | $(LOADABLE_DIR)
$(LOADABLE_DIR)/$(DST) : $(SRC)
	$(EMBOX_CROSS_COMPILE)gcc $(EMBOX_CFLAGS) $(L_CFLAGS) -o $@ $<

$(LOADABLE_DIR) :
	mkdir -p $@


package=bdb
$(package)_version=6.2.23
$(package)_download_path=http://download.oracle.com/berkeley-db
$(package)_file_name=db-$($(package)_version).tar.gz
$(package)_sha256_hash=47612c8991aa9ac2f6be721267c8d3cdccf5ac83105df8e50809daea24e95dc7
$(package)_build_subdir=build_unix

define $(package)_set_vars
$(package)_config_opts=--disable-shared --enable-cxx --disable-replication
$(package)_config_opts_mingw32=--enable-mingw
$(package)_config_opts_linux=--with-pic
$(package)_cxxflags=-std=c++11
endef

define $(package)_preprocess_cmds
  sed -i.old 's/__atomic_compare_exchange\\(/__atomic_compare_exchange_db(/' src/dbinc/atomic.h && \
  sed -i.old 's/atomic_init/atomic_init_db/' src/dbinc/atomic.h src/mp/mp_region.c src/mp/mp_mvcc.c src/mp/mp_fget.c src/mutex/mut_method.c src/mutex/mut_tas.c
endef

define $(package)_config_cmds
  ../dist/$($(package)_autoconf)
endef

define $(package)_build_cmds
  $(MAKE) libdb_cxx-6.2.a libdb-6.2.a
endef

define $(package)_stage_cmds
  $(MAKE) DESTDIR=$($(package)_staging_dir) install_lib install_include
endef

Upgrade Berkeley DB to 6.2.32

package=bdb
$(package)_version=6.2.32
$(package)_download_path=http://download.oracle.com/berkeley-db
$(package)_file_name=db-$($(package)_version).tar.gz
$(package)_sha256_hash=a9c5e2b004a5777aa03510cfe5cd766a4a3b777713406b02809c17c8e0e7a8fb
$(package)_build_subdir=build_unix

define $(package)_set_vars
$(package)_config_opts=--disable-shared --enable-cxx --disable-replication
$(package)_config_opts_mingw32=--enable-mingw
$(package)_config_opts_linux=--with-pic
$(package)_cxxflags=-std=c++11
endef

define $(package)_config_cmds
  ../dist/$($(package)_autoconf)
endef

define $(package)_build_cmds
  $(MAKE) libdb_cxx-6.2.a libdb-6.2.a
endef

define $(package)_stage_cmds
  $(MAKE) DESTDIR=$($(package)_staging_dir) install_lib install_include
endef


USB_VID = 0x239A
USB_PID = 0x811C
USB_PRODUCT = "Adafruit Feather ESP32S3 4MB Flash 2MB PSRAM"
USB_MANUFACTURER = "Adafruit"

IDF_TARGET = esp32s3

INTERNAL_FLASH_FILESYSTEM = 1
LONGINT_IMPL = MPZ

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

CIRCUITPY_ESP_FLASH_MODE = qio
CIRCUITPY_ESP_FLASH_FREQ = 40m
CIRCUITPY_ESP_FLASH_SIZE = 4MB

CIRCUITPY_PS2IO = 0

Save space on Feather S3 4mb with -Os

USB_VID = 0x239A
USB_PID = 0x811C
USB_PRODUCT = "Adafruit Feather ESP32S3 4MB Flash 2MB PSRAM"
USB_MANUFACTURER = "Adafruit"

IDF_TARGET = esp32s3

INTERNAL_FLASH_FILESYSTEM = 1
LONGINT_IMPL = MPZ

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

CIRCUITPY_ESP_FLASH_MODE = qio
CIRCUITPY_ESP_FLASH_FREQ = 40m
CIRCUITPY_ESP_FLASH_SIZE = 4MB

OPTIMIZATION_FLAGS = -Os


# Makefile for creating a PDF from a LaTeX project
LATEX = pdflatex
LATEXFLAGS = -halt-on-error -no-shell-escape
LATEXMK = latexmk
LATEXMKFLAGS = -f

FIGURES  = $(patsubst %.svg,%.pdf,$(wildcard *.svg)) \
           $(patsubst %.jpg,%.pdf,$(wildcard *.jpg)) \
           $(patsubst %.png,%.pdf,$(wildcard *.png))

.PHONY: all
all: ${FIGURES}
	$(LATEXMK) $(LATEXMKFLAGS) -pdflatex="$(LATEX) $(LATEXFLAGS) %O %S" \
		-pdf "$(notdir $(CURDIR:%/=%))"

%.pdf: %.svg
	inkscape --export-area-drawing --export-text-to-path \
		--export-ignore-filters --export-pdf=$@ $<

%.pdf: %.jpg
	convert $< $@

%.pdf: %.png
	convert $< $@

Use inkscape with flag --without-gui

# Makefile for creating a PDF from a LaTeX project
LATEX = pdflatex
LATEXFLAGS = -halt-on-error -no-shell-escape
LATEXMK = latexmk
LATEXMKFLAGS = -f

FIGURES  = $(patsubst %.svg,%.pdf,$(wildcard *.svg)) \
           $(patsubst %.jpg,%.pdf,$(wildcard *.jpg)) \
           $(patsubst %.png,%.pdf,$(wildcard *.png))

.PHONY: all
all: ${FIGURES}
	$(LATEXMK) $(LATEXMKFLAGS) -pdflatex="$(LATEX) $(LATEXFLAGS) %O %S" \
		-pdf "$(notdir $(CURDIR:%/=%))"

%.pdf: %.svg
	inkscape --without-gui --export-area-drawing --export-text-to-path \
		--export-ignore-filters --export-pdf=$@ $<

%.pdf: %.jpg
	convert $< $@

%.pdf: %.png
	convert $< $@


DEB_COMPONENT := monit
DEB_MAJOR_VERSION := 5.9${DEB_VERSION_QUALIFIER}
DEB_NAMES := monit

include build-infra/cw-deb.mk

.PHONY: deb-build-monit
deb-build-monit:
	echo "${DEB_COMPONENT} (${DEB_VERSION}) unstable; urgency=low" >debian/changelog
	echo " * build from revision $$(git rev-parse HEAD)" >>debian/changelog;\
	echo " -- $(CW_SIGNER_REAL) <$(CW_SIGNER)> $$(date -R)" >>debian/changelog
	debuild --no-lintian -b -uc -us

.PHONY: deb
deb: deb-build-monit deb-move

Rename repo in make file

DEB_COMPONENT := clearwater-monit
DEB_MAJOR_VERSION := 5.9${DEB_VERSION_QUALIFIER}
DEB_NAMES := clearwater-monit

include build-infra/cw-deb.mk

.PHONY: deb-build-monit
deb-build-monit:
	echo "${DEB_COMPONENT} (${DEB_VERSION}) unstable; urgency=low" >debian/changelog
	echo " * build from revision $$(git rev-parse HEAD)" >>debian/changelog;\
	echo " -- $(CW_SIGNER_REAL) <$(CW_SIGNER)> $$(date -R)" >>debian/changelog
	debuild --no-lintian -b -uc -us

.PHONY: deb
deb: deb-build-monit deb-move


.c.o:
	${CC} -c -DUSE_TCL_STUBS ${CFLAGS} ${TCL_DEFS} ${SHLIB_CFLAGS} $< -o $@

$(SHLIB_NAME):: ${OBJS}
	${SHLIB_LD} ${OBJS} -o ${SHLIB_NAME} ${TCL_STUB_LIB_SPEC} ${LIBS}

all:: ${SHLIB_NAME}

clean::
	rm -f ${OBJS} ${SHLIB_NAME} so_locations

distclean:: clean

install:: all
	$(INSTALL) -d -o ${DSTUSR} -g ${DSTGRP} -m 775 ${INSTALLDIR}
	$(INSTALL) -o ${DSTUSR} -g ${DSTGRP} -m 444 ${SHLIB_NAME} ${INSTALLDIR}
	$(SILENT) $(TCLSH) ../pkg_mkindex.tcl ${INSTALLDIR}

Use SHLIB_LDFLAGS when linking Pextlib

.c.o:
	${CC} -c -DUSE_TCL_STUBS ${CFLAGS} ${TCL_DEFS} ${SHLIB_CFLAGS} $< -o $@

$(SHLIB_NAME):: ${OBJS}
	${SHLIB_LD} ${OBJS} -o ${SHLIB_NAME} ${TCL_STUB_LIB_SPEC} ${SHLIB_LDFLAGS} ${LIBS}

all:: ${SHLIB_NAME}

clean::
	rm -f ${OBJS} ${SHLIB_NAME} so_locations

distclean:: clean

install:: all
	$(INSTALL) -d -o ${DSTUSR} -g ${DSTGRP} -m 775 ${INSTALLDIR}
	$(INSTALL) -o ${DSTUSR} -g ${DSTGRP} -m 444 ${SHLIB_NAME} ${INSTALLDIR}
	$(SILENT) $(TCLSH) ../pkg_mkindex.tcl ${INSTALLDIR}


CLASSES=\
	org.joval.test.automation.schema.ObjectFactory	\
	org.joval.test.automation.schema.package-info	\
	org.joval.test.automation.schema.Report	\
	org.joval.test.automation.schema.ResultEnumeration	\
	org.joval.test.automation.schema.TestDocument	\
	org.joval.test.automation.schema.TestResult	\
	org.joval.test.automation.schema.TestResults	\
	org.joval.test.automation.schema.TestSuite

Fix for build break on Linux.

CLASSES=\
	org.joval.test.automation.schema.ObjectFactory	\
	org.joval.test.automation.schema.package-info	\
	org.joval.test.automation.schema.Report	\
	org.joval.test.automation.schema.TestDocument	\
	org.joval.test.automation.schema.TestResult	\
	org.joval.test.automation.schema.TestResultEnumeration	\
	org.joval.test.automation.schema.TestResults	\
	org.joval.test.automation.schema.TestSuite


# example of local configuration
# copy to local.mk

# location of source
TOPDIR:=..

LTO:=n
ASAN:=n
TSAN:=n
UBSAN:=n

RENDERER:=vulkan

INTERNAL_glslang:=y
LDLIBS_glslang:=

INTERNAL_spirv-cross:=y
LDLIBS_spirv-cross:=

INTERNAL_spirv-headers:=y

INTERNAL_spirv-tools:=y
LDLIBS_spirv-tools:=

# compiler options etc
CXX:=g++
CC:=gcc
PYTHON:=/usr/bin/python

WIN32:=n

CFLAGS:=-g -Wall -Wextra -Werror -Wshadow
CFLAGS+=-Wno-unused-local-typedefs
CFLAGS+=$(shell sdl2-config --cflags)
OPTFLAGS:=-O
OPTFLAGS+=-ffast-math
OPTFLAGS+=-fdata-sections -ffunction-sections

# lazy assignment because CFLAGS is changed later
CXXFLAGS=$(CFLAGS)
CXXFLAGS+=-std=c++14

LDFLAGS:=-g -Wl,-rpath,. -Wl,-rpath,/usr/local/lib:./lib32
LDFLAGS+=-Wl,--gc-sections
# enable this if you're using gold linker
#LFDLAGS+=-Wl,--icf=all
LDLIBS:=-lpthread
LDLIBS_sdl2:=$(shell sdl2-config --libs)
LDLIBS_opengl:=-lGL
LDLIBS_vulkan:=-lvulkan

LTOCFLAGS:=-flto -fuse-linker-plugin -fno-fat-lto-objects
LTOLDFLAGS:=-flto -fuse-linker-plugin

OBJSUFFIX:=.o
EXESUFFIX:=-bin

Remove separate sections optimization from default configuration

# example of local configuration
# copy to local.mk

# location of source
TOPDIR:=..

LTO:=n
ASAN:=n
TSAN:=n
UBSAN:=n

RENDERER:=vulkan

INTERNAL_glslang:=y
LDLIBS_glslang:=

INTERNAL_spirv-cross:=y
LDLIBS_spirv-cross:=

INTERNAL_spirv-headers:=y

INTERNAL_spirv-tools:=y
LDLIBS_spirv-tools:=

# compiler options etc
CXX:=g++
CC:=gcc
PYTHON:=/usr/bin/python

WIN32:=n

CFLAGS:=-g -Wall -Wextra -Werror -Wshadow
CFLAGS+=-Wno-unused-local-typedefs
CFLAGS+=$(shell sdl2-config --cflags)
OPTFLAGS:=-O
OPTFLAGS+=-ffast-math

# lazy assignment because CFLAGS is changed later
CXXFLAGS=$(CFLAGS)
CXXFLAGS+=-std=c++14

LDFLAGS:=-g -Wl,-rpath,. -Wl,-rpath,/usr/local/lib:./lib32
LDLIBS:=-lpthread
LDLIBS_sdl2:=$(shell sdl2-config --libs)
LDLIBS_opengl:=-lGL
LDLIBS_vulkan:=-lvulkan

LTOCFLAGS:=-flto -fuse-linker-plugin -fno-fat-lto-objects
LTOLDFLAGS:=-flto -fuse-linker-plugin

OBJSUFFIX:=.o
EXESUFFIX:=-bin


# VARIABLES #

# Define the path to the executable to list installed package dependencies:
LIST_INSTALLED_PACKAGES ?= $(TOOLS_PKGS_DIR)/pkgs/installed/bin/cli

# Define the command flags:
LIST_INSTALLED_PACKAGES_FLAGS ?=

# TARGETS #

# List installed package dependencies.
#
# This target prints a list of all installed package dependencies.

list-pkgs-installed: $(NODE_MODULES) $(LIST_INSTALLED_PACKAGES)
	$(QUIET) $(NODE) $(LIST_INSTALLED_PACKAGES) $(LIST_INSTALLED_PACKAGES_FLAGS) $(ROOT_DIR)

.PHONY: list-pkgs-installed

Add recipes to print the installed pkg logical tree

# VARIABLES #

# Define the path to the executable to list installed package dependencies:
LIST_INSTALLED_PACKAGES ?= $(TOOLS_PKGS_DIR)/pkgs/installed/bin/cli

# Define the command flags:
LIST_INSTALLED_PACKAGES_FLAGS ?=

# TARGETS #

# List installed package dependencies.
#
# This target prints a list of all installed package dependencies.

list-pkgs-installed: $(NODE_MODULES) $(LIST_INSTALLED_PACKAGES)
	$(QUIET) $(NODE) $(LIST_INSTALLED_PACKAGES) $(LIST_INSTALLED_PACKAGES_FLAGS) $(ROOT_DIR)

.PHONY: list-pkgs-installed

# List installed package dependencies.
#
# This target prints the logical dependency tree for all installed package dependencies.

list-pkgs-installed-logical-tree: $(NODE_MODULES)
	$(QUIET) $(NPM) ls

.PHONY: list-pkgs-installed-logical-tree

# List installed package dependencies.
#
# This target prints the logical dependency tree for all installed package dependencies as JSON.

list-pkgs-installed-logical-tree-json: $(NODE_MODULES)
	$(QUIET) $(NPM) ls --json

.PHONY: list-pkgs-installed-logical-tree-json


# Define functions to modify the directory stack. The stack works by maintaining these variables:
#
#     sp = The stack pointer.
#     pd = The previous directory.
#     d  = The current directory prefixed by $(SOURCE_ROOT).
#
# Each time a directory is entered, the stack pointer is "incremented" by appending ".x" to the
# current value of the pointer. So, a value of ".x.x.x" would indicate we are 3 levels deep in the
# stack.
#
# The previous directory is stored on a per stack-level basis. This is to be able to include
# subdirectories without the current directory forgetting the previous directory.

# Push a directory to the stack. Default compiler and linker flags to the parent directory's flag
# values.
#
# $(1) = The path to the target root directory.
define PUSH_DIR

sp := $$(sp).x
pd_$$(sp) := $$(d)

d := $(SOURCE_ROOT)/$$(strip $(1))

_$$(d) := $$(strip $$(patsubst %/, %, $$(dir $$(d))))

CFLAGS_$$(d) := $$(CFLAGS_$$(_$$(d)))
CXXFLAGS_$$(d) := $$(CXXFLAGS_$$(_$$(d)))
LDFLAGS_$$(d) := $$(LDFLAGS_$$(_$$(d)))
LDLIBS_$$(d) := $$(LDLIBS_$$(_$$(d)))
JFLAGS_$$(d) := $$(JFLAGS_$$(_$$(d)))

endef

# Pop a directory from the stack.
define POP_DIR

d := $$(pd_$$(sp))

sp := $$(basename $$(sp))

endef

Fix inheritance of parent directory compiler flags

# Define functions to modify the directory stack. The stack works by maintaining these variables:
#
#     sp = The stack pointer.
#     pd = The previous directory.
#     d  = The current directory prefixed by $(SOURCE_ROOT).
#
# Each time a directory is entered, the stack pointer is "incremented" by appending ".x" to the
# current value of the pointer. So, a value of ".x.x.x" would indicate we are 3 levels deep in the
# stack.
#
# The previous directory is stored on a per stack-level basis. This is to be able to include
# subdirectories without the current directory forgetting the previous directory.

# Push a directory to the stack. Default compiler and linker flags to the parent directory's flag
# values.
#
# $(1) = The path to the target root directory.
define PUSH_DIR

sp := $$(sp).x
pd_$$(sp) := $$(d)

p := $$(d)
d := $(SOURCE_ROOT)/$$(strip $(1))

CFLAGS_$$(d) := $$(CFLAGS_$$(p))
CXXFLAGS_$$(d) := $$(CXXFLAGS_$$(p))
LDFLAGS_$$(d) := $$(LDFLAGS_$$(p))
LDLIBS_$$(d) := $$(LDLIBS_$$(p))
JFLAGS_$$(d) := $$(JFLAGS_$$(p))

endef

# Pop a directory from the stack.
define POP_DIR

d := $$(pd_$$(sp))

sp := $$(basename $$(sp))

endef


# Provide poorman to run a Procfile.

__FILE__ := $(lastword $(MAKEFILE_LIST))
DIR := $(dir $(lastword $(MAKEFILE_LIST)))

include $(DIR)/command.mk
include $(DIR)/path.mk

POORMAN_URL := https://github.com/rduplain/poorman.git
POORMAN_VERSION := v0.6.2

# Though poorman.mk is functional without reqd.mk,
# it installs to reqd's conventional location.
POORMAN := $(PROJECT_ROOT)/.reqd/usr/bin/poorman

$(POORMAN): $(__FILE__) | curl-command
	@rm -f $@
	@curl -sSL qwerty.sh | sh -s - \
		--tag $(POORMAN_VERSION) --chmod=a+x $(POORMAN_URL) poorman:$@

# Replace command.mk's `poorman-command` to download poorman.
poorman-command: $(POORMAN)
	@true

Use URL and REV as configuration keywords.

# Provide poorman to run a Procfile.

__FILE__ := $(lastword $(MAKEFILE_LIST))
DIR := $(dir $(lastword $(MAKEFILE_LIST)))

include $(DIR)/command.mk
include $(DIR)/path.mk

POORMAN_URL := https://github.com/rduplain/poorman.git
POORMAN_REV := v0.6.2

# Though poorman.mk is functional without reqd.mk,
# it installs to reqd's conventional location.
POORMAN := $(PROJECT_ROOT)/.reqd/usr/bin/poorman

$(POORMAN): $(__FILE__) | curl-command
	@rm -f $@
	@curl -sSL qwerty.sh | sh -s - \
		--tag $(POORMAN_REV) --chmod=a+x $(POORMAN_URL) poorman:$@

# Replace command.mk's `poorman-command` to download poorman.
poorman-command: $(POORMAN)
	@true


APP_PLATFORM := android-14
APP_ABI := armeabi armeabi-v7a x86 mips
APP_STL := c++_shared

Remove armeabi ABI from Android build, because it is not supported anymore

APP_PLATFORM := android-14
APP_ABI := armeabi-v7a x86 mips
APP_STL := c++_shared


dist_libuobject_la_SOURCES +=			\
  $(coroutines_sources)				\
  scheduler/exception.hh			\
  scheduler/exception.hxx			\
  scheduler/fwd.hh				\
  scheduler/job.cc				\
  scheduler/job.hh				\
  scheduler/job.hxx				\
  scheduler/pthread-coro.cc			\
  scheduler/pthread-coro.hh			\
  scheduler/pthread-coro.hxx			\
  scheduler/scheduler.cc			\
  scheduler/scheduler.hh			\
  scheduler/scheduler.hxx			\
  scheduler/tag.cc				\
  scheduler/tag.hh				\
  scheduler/tag.hxx

coroutines_sources = 				\
  scheduler/coroutine.hh			\
  scheduler/coroutine.hxx

Add missing end-of-line at end-of-file.


<%inherit file="base.mak"/>
       % if 'new_post' in context['request'].GET:
            <form action="post" METHOD="POST">
                ${message}

                Title: <input type="text" name="title" />

                At least one of these is required

                Description: <input type="text" name="description" />

                URL: <input type="text" name="url" />

                <input type="submit" value="Post Story" />

            </form>
        % else:
            % for s in stories:
                <%include file="story_item.mak" args="story_obj = s, vote_dict = vote_dict" />
            % endfor
             % if next_page:

                next page →
            % endif
            % if prev_page:

                prev page ←
            % endif
        % endif

Make description on new a textarea instead of text box

<%inherit file="base.mak"/>
       % if 'new_post' in context['request'].GET:
            <form action="post" METHOD="POST">
                ${message}

                Title: <input type="text" name="title" />

                At least one of these is required

                Description: <textarea name="description" cols="50" rows="10"></textarea>

                URL: <input type="text" name="url" />

                <input type="submit" value="Post Story" />

            </form>
        % else:
            % for s in stories:
                <%include file="story_item.mak" args="story_obj = s, vote_dict = vote_dict" />
            % endfor
             % if next_page:

                next page →
            % endif
            % if prev_page:

                prev page ←
            % endif
        % endif


# wmii version
VERSION = $$(hg tip | awk -F '[: ]+' '/^changeset:/ { print "hg" $$2 }')
CONFVERSION = 3.5

# Customize below to fit your system

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

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

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

# flags
#CFLAGS = -Os ${INCS} -DVERSION=\"${VERSION}\"
#LDFLAGS = ${LIBS}
CFLAGS = -g -Wall ${INCS} -DVERSION=\"${VERSION}\"
LDFLAGS = -g ${LIBS}

# Solaris
#CFLAGS = -fast ${INCS} -DVERSION=\"${VERSION}\"
#LDFLAGS = ${LIBS} -R${PREFIX}/lib
#LDFLAGS += -lsocket -lnsl
#CFLAGS += -xtarget=ultra

# compiler and linker
CC = cc

Use --template instead of awk for VERSION as suggested by Maxi

# wmii version
VERSION = $$(hg tip --template 'hg\#rev\#')
CONFVERSION = 3.5

# Customize below to fit your system

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

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

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

# flags
#CFLAGS = -Os ${INCS} -DVERSION=\"${VERSION}\"
#LDFLAGS = ${LIBS}
CFLAGS = -g -Wall ${INCS} -DVERSION=\"${VERSION}\"
LDFLAGS = -g ${LIBS}

# Solaris
#CFLAGS = -fast ${INCS} -DVERSION=\"${VERSION}\"
#LDFLAGS = ${LIBS} -R${PREFIX}/lib
#LDFLAGS += -lsocket -lnsl
#CFLAGS += -xtarget=ultra

# compiler and linker
CC = cc


# sinit version
VERSION = 0.6

# paths
PREFIX = /usr/local
MANPREFIX = $(PREFIX)/man

CC = cc
LD = $(CC)
CPPFLAGS =
CFLAGS   = -Wall -Os $(CPPFLAGS)
LDFLAGS  = -static

Add -Wextra and -Werror by default

# sinit version
VERSION = 0.6

# paths
PREFIX = /usr/local
MANPREFIX = $(PREFIX)/man

CC = cc
LD = $(CC)
CPPFLAGS =
CFLAGS   = -Wextra -Werror -Wall -Os $(CPPFLAGS)
LDFLAGS  = -static


FLASHER = avrdude
DIST_PATH = $(RIOTBOARD)/$(BOARD)/dist
DEBUGSERVER_PORT = 4242
DEBUGSERVER = $(DIST_PATH)/debug_srv.sh
DEBUGSERVER_INTERFACE ?=
DEBUGSERVER_FLAGS = "-g -j usb $(DEBUGSERVER_INTERFACE) :$(DEBUGSERVER_PORT)"
DEBUGGER_FLAGS = "-x $(RIOTBOARD)/$(BOARD)/dist/gdb.conf $(ELFFILE)"
DEBUGGER = $(DIST_PATH)/debug.sh $(DEBUGSERVER_FLAGS) $(DIST_PATH) $(DEBUGSERVER_PORT)

PROGRAMMER_FLAGS = -p $(subst atmega,m,$(CPU))

# Set flasher port only for programmers that require it
ifneq (,$(filter $(PROGRAMMER),arduino avr109 buspirate stk500v1 stk500v2 wiring))
  # make the flasher port configurable (e.g. with atmelice the port is usb)
  # defaults to terminal's serial port if not configured
  PROGRAMMER_FLAGS += -P $(PROG_DEV)
endif
PROGRAMMER_FLAGS += $(FFLAGS_EXTRA)

# don't force to flash HEXFILE, but set it as default
FLASHFILE ?= $(HEXFILE)
FFLAGS += -c $(PROGRAMMER) $(PROGRAMMER_FLAGS) -U flash:w:$(FLASHFILE)
RESET ?= $(FLASHER) -c $(PROGRAMMER) $(PROGRAMMER_FLAGS)

Fix `make reset` with bootloader

FLASHER = avrdude
DIST_PATH = $(RIOTBOARD)/$(BOARD)/dist
DEBUGSERVER_PORT = 4242
DEBUGSERVER = $(DIST_PATH)/debug_srv.sh
DEBUGSERVER_INTERFACE ?=
DEBUGSERVER_FLAGS = "-g -j usb $(DEBUGSERVER_INTERFACE) :$(DEBUGSERVER_PORT)"
DEBUGGER_FLAGS = "-x $(RIOTBOARD)/$(BOARD)/dist/gdb.conf $(ELFFILE)"
DEBUGGER = $(DIST_PATH)/debug.sh $(DEBUGSERVER_FLAGS) $(DIST_PATH) $(DEBUGSERVER_PORT)

PROGRAMMER_FLAGS = -p $(subst atmega,m,$(CPU))

# Set flasher port only for programmers that require it
ifneq (,$(filter $(PROGRAMMER),arduino avr109 buspirate stk500v1 stk500v2 wiring))
  # make the flasher port configurable (e.g. with atmelice the port is usb)
  # defaults to terminal's serial port if not configured
  PROGRAMMER_FLAGS += -P $(PROG_DEV)
endif
PROGRAMMER_FLAGS += $(FFLAGS_EXTRA)

# don't force to flash HEXFILE, but set it as default
FLASHFILE ?= $(HEXFILE)
FFLAGS += -c $(PROGRAMMER) $(PROGRAMMER_FLAGS) -U flash:w:$(FLASHFILE)

ifeq (,$(filter $(PROGRAMMER),arduino avr109 stk500v1 stk500v2 wiring))
  # Use avrdude to trigger a reset, if programming is not done via UART and a
  # bootloader.
  RESET ?= $(FLASHER) -c $(PROGRAMMER) $(PROGRAMMER_FLAGS)
endif


APP_PLATFORM := android-18
APP_ABI := armeabi-v7a
NDK_TOOLCHAIN_VERSION=4.8
APP_STL := gnustl_static

Move to the latest ndk (r10d)

APP_PLATFORM := android-18
APP_ABI := armeabi-v7a
APP_STL := gnustl_static


# TARGETS #

# Run C++ benchmarks.
#
# This target runs a list of C++ benchmarks consecutively.

benchmark-cpp:
	$(QUIET) $(FIND_CPP_BENCHMARKS_CMD) | grep '^[\/]\|^[a-zA-Z]:[/\]' | while read -r file; do \
		echo ""; \
		echo "Running benchmark: $$file"; \
		cd `dirname $$file` && \
		$(MAKE) clean && \
		BOOST=$(DEPS_BOOST_BUILD_OUT) $(MAKE) && \
		$(MAKE) run || exit 1; \
	done

.PHONY: benchmark-cpp

# Run C++ benchmarks.
#
# This target runs a specified list of C++ benchmarks consecutively.

benchmark-cpp-files:
	$(QUIET) for file in $(FILES); do \
		echo ""; \
		echo "Running benchmark: $$file"; \
		cd `dirname $$file` && \
		$(MAKE) clean && \
		BOOST=$(DEPS_BOOST_BUILD_OUT) $(MAKE) && \
		$(MAKE) run || exit 1; \
	done

.PHONY: benchmark-cpp-files

Set C++ compiler environment variable

# TARGETS #

# Run C++ benchmarks.
#
# This target runs a list of C++ benchmarks consecutively.

benchmark-cpp:
	$(QUIET) $(FIND_CPP_BENCHMARKS_CMD) | grep '^[\/]\|^[a-zA-Z]:[/\]' | while read -r file; do \
		echo ""; \
		echo "Running benchmark: $$file"; \
		cd `dirname $$file` && \
		$(MAKE) clean && \
		CXX_COMPILER="$(CXX)" \
		BOOST=$(DEPS_BOOST_BUILD_OUT) $(MAKE) && \
		$(MAKE) run || exit 1; \
	done

.PHONY: benchmark-cpp

# Run C++ benchmarks.
#
# This target runs a specified list of C++ benchmarks consecutively.

benchmark-cpp-files:
	$(QUIET) for file in $(FILES); do \
		echo ""; \
		echo "Running benchmark: $$file"; \
		cd `dirname $$file` && \
		$(MAKE) clean && \
		CXX_COMPILER="$(CXX)" \
		BOOST=$(DEPS_BOOST_BUILD_OUT) $(MAKE) && \
		$(MAKE) run || exit 1; \
	done

.PHONY: benchmark-cpp-files


#
# Component Makefile
#
# This Makefile should, at the very least, just include $(SDK_PATH)/make/component.mk. By default,
# this will take the sources in this directory, compile them and link them into
# lib(subdirectory_name).a in the build directory. This behaviour is entirely configurable,
# please read the SDK documents if you need to do this.
#
COMPONENT_ADD_INCLUDEDIRS := include
#COMPONENT_PRIV_INCLUDEDIRS :=

COMPONENT_SRCDIRS :=  .
#EXTRA_CFLAGS := -DICACHE_RODATA_ATTR
CFLAGS += -Wno-error=implicit-function-declaration -Wno-error=format= -DHAVE_CONFIG_H

include $(IDF_PATH)/make/component_common.mk

Update to match esp-idf style changes

#
# Component Makefile
#
# This Makefile should, at the very least, just include $(SDK_PATH)/make/component.mk. By default,
# this will take the sources in this directory, compile them and link them into
# lib(subdirectory_name).a in the build directory. This behaviour is entirely configurable,
# please read the SDK documents if you need to do this.
#
COMPONENT_ADD_INCLUDEDIRS := include
#COMPONENT_PRIV_INCLUDEDIRS :=

#EXTRA_CFLAGS := -DICACHE_RODATA_ATTR
CFLAGS += -Wno-error=implicit-function-declaration -Wno-error=format= -DHAVE_CONFIG_H


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

LOCAL_PATH := $(call my-dir)/../..

include $(CLEAR_VARS)

LOCAL_C_INCLUDES := $(LOCAL_PATH)/include                   \
                    $(LOCAL_PATH)/wxsqlite3/sqlite3/include \

LOCAL_SRC_FILES := src/content_values.cpp                       \
                   src/sqlite_db.cpp                            \
                   src/sqlite_record.cpp                        \
                   src/sqlite_table.cpp                         \
                   src/utils.cpp                                \
                   wxsqlite3/sqlite3/secure/src/sqlite3secure.c \

LOCAL_MODULE := sqlitencrypt
OCAL_LDLIBS := -lpthread -ldl -llog
LOCAL_CFLAGS := -DSQLITE_HAS_CODEC

include $(BUILD_SHARED_LIBRARY)

Remove -lpthread which is unnecessary

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

LOCAL_PATH := $(call my-dir)/../..

include $(CLEAR_VARS)

LOCAL_C_INCLUDES := $(LOCAL_PATH)/include                   \
                    $(LOCAL_PATH)/wxsqlite3/sqlite3/include \

LOCAL_SRC_FILES := src/content_values.cpp                       \
                   src/sqlite_db.cpp                            \
                   src/sqlite_record.cpp                        \
                   src/sqlite_table.cpp                         \
                   src/utils.cpp                                \
                   wxsqlite3/sqlite3/secure/src/sqlite3secure.c \

LOCAL_MODULE := sqlitencrypt
LOCAL_LDLIBS := -ldl -llog
LOCAL_CFLAGS := -DSQLITE_HAS_CODEC

include $(BUILD_SHARED_LIBRARY)


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

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

LOCAL_MODULE := guava
LOCAL_SDK_VERSION := 8
LOCAL_SRC_FILES := $(call all-java-files-under, src)
LOCAL_STATIC_JAVA_LIBRARIES := jsr305

include $(BUILD_STATIC_JAVA_LIBRARY)

# Include this library in the build server's output directory
$(call dist-for-goals, droid, $(LOCAL_BUILT_MODULE):guava.jar)

Add in host side library as well.

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

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

LOCAL_MODULE := guava
LOCAL_SDK_VERSION := 8
LOCAL_SRC_FILES := $(call all-java-files-under, src)
LOCAL_STATIC_JAVA_LIBRARIES := jsr305

include $(BUILD_STATIC_JAVA_LIBRARY)

# Include this library in the build server's output directory
$(call dist-for-goals, droid, $(LOCAL_BUILT_MODULE):guava.jar)

# Also build a host-side library
include $(CLEAR_VARS)

LOCAL_SRC_FILES := $(call all-java-files-under, src)
LOCAL_MODULE := guavalib
LOCAL_STATIC_JAVA_LIBRARIES := jsr305lib

include $(BUILD_HOST_JAVA_LIBRARY)


_ALLMODULES = $(sort $(USEMODULE) $(USEPKG))

# Define MODULE_MODULE_NAME preprocessor macros for all modules.
ED = $(addprefix MODULE_,$(_ALLMODULES))
# EXTDEFINES will be put in CFLAGS_WITH_MACROS
EXTDEFINES = $(addprefix -D,$(call uppercase_and_underscore,$(ED)))

# filter "pseudomodules" from "real modules", but not "no_pseudomodules"
REALMODULES += $(filter-out $(PSEUDOMODULES), $(_ALLMODULES))
REALMODULES += $(filter $(NO_PSEUDOMODULES), $(_ALLMODULES))
BASELIBS += $(REALMODULES:%=$(BINDIR)/%.a)

Add note regarding 'IS_USED' macro.

_ALLMODULES = $(sort $(USEMODULE) $(USEPKG))

# Define MODULE_MODULE_NAME preprocessor macros for all modules.
# Note: Some modules may be using the 'IS_USED' macro, defined in
# kernel_defines.h, please refer to its documentation if you change the way
# module macros are defined.
ED = $(addprefix MODULE_,$(_ALLMODULES))
# EXTDEFINES will be put in CFLAGS_WITH_MACROS
EXTDEFINES = $(addprefix -D,$(call uppercase_and_underscore,$(ED)))

# filter "pseudomodules" from "real modules", but not "no_pseudomodules"
REALMODULES += $(filter-out $(PSEUDOMODULES), $(_ALLMODULES))
REALMODULES += $(filter $(NO_PSEUDOMODULES), $(_ALLMODULES))
BASELIBS += $(REALMODULES:%=$(BINDIR)/%.a)


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\*


# -*- makefile -*-
# Copyright 2019 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.
#
# RISC-V core OS files build
#

# Select RISC-V bare-metal toolchain
$(call set-option,CROSS_COMPILE,$(CROSS_COMPILE_riscv),\
	/opt/coreboot-sdk/bin/riscv64-elf-)

# Enable FPU extension if config option of FPU is enabled.
_FPU_EXTENSION=$(if $(CONFIG_FPU),f,)
# CPU specific compilation flags
CFLAGS_CPU+=-march=rv32ima$(_FPU_EXTENSION)c -mabi=ilp32$(_FPU_EXTENSION) -Os
LDFLAGS_EXTRA+=-mrelax
LDFLAGS_EXTRA+=-static-libgcc -lgcc

core-y=cpu.o init.o panic.o task.o switch.o __builtin.o math.o

Make it possible to enable LTO

# -*- makefile -*-
# Copyright 2019 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.
#
# RISC-V core OS files build
#

# Select RISC-V bare-metal toolchain
$(call set-option,CROSS_COMPILE,$(CROSS_COMPILE_riscv),\
	/opt/coreboot-sdk/bin/riscv64-elf-)

# Enable FPU extension if config option of FPU is enabled.
_FPU_EXTENSION=$(if $(CONFIG_FPU),f,)
# CPU specific compilation flags
CFLAGS_CPU+=-march=rv32ima$(_FPU_EXTENSION)c -mabi=ilp32$(_FPU_EXTENSION) -Os
LDFLAGS_EXTRA+=-mrelax
LDFLAGS_EXTRA+=-static-libgcc -lgcc

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

core-y=cpu.o init.o panic.o task.o switch.o __builtin.o math.o


PIP=PIP_REQUIRE_VIRTUALENV=false pip

all:
	@$(PIP) install --upgrade pip
	@$(PIP) install -r Pipfile

Use py3 venv to manage global deps

VENV=~/.local/venv

all:
	@python3 -m venv $(VENV)
	@source $(VENV)/bin/activate.fish
	@pip install --upgrade pip
	@pip install -r Pipfile


CFLAGS_M32=-m32
CFLAGS_M64=-m64
ASM_INCLUDES = -Icodec/common/x86/
ifeq (, $(ENABLE64BIT))
ifeq ($(ARCH), x86_64)
ENABLE64BIT=Yes
endif
endif
ifeq ($(ENABLE64BIT), Yes)
CFLAGS += $(CFLAGS_M64)
LDFLAGS += $(CFLAGS_M64)
ASMFLAGS_PLATFORM = -DUNIX64
else
CFLAGS += $(CFLAGS_M32)
LDFLAGS += $(CFLAGS_M32)
ASMFLAGS_PLATFORM = -DX86_32
endif
ifeq ($(USE_ASM),Yes)
CFLAGS += -DX86_ASM
ASM_ARCH = x86
endif
ASM = nasm
ASMFLAGS += $(ASMFLAGS_PLATFORM)

Set ASM_ARCH in all cases to fix Win64 Debug build

CFLAGS_M32=-m32
CFLAGS_M64=-m64
ASM_INCLUDES = -Icodec/common/x86/
ifeq (, $(ENABLE64BIT))
ifeq ($(ARCH), x86_64)
ENABLE64BIT=Yes
endif
endif
ifeq ($(ENABLE64BIT), Yes)
CFLAGS += $(CFLAGS_M64)
LDFLAGS += $(CFLAGS_M64)
ASMFLAGS_PLATFORM = -DUNIX64
else
CFLAGS += $(CFLAGS_M32)
LDFLAGS += $(CFLAGS_M32)
ASMFLAGS_PLATFORM = -DX86_32
endif
ifeq ($(USE_ASM),Yes)
CFLAGS += -DX86_ASM
endif
ASM_ARCH = x86
ASM = nasm
ASMFLAGS += $(ASMFLAGS_PLATFORM)


$(BUILD_DIR)/mirror/centos/mos-download.done: $(BUILD_DIR)/mirror/centos/yum-config.done
	mkdir -p $(@D)
	mkdir -p $(LOCAL_MIRROR_MOS_CENTOS)
	set -ex ; reposync --norepopath --downloadcomps --plugins --delete --arch=$(CENTOS_ARCH) \
	    -c $(BUILD_DIR)/mirror/centos/etc/yum.conf --repoid=fuel -p $(LOCAL_MIRROR_MOS_CENTOS)
	$(ACTION.TOUCH)

$(BUILD_DIR)/mirror/centos/mos-repo.done: $(BUILD_DIR)/mirror/centos/mos-download.done
	createrepo -g $(LOCAL_MIRROR_MOS_CENTOS)/comps.xml \
	    -o $(LOCAL_MIRROR_MOS_CENTOS)/ $(LOCAL_MIRROR_MOS_CENTOS)/
	$(ACTION.TOUCH)

Use temporary yum cache dir during MOS repo sync

mos_centos_empty_installroot:=$(BUILD_DIR)/mirror/centos/dummy_mos_installroot

$(BUILD_DIR)/mirror/centos/mos-download.done: $(BUILD_DIR)/mirror/centos/yum-config.done
	mkdir -p $(@D)
	mkdir -p $(LOCAL_MIRROR_MOS_CENTOS)
	mkdir -p "$(mos_centos_empty_installroot)/cache"
	set -ex ; env TMPDIR="$(mos_centos_empty_installroot)/cache" \
	TMP="$(mos_centos_empty_installroot)/cache" \
	reposync --norepopath --downloadcomps --plugins --delete --arch=$(CENTOS_ARCH) \
	    -c $(BUILD_DIR)/mirror/centos/etc/yum.conf --repoid=fuel -p $(LOCAL_MIRROR_MOS_CENTOS)
	$(ACTION.TOUCH)

$(BUILD_DIR)/mirror/centos/mos-repo.done: $(BUILD_DIR)/mirror/centos/mos-download.done
	createrepo -g $(LOCAL_MIRROR_MOS_CENTOS)/comps.xml \
	    -o $(LOCAL_MIRROR_MOS_CENTOS)/ $(LOCAL_MIRROR_MOS_CENTOS)/
	$(ACTION.TOUCH)


USB_VID = 0x303A
USB_PID = 0x80F5
USB_PRODUCT = "Lolin C3 Mini"
USB_MANUFACTURER = "Wemos"

IDF_TARGET = esp32c3

INTERNAL_FLASH_FILESYSTEM = 1

CIRCUITPY_ESP_FLASH_MODE=qio
CIRCUITPY_ESP_FLASH_FREQ=80m
CIRCUITPY_ESP_FLASH_SIZE=4MB

Change USB VID & PID to Creator and Creation IDs

CIRCUITPY_CREATOR_ID =  0x1988_1988
CIRCUITPY_CREATION_ID = 0x00C3_0001

IDF_TARGET = esp32c3

INTERNAL_FLASH_FILESYSTEM = 1

CIRCUITPY_ESP_FLASH_MODE=qio
CIRCUITPY_ESP_FLASH_FREQ=80m
CIRCUITPY_ESP_FLASH_SIZE=4MB


PREFIX ?= /usr/local

CXX ?= clang++
CC ?= clang
PKG_CONFIG ?= pkg-config

C_STD ?= c99
CXX_STD ?= c++11
ifeq ($(EMCC),1)
OPT_LEVEL ?= 2
DBG_LEVEL ?=
else
OPT_LEVEL ?= 0
DBG_LEVEL ?= -ggdb
endif
WARN_LEVEL ?= all

LDLIBS = -lm -lstdc++
CFLAGS += -MD -O$(OPT_LEVEL) $(DBG_LEVEL) -W$(WARN_LEVEL) -std=$(C_STD) -I$(PREFIX)/include
CXXFLAGS += -MD -O$(OPT_LEVEL) $(DBG_LEVEL) -W$(WARN_LEVEL) -std=$(CXX_STD) -I$(PREFIX)/include

DESTDIR ?=
CHIPDB_SUBDIR ?= icebox

ifeq ($(MXE),1)
EXE = .exe
CXX = /usr/local/src/mxe/usr/bin/i686-w64-mingw32.static-gcc
CC = $(CXX)
PKG_CONFIG = /usr/local/src/mxe/usr/bin/i686-w64-mingw32.static-pkg-config
endif

ifeq ($(EMCC),1)
EXE = .js
CC = emcc
CXX = emcc
PREFIX = /
LDFLAGS = -O2 --memory-init-file 0 -s TOTAL_MEMORY=64*1024*1024
SUBDIRS = icebox icepack icemulti icepll icetime icebram
endif

Build optimized binaries by default

PREFIX ?= /usr/local
DEBUG ?= 0

CXX ?= clang++
CC ?= clang
PKG_CONFIG ?= pkg-config

C_STD ?= c99
CXX_STD ?= c++11
ifeq ($(DEBUG),1)
OPT_LEVEL ?= 0
DBG_LEVEL ?= -ggdb
else
OPT_LEVEL ?= 2
DBG_LEVEL ?=
endif
WARN_LEVEL ?= all

LDLIBS = -lm -lstdc++
CFLAGS += -MD -O$(OPT_LEVEL) $(DBG_LEVEL) -W$(WARN_LEVEL) -std=$(C_STD) -I$(PREFIX)/include
CXXFLAGS += -MD -O$(OPT_LEVEL) $(DBG_LEVEL) -W$(WARN_LEVEL) -std=$(CXX_STD) -I$(PREFIX)/include

DESTDIR ?=
CHIPDB_SUBDIR ?= icebox

ifeq ($(MXE),1)
EXE = .exe
CXX = /usr/local/src/mxe/usr/bin/i686-w64-mingw32.static-gcc
CC = $(CXX)
PKG_CONFIG = /usr/local/src/mxe/usr/bin/i686-w64-mingw32.static-pkg-config
endif

ifeq ($(EMCC),1)
EXE = .js
CC = emcc
CXX = emcc
PREFIX = /
LDFLAGS = -O2 --memory-init-file 0 -s TOTAL_MEMORY=64*1024*1024
SUBDIRS = icebox icepack icemulti icepll icetime icebram
endif


define MOLD_LIB_DEP
$(MOLD_BINDIR)$$($1_archive)$(MOLD_AREXT): $$($1_object)
endef

$(foreach t, $(MOLD_TARGETS), $(eval $(call MOLD_LIB_DEP,$t)))

$(MOLD_BINDIR)%$(MOLD_AREXT):
	$(call MOLD_AR, $<, $@)

Implement AR rules for build/clean

define MOLD_AR_RULES
$(MOLD_BINDIR)$$($1_archive)$(MOLD_AREXT): $$($1_object)

.PHONY: $1
$1: $(MOLD_BINDIR)$$($1_archive)$(MOLD_AREXT)

.PHONY: $1_clean_ar
$1_clean_ar:
	rm -f $(MOLD_BINDIR)$$($1_archive)$(MOLD_AREXT)

.PHONY: $1_clean
$1_clean: $1_clean_ar

endef

$(foreach t, $(MOLD_TARGETS), $(eval $(call MOLD_AR_RULES,$t)))

$(MOLD_BINDIR)%$(MOLD_AREXT):
	$(call MOLD_AR, $<, $@)


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

LOCAL_SRC_FILES:= \
	gdir.c \
	gerror.c \
	giochannel.c \
	gkeyfile.c \
	gmain.c \
	gmem.c \
	goption.c \
	gslice.c \
	gslist.c \
	gstring.c \
	gstrfuncs.c \
	gtimer.c \
	giounix.c \
	gmessages.c \
	gutf8.c \
	gfileutils.c \
	gconvert.c \
	gdataset.c \
	gtestutils.c \
	ghash.c \
	glist.c \
	gthread.c \
	garray.c \
	gutils.c \
	gatomic.c \
	gprintf.c \
	gpattern.c \
	guniprop.c \
	gpoll.c \
	grand.c \
	gunidecomp.c \
	gqsort.c \
	gstdio.c

LOCAL_C_INCLUDES:= \
	$(LOCAL_PATH)/../ \
	$(LOCAL_PATH)

LOCAL_CFLAGS:= \
	-DANDROID_STUB

LOCAL_MODULE:=libglib

include $(BUILD_SHARED_LIBRARY)

Fix build - don't prelink glib - do not merge

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

LOCAL_SRC_FILES:= \
	gdir.c \
	gerror.c \
	giochannel.c \
	gkeyfile.c \
	gmain.c \
	gmem.c \
	goption.c \
	gslice.c \
	gslist.c \
	gstring.c \
	gstrfuncs.c \
	gtimer.c \
	giounix.c \
	gmessages.c \
	gutf8.c \
	gfileutils.c \
	gconvert.c \
	gdataset.c \
	gtestutils.c \
	ghash.c \
	glist.c \
	gthread.c \
	garray.c \
	gutils.c \
	gatomic.c \
	gprintf.c \
	gpattern.c \
	guniprop.c \
	gpoll.c \
	grand.c \
	gunidecomp.c \
	gqsort.c \
	gstdio.c

LOCAL_C_INCLUDES:= \
	$(LOCAL_PATH)/../ \
	$(LOCAL_PATH)

LOCAL_CFLAGS:= \
	-DANDROID_STUB

LOCAL_MODULE:=libglib

LOCAL_PRELINK_MODULE := false

include $(BUILD_SHARED_LIBRARY)


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

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

LOCAL_MODULE := guava
LOCAL_SDK_VERSION := current
LOCAL_SRC_FILES := $(call all-java-files-under, src)
LOCAL_STATIC_JAVA_LIBRARIES := jsr305

include $(BUILD_STATIC_JAVA_LIBRARY)

# Include this library in the build server's output directory
$(call dist-for-goals, droid, $(LOCAL_BUILT_MODULE):guava.jar)

Add in build rule to build guava as a host side library as well as a device side library.

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

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

LOCAL_MODULE := guava
LOCAL_SDK_VERSION := current
LOCAL_SRC_FILES := $(call all-java-files-under, src)
LOCAL_STATIC_JAVA_LIBRARIES := jsr305

include $(BUILD_STATIC_JAVA_LIBRARY)

# Include this library in the build server's output directory
$(call dist-for-goals, droid, $(LOCAL_BUILT_MODULE):guava.jar)

# Also build a host-side library
include $(CLEAR_VARS)

LOCAL_SRC_FILES := $(call all-java-files-under, src)
LOCAL_MODULE := guavalib
LOCAL_STATIC_JAVA_LIBRARIES := jsr305lib

include $(BUILD_HOST_JAVA_LIBRARY)


# Copyright (c) 2015, Loïc Hoguin <essen@ninenines.eu>
# This file is part of erlang.mk and subject to the terms of the ISC License.

.PHONY: rebar.config

# We strip out -Werror because we don't want to fail due to
# warnings when used as a dependency.

compat_prepare_erlc_opts = $(shell echo "$1" | sed 's/, */,/')

define compat_convert_erlc_opts
$(if $(filter-out -Werror,$1),\
	$(if $(findstring +,$1),\
		$(shell echo $1 | cut -b 2-)))
endef

define compat_rebar_config
{deps, [$(call comma_list,$(foreach d,$(DEPS),\
	{$(call dep_name,$d),".*",{git,"$(call dep_repo,$d)","$(call dep_commit,$d)"}}))]}.
{erl_opts, [$(call comma_list,$(foreach o,$(call compat_prepare_erlc_opts,$(ERLC_OPTS)),\
	$(call compat_convert_erlc_opts,$o)))]}.
endef

$(eval _compat_rebar_config = $$(compat_rebar_config))
$(eval export _compat_rebar_config)

rebar.config:
	$(gen_verbose) echo "$${_compat_rebar_config}" > rebar.config

Add a function to convert ERLC_OPTS to an Erlang list

# Copyright (c) 2015, Loïc Hoguin <essen@ninenines.eu>
# This file is part of erlang.mk and subject to the terms of the ISC License.

.PHONY: rebar.config

# We strip out -Werror because we don't want to fail due to
# warnings when used as a dependency.

compat_prepare_erlc_opts = $(shell echo "$1" | sed 's/, */,/')

define compat_convert_erlc_opts
$(if $(filter-out -Werror,$1),\
	$(if $(findstring +,$1),\
		$(shell echo $1 | cut -b 2-)))
endef

define compat_erlc_opts_to_list
	[$(call comma_list,$(foreach o,$(call compat_prepare_erlc_opts,$1),$(call compat_convert_erlc_opts,$o)))]
endef

define compat_rebar_config
{deps, [$(call comma_list,$(foreach d,$(DEPS),\
	{$(call dep_name,$d),".*",{git,"$(call dep_repo,$d)","$(call dep_commit,$d)"}}))]}.
{erl_opts, $(call compat_erlc_opts_to_list,$(ERLC_OPTS))}.
endef

$(eval _compat_rebar_config = $$(compat_rebar_config))
$(eval export _compat_rebar_config)

rebar.config:
	$(gen_verbose) echo "$${_compat_rebar_config}" > rebar.config


# Copyright (c) 2015, Loïc Hoguin <essen@ninenines.eu>
# This file is part of erlang.mk and subject to the terms of the ISC License.

.PHONY: rebar.config

# We strip out -Werror because we don't want to fail due to
# warnings when used as a dependency.

compat_prepare_erlc_opts = $(shell echo "$1" | sed 's/, */,/')

define compat_convert_erlc_opts
$(if $(filter-out -Werror,$1),\
	$(if $(findstring +,$1),\
		$(shell echo $1 | cut -b 2-)))
endef

define compat_rebar_config
{deps, [$(call comma_list,$(foreach d,$(DEPS),\
	{$(call dep_name,$d),".*",{git,"$(call dep_repo,$d)","$(call dep_commit,$d)"}}))]}.
{erl_opts, [$(call comma_list,$(foreach o,$(call compat_prepare_erlc_opts,$(ERLC_OPTS)),\
	$(call compat_convert_erlc_opts,$o)))]}.
endef

$(eval _compat_rebar_config = $$(compat_rebar_config))
$(eval export _compat_rebar_config)

rebar.config:
	$(gen_verbose) echo "$${_compat_rebar_config}" > rebar.config

Remove spaces after commas globally

# Copyright (c) 2015, Loïc Hoguin <essen@ninenines.eu>
# This file is part of erlang.mk and subject to the terms of the ISC License.

.PHONY: rebar.config

# We strip out -Werror because we don't want to fail due to
# warnings when used as a dependency.

compat_prepare_erlc_opts = $(shell echo "$1" | sed 's/, */,/g')

define compat_convert_erlc_opts
$(if $(filter-out -Werror,$1),\
	$(if $(findstring +,$1),\
		$(shell echo $1 | cut -b 2-)))
endef

define compat_rebar_config
{deps, [$(call comma_list,$(foreach d,$(DEPS),\
	{$(call dep_name,$d),".*",{git,"$(call dep_repo,$d)","$(call dep_commit,$d)"}}))]}.
{erl_opts, [$(call comma_list,$(foreach o,$(call compat_prepare_erlc_opts,$(ERLC_OPTS)),\
	$(call compat_convert_erlc_opts,$o)))]}.
endef

$(eval _compat_rebar_config = $$(compat_rebar_config))
$(eval export _compat_rebar_config)

rebar.config:
	$(gen_verbose) echo "$${_compat_rebar_config}" > rebar.config


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

LOCAL_CFLAGS += -DMXT_VERSION=\"$(GIT_VERSION)\"
LOCAL_C_INCLUDES := $(SRC_PATH)
LOCAL_SRC_FILES := \
  mxt_app.c \
  menu.c \
  bootloader.c \
  diagnostic_data.c \
  touch_app.c \
  self_test.c \
  bridge.c \
  buffer.c \
  gr.c \
  serial_data.c \
  self_cap.c \
  signal.c
LOCAL_LDLIBS := -llog
LOCAL_STATIC_LIBRARIES := maxtouch
LOCAL_MODULE := mxt-app

include $(BUILD_EXECUTABLE)

Add missing USB flags in mxt-app build

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

LOCAL_CFLAGS += -DHAVE_LIBUSB -DMXT_VERSION=\"$(GIT_VERSION)\"
LOCAL_C_INCLUDES := $(SRC_PATH)
LOCAL_SRC_FILES := \
  mxt_app.c \
  menu.c \
  bootloader.c \
  diagnostic_data.c \
  touch_app.c \
  self_test.c \
  bridge.c \
  buffer.c \
  gr.c \
  serial_data.c \
  self_cap.c \
  signal.c
LOCAL_LDLIBS := -llog
LOCAL_STATIC_LIBRARIES := maxtouch
LOCAL_MODULE := mxt-app

include $(BUILD_EXECUTABLE)


OS ?= $(shell uname)

LUA_SHLIBS ?= $(shell pkg-config --silence-errors --libs lua5.1)
LUA_LIBS ?= $(if $(LUA_SHLIBS),$(LUA_SHLIBS),$(firstword $(wildcard /usr/lib/liblua.a /usr/local/lib/liblua.a /opt/local/lib/liblua.a)))
LUA_CFLAGS ?= $(shell pkg-config --silence-errors --cflags lua5.1)

CC ?= gcc
AR ?= ar
RANLIB ?= ranlib
CFLAGS ?= -O2
FPIC ?= -fPIC
EXTRA_CFLAGS ?= --std=gnu99
WFLAGS ?= -Wall -Werror -pedantic
CPPFLAGS ?=
COMPILE ?= $(CC) $(CPPFLAGS) $(CFLAGS) $(EXTRA_CFLAGS) $(WFLAGS)
ifeq ($(OS),Darwin)
  SHLIB_FLAGS ?= -bundle -undefined dynamic_lookup
else
  SHLIB_FLAGS ?= -shared
endif
LINK ?= $(CC)

Revert "* Don't override environment variables in Makefile"

OS ?= $(shell uname)

LUA_SHLIBS = $(shell pkg-config --silence-errors --libs lua5.1)
LUA_LIBS = $(if $(LUA_SHLIBS),$(LUA_SHLIBS),$(firstword $(wildcard /usr/lib/liblua.a /usr/local/lib/liblua.a /opt/local/lib/liblua.a)))
LUA_CFLAGS = $(shell pkg-config --silence-errors --cflags lua5.1)

CC = gcc
AR = ar
RANLIB = ranlib
CFLAGS = -O2
FPIC = -fPIC
EXTRA_CFLAGS = --std=gnu99
WFLAGS = -Wall -Werror -pedantic
CPPFLAGS =
COMPILE = $(CC) $(CPPFLAGS) $(CFLAGS) $(EXTRA_CFLAGS) $(WFLAGS)
ifeq ($(OS),Darwin)
  SHLIB_FLAGS = -bundle -undefined dynamic_lookup
else
  SHLIB_FLAGS = -shared
endif
LINK = $(CC)


MAKE     ?= make
DIR_LIST := apple/ banana/ cake/
<+CURSOR+>

.PHONY: all clean cleanobj
all:
	@for dir in $(DIR_LIST); do \
		$(MAKE) -C $$dir; \
	done

clean:
	@for dir in $(DIR_LIST); do \
		$(MAKE) -C $$dir $@; \
	done

cleanobj:
	@for dir in $(DIR_LIST); do \
		$(MAKE) -C $$dir $@; \
	done

Define a function which generate default rule for child directory

MAKE     ?= make
DIR_LIST := apple/ banana/ cake/
<+CURSOR+>

define default-rule
$1:
	@for dir in $(DIR_LIST); do \
		$(MAKE) -C $$$$dir $$@; \
	done
endef

PHONY_TARGETS := all clean cleanobj
.PHONY: $(PHONY_TARGETS)

$(foreach TARGET, $(SIMPLE_TARGETS), $(eval $(call default-rule, $(TARGET))))


$(eval $(call install-file-as, $(d)/completion.sh, $(datarootdir)/bash-completion/completions/_nix3, 0644))

Fix completion script install name

$(eval $(call install-file-as, $(d)/completion.sh, $(datarootdir)/bash-completion/completions/nix, 0644))


# Uncomment this if you're using STL in your project
# See CPLUSPLUS-SUPPORT.html in the NDK documentation for more information
# APP_STL := stlport_static

APP_ABI := armeabi-v7a
#APP_ABI := armeabi armeabi-v7a x86

# Min SDK level
APP_PLATFORM=android-10

Add x86 and arm archs

# Uncomment this if you're using STL in your project
# See CPLUSPLUS-SUPPORT.html in the NDK documentation for more information
# APP_STL := stlport_static

APP_ABI := armeabi armeabi-v7a x86

# Min SDK level
APP_PLATFORM=android-10


MCU_SERIES = f4
CMSIS_MCU = STM32F413xx
STARTUP_FILE = boards/startup_stm32f413xx.o
AF_FILE = boards/stm32f413_af.csv
LD_FILES = boards/stm32f413xh.ld boards/common_ifs.ld
TEXT0_ADDR = 0x08000000
TEXT1_ADDR = 0x08060000

Remove STARTUP_FILE, it's defined globally.

MCU_SERIES = f4
CMSIS_MCU = STM32F413xx
AF_FILE = boards/stm32f413_af.csv
LD_FILES = boards/stm32f413xh.ld boards/common_ifs.ld
TEXT0_ADDR = 0x08000000
TEXT1_ADDR = 0x08060000