mirror of
https://github.com/hathach/tinyusb.git
synced 2025-03-14 04:18:56 +00:00
integrate top.mk into make.mk
This commit is contained in:
parent
b6404d143e
commit
e62d1a03ac
@ -1,4 +1,3 @@
|
||||
include ../../../tools/top.mk
|
||||
include ../../make.mk
|
||||
|
||||
INC += \
|
||||
|
@ -1,4 +1,3 @@
|
||||
include ../../../tools/top.mk
|
||||
include ../../make.mk
|
||||
|
||||
INC += \
|
||||
|
@ -1,4 +1,3 @@
|
||||
include ../../../tools/top.mk
|
||||
include ../../make.mk
|
||||
|
||||
INC += \
|
||||
|
@ -1,4 +1,3 @@
|
||||
include ../../../tools/top.mk
|
||||
include ../../make.mk
|
||||
|
||||
INC += \
|
||||
|
@ -1,4 +1,3 @@
|
||||
include ../../../tools/top.mk
|
||||
include ../../make.mk
|
||||
|
||||
INC += \
|
||||
|
@ -1,4 +1,3 @@
|
||||
include ../../../tools/top.mk
|
||||
include ../../make.mk
|
||||
|
||||
INC += \
|
||||
|
@ -1,6 +1,5 @@
|
||||
DEPS_SUBMODULES += lib/FreeRTOS-Kernel
|
||||
|
||||
include ../../../tools/top.mk
|
||||
include ../../make.mk
|
||||
|
||||
FREERTOS_SRC = lib/FreeRTOS-Kernel
|
||||
|
@ -1,4 +1,3 @@
|
||||
include ../../../tools/top.mk
|
||||
include ../../make.mk
|
||||
|
||||
INC += \
|
||||
|
@ -1,4 +1,3 @@
|
||||
include ../../../tools/top.mk
|
||||
include ../../make.mk
|
||||
|
||||
INC += \
|
||||
|
@ -1,4 +1,3 @@
|
||||
include ../../../tools/top.mk
|
||||
include ../../make.mk
|
||||
|
||||
INC += \
|
||||
|
@ -1,4 +1,3 @@
|
||||
include ../../../tools/top.mk
|
||||
include ../../make.mk
|
||||
|
||||
INC += \
|
||||
|
@ -1,4 +1,3 @@
|
||||
include ../../../tools/top.mk
|
||||
include ../../make.mk
|
||||
|
||||
INC += \
|
||||
|
@ -1,6 +1,5 @@
|
||||
DEPS_SUBMODULES += lib/FreeRTOS-Kernel
|
||||
|
||||
include ../../../tools/top.mk
|
||||
include ../../make.mk
|
||||
|
||||
FREERTOS_SRC = lib/FreeRTOS-Kernel
|
||||
|
@ -1,4 +1,3 @@
|
||||
include ../../../tools/top.mk
|
||||
include ../../make.mk
|
||||
|
||||
INC += \
|
||||
|
@ -1,4 +1,3 @@
|
||||
include ../../../tools/top.mk
|
||||
include ../../make.mk
|
||||
|
||||
INC += \
|
||||
|
@ -1,4 +1,3 @@
|
||||
include ../../../tools/top.mk
|
||||
include ../../make.mk
|
||||
|
||||
INC += \
|
||||
|
@ -1,4 +1,3 @@
|
||||
include ../../../tools/top.mk
|
||||
include ../../make.mk
|
||||
|
||||
INC += \
|
||||
|
@ -1,6 +1,5 @@
|
||||
DEPS_SUBMODULES += lib/lwip
|
||||
|
||||
include ../../../tools/top.mk
|
||||
include ../../make.mk
|
||||
|
||||
# suppress warning caused by lwip
|
||||
|
@ -1,4 +1,3 @@
|
||||
include ../../../tools/top.mk
|
||||
include ../../make.mk
|
||||
|
||||
INC += \
|
||||
|
@ -1,4 +1,3 @@
|
||||
include ../../../tools/top.mk
|
||||
include ../../make.mk
|
||||
|
||||
INC += \
|
||||
|
@ -1,4 +1,3 @@
|
||||
include ../../../tools/top.mk
|
||||
include ../../make.mk
|
||||
|
||||
ifeq ($(DISABLE_MJPEG),1)
|
||||
|
@ -1,4 +1,3 @@
|
||||
include ../../../tools/top.mk
|
||||
include ../../make.mk
|
||||
|
||||
INC += \
|
||||
|
@ -1,4 +1,3 @@
|
||||
include ../../../tools/top.mk
|
||||
include ../../make.mk
|
||||
|
||||
INC += \
|
||||
|
@ -1,4 +1,3 @@
|
||||
include ../../../tools/top.mk
|
||||
include ../../make.mk
|
||||
|
||||
INC += \
|
||||
|
@ -1,4 +1,3 @@
|
||||
include ../../../tools/top.mk
|
||||
include ../../make.mk
|
||||
|
||||
INC += \
|
||||
|
@ -1,4 +1,3 @@
|
||||
include ../../../tools/top.mk
|
||||
include ../../make.mk
|
||||
|
||||
INC += \
|
||||
|
@ -1,4 +1,3 @@
|
||||
include ../../../tools/top.mk
|
||||
include ../../make.mk
|
||||
|
||||
FATFS_PATH = lib/fatfs/source
|
||||
|
110
examples/make.mk
110
examples/make.mk
@ -2,6 +2,72 @@
|
||||
# Common make definition for all examples
|
||||
# ---------------------------------------
|
||||
|
||||
#-------------- TOP and CURRENT_PATH ------------
|
||||
|
||||
# Set TOP to be the path to get from the current directory (where make was
|
||||
# invoked) to the top of the tree. $(lastword $(MAKEFILE_LIST)) returns
|
||||
# the name of this makefile relative to where make was invoked.
|
||||
THIS_MAKEFILE := $(lastword $(MAKEFILE_LIST))
|
||||
|
||||
# strip off /tools/top.mk to get for example ../../..
|
||||
# and Set TOP to an absolute path
|
||||
TOP = $(abspath $(subst make.mk,..,$(THIS_MAKEFILE)))
|
||||
|
||||
# Set CURRENT_PATH to the relative path from TOP to the current directory, ie examples/device/cdc_msc_freertos
|
||||
CURRENT_PATH = $(subst $(TOP)/,,$(abspath .))
|
||||
|
||||
# Detect whether shell style is windows or not
|
||||
# https://stackoverflow.com/questions/714100/os-detecting-makefile/52062069#52062069
|
||||
ifeq '$(findstring ;,$(PATH))' ';'
|
||||
# PATH contains semicolon - so we're definitely on Windows.
|
||||
CMDEXE := 1
|
||||
|
||||
# makefile shell commands should use syntax for DOS CMD, not unix sh
|
||||
# Unfortunately, SHELL may point to sh or bash, which can't accept DOS syntax.
|
||||
# We can't just use sh, because while sh and/or bash shell may be available,
|
||||
# many Windows environments won't have utilities like realpath used below, so...
|
||||
# Force DOS command shell on Windows.
|
||||
SHELL := cmd.exe
|
||||
endif
|
||||
|
||||
#-------------- Cross Compiler ------------
|
||||
# Can be set by board, default to ARM GCC
|
||||
CROSS_COMPILE ?= arm-none-eabi-
|
||||
|
||||
ifeq ($(CC),iccarm)
|
||||
USE_IAR = 1
|
||||
endif
|
||||
|
||||
ifdef USE_IAR
|
||||
AS = iasmarm
|
||||
LD = ilinkarm
|
||||
OBJCOPY = ielftool
|
||||
SIZE = size
|
||||
|
||||
else
|
||||
CC = $(CROSS_COMPILE)gcc
|
||||
CXX = $(CROSS_COMPILE)g++
|
||||
AS = $(CC) -x assembler-with-cpp
|
||||
LD = $(CC)
|
||||
|
||||
GDB = $(CROSS_COMPILE)gdb
|
||||
OBJCOPY = $(CROSS_COMPILE)objcopy
|
||||
SIZE = $(CROSS_COMPILE)size
|
||||
endif
|
||||
|
||||
ifeq ($(CMDEXE),1)
|
||||
CP = copy
|
||||
RM = del
|
||||
MKDIR = mkdir
|
||||
PYTHON = python
|
||||
else
|
||||
CP = cp
|
||||
RM = rm
|
||||
MKDIR = mkdir
|
||||
PYTHON = python3
|
||||
endif
|
||||
|
||||
|
||||
# Build directory
|
||||
BUILD := _build/$(BOARD)
|
||||
|
||||
@ -45,47 +111,6 @@ else
|
||||
SRC_C += $(subst $(TOP)/,,$(wildcard $(TOP)/$(FAMILY_PATH)/*.c))
|
||||
endif
|
||||
|
||||
|
||||
#-------------- Cross Compiler ------------
|
||||
# Can be set by board, default to ARM GCC
|
||||
CROSS_COMPILE ?= arm-none-eabi-
|
||||
|
||||
# Allow for -Os to be changed by board makefiles in case -Os is not allowed
|
||||
CFLAGS_OPTIMIZED ?= -Os
|
||||
|
||||
ifeq ($(CC),iccarm)
|
||||
USE_IAR = 1
|
||||
endif
|
||||
|
||||
ifdef USE_IAR
|
||||
AS = iasmarm
|
||||
LD = ilinkarm
|
||||
OBJCOPY = ielftool
|
||||
SIZE = size
|
||||
|
||||
else
|
||||
CC = $(CROSS_COMPILE)gcc
|
||||
CXX = $(CROSS_COMPILE)g++
|
||||
AS = $(CC) -x assembler-with-cpp
|
||||
LD = $(CC)
|
||||
|
||||
GDB = $(CROSS_COMPILE)gdb
|
||||
OBJCOPY = $(CROSS_COMPILE)objcopy
|
||||
SIZE = $(CROSS_COMPILE)size
|
||||
endif
|
||||
|
||||
ifeq ($(CMDEXE),1)
|
||||
CP = copy
|
||||
RM = del
|
||||
MKDIR = mkdir
|
||||
PYTHON = python
|
||||
else
|
||||
CP = cp
|
||||
RM = rm
|
||||
MKDIR = mkdir
|
||||
PYTHON = python3
|
||||
endif
|
||||
|
||||
#-------------- Source files and compiler flags --------------
|
||||
|
||||
# Include all source C in family & board folder
|
||||
@ -94,6 +119,9 @@ SRC_C += $(subst $(TOP)/,,$(wildcard $(TOP)/$(BOARD_PATH)/*.c))
|
||||
|
||||
INC += $(TOP)/$(FAMILY_PATH)
|
||||
|
||||
# Allow for -Os to be changed by board makefiles in case -Os is not allowed
|
||||
CFLAGS_OPTIMIZED ?= -Os
|
||||
|
||||
# GCC Compiler Flags
|
||||
GCC_CFLAGS += \
|
||||
-ggdb \
|
||||
|
@ -1,4 +1,3 @@
|
||||
include ../../../../tools/top.mk
|
||||
include ../../make.mk
|
||||
|
||||
INC += \
|
||||
|
@ -1,4 +1,3 @@
|
||||
include ../../../../tools/top.mk
|
||||
include ../../make.mk
|
||||
|
||||
INC += \
|
||||
|
@ -1,6 +1,5 @@
|
||||
DEPS_SUBMODULES += lib/lwip
|
||||
|
||||
include ../../../../tools/top.mk
|
||||
include ../../make.mk
|
||||
|
||||
# suppress warning caused by lwip
|
||||
|
@ -2,6 +2,34 @@
|
||||
# Common make definition for all examples
|
||||
# ---------------------------------------
|
||||
|
||||
#-------------- TOP and CURRENT_PATH ------------
|
||||
|
||||
# Set TOP to be the path to get from the current directory (where make was
|
||||
# invoked) to the top of the tree. $(lastword $(MAKEFILE_LIST)) returns
|
||||
# the name of this makefile relative to where make was invoked.
|
||||
THIS_MAKEFILE := $(lastword $(MAKEFILE_LIST))
|
||||
|
||||
# strip off /tools/top.mk to get for example ../../..
|
||||
# and Set TOP to an absolute path
|
||||
TOP = $(abspath $(subst make.mk,../..,$(THIS_MAKEFILE)))
|
||||
|
||||
# Set CURRENT_PATH to the relative path from TOP to the current directory, ie examples/device/cdc_msc_freertos
|
||||
CURRENT_PATH = $(subst $(TOP)/,,$(abspath .))
|
||||
|
||||
# Detect whether shell style is windows or not
|
||||
# https://stackoverflow.com/questions/714100/os-detecting-makefile/52062069#52062069
|
||||
ifeq '$(findstring ;,$(PATH))' ';'
|
||||
# PATH contains semicolon - so we're definitely on Windows.
|
||||
CMDEXE := 1
|
||||
|
||||
# makefile shell commands should use syntax for DOS CMD, not unix sh
|
||||
# Unfortunately, SHELL may point to sh or bash, which can't accept DOS syntax.
|
||||
# We can't just use sh, because while sh and/or bash shell may be available,
|
||||
# many Windows environments won't have utilities like realpath used below, so...
|
||||
# Force DOS command shell on Windows.
|
||||
SHELL := cmd.exe
|
||||
endif
|
||||
|
||||
# Build directory
|
||||
BUILD := _build
|
||||
PROJECT := $(notdir $(CURDIR))
|
||||
@ -42,8 +70,6 @@ SANITIZER_FLAGS ?= -fsanitize=fuzzer \
|
||||
CFLAGS += $(COVERAGE_FLAGS) $(SANITIZER_FLAGS)
|
||||
|
||||
#-------------- Source files and compiler flags --------------
|
||||
|
||||
|
||||
INC += $(TOP)/test
|
||||
|
||||
# Compiler Flags
|
||||
|
29
tools/top.mk
29
tools/top.mk
@ -1,29 +0,0 @@
|
||||
ifneq ($(lastword a b),b)
|
||||
$(error This Makefile requires make 3.81 or newer)
|
||||
endif
|
||||
|
||||
# Detect whether shell style is windows or not
|
||||
# https://stackoverflow.com/questions/714100/os-detecting-makefile/52062069#52062069
|
||||
ifeq '$(findstring ;,$(PATH))' ';'
|
||||
# PATH contains semicolon - so we're definitely on Windows.
|
||||
CMDEXE := 1
|
||||
|
||||
# makefile shell commands should use syntax for DOS CMD, not unix sh
|
||||
# Unfortunately, SHELL may point to sh or bash, which can't accept DOS syntax.
|
||||
# We can't just use sh, because while sh and/or bash shell may be available,
|
||||
# many Windows environments won't have utilities like realpath used below, so...
|
||||
# Force DOS command shell on Windows.
|
||||
SHELL := cmd.exe
|
||||
endif
|
||||
|
||||
# Set TOP to be the path to get from the current directory (where make was
|
||||
# invoked) to the top of the tree. $(lastword $(MAKEFILE_LIST)) returns
|
||||
# the name of this makefile relative to where make was invoked.
|
||||
THIS_MAKEFILE := $(lastword $(MAKEFILE_LIST))
|
||||
|
||||
# strip off /tools/top.mk to get for example ../../..
|
||||
# and Set TOP to an absolute path
|
||||
TOP = $(abspath $(subst /tools/top.mk,,$(THIS_MAKEFILE)))
|
||||
|
||||
# Set CURRENT_PATH to the relative path from TOP to the current directory, ie examples/device/cdc_msc_freertos
|
||||
CURRENT_PATH = $(subst $(TOP)/,,$(abspath .))
|
Loading…
x
Reference in New Issue
Block a user