๐Ÿ“ฆ apache / nuttx

๐Ÿ“„ Make.defs ยท 88 lines
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88############################################################################
# fs/littlefs/Make.defs
#
# SPDX-License-Identifier: Apache-2.0
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements.  See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.  The
# ASF licenses this file to you 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.
#
############################################################################

ifeq ($(CONFIG_FS_LITTLEFS),y)
# Files required for littlefs file system support

CSRCS += lfs_vfs.c

ifeq ($(CONFIG_TRACE_LITTLEFS_FS),y)
littlefs/lfs_vfs.c_CFLAGS += -finstrument-functions
endif

DEPPATH += --dep-path littlefs
VPATH += :littlefs

CSRCS += lfs.c lfs_util.c

DEPPATH += --dep-path littlefs/littlefs
VPATH += :littlefs/littlefs

# Note: the littlefs upstream doesn't seems to care -Wshadow
# cf. https://github.com/littlefs-project/littlefs/pull/873
CFLAGS += -Wno-shadow

ifeq ($(CONFIG_FS_LITTLEFS_HAS_LFS_DEFINES),y)
CFLAGS += -DLFS_DEFINES=../lfs_nuttx_defines.h
else
CFLAGS += -DLFS_TRACE=finfo
CFLAGS += -DLFS_DEBUG=finfo
CFLAGS += -DLFS_WARN=fwarn
CFLAGS += -DLFS_ERROR=ferr
CFLAGS += -DLFS_ASSERT=DEBUGASSERT
CFLAGS += -DLFS_CONFIG=../lfs_vfs.h
endif

CFLAGS += -DLFS_NAME_MAX=$(CONFIG_FS_LITTLEFS_NAME_MAX)
CFLAGS += -DLFS_FILE_MAX=$(CONFIG_FS_LITTLEFS_FILE_MAX)
CFLAGS += -DLFS_ATTR_MAX=$(CONFIG_FS_LITTLEFS_ATTR_MAX)
ifeq ($(CONFIG_FS_LITTLEFS_MULTI_VERSION),y)
CFLAGS += -DLFS_MULTIVERSION
endif

LITTLEFS_TARBALL = $(shell echo $(CONFIG_FS_LITTLEFS_VERSION).tar.gz)

$(LITTLEFS_TARBALL):
	$(call DOWNLOAD,https://github.com/ARMmbed/littlefs/archive,$(LITTLEFS_TARBALL),littlefs/$(LITTLEFS_TARBALL))

.littlefsunpack: $(LITTLEFS_TARBALL)
	$(Q) tar zxf littlefs/$(LITTLEFS_TARBALL) -C littlefs
	$(Q) mv littlefs/littlefs-* littlefs/littlefs
ifeq ($(CONFIG_FS_LITTLEFS_LOCAL_PATCHES),y)
	$(Q) git apply littlefs/lfs_util.patch
	$(Q) git apply littlefs/lfs_getpath.patch
	$(Q) git apply littlefs/lfs_getsetattr.patch
endif
	$(Q) touch littlefs/.littlefsunpack

# Download and unpack tarball if no git repo found
ifeq ($(wildcard littlefs/littlefs/.git),)
context:: .littlefsunpack

distclean::
	$(call DELFILE, littlefs/.littlefsunpack)
	$(call DELFILE, littlefs/$(LITTLEFS_TARBALL))
	$(call DELDIR, littlefs/littlefs)
endif

endif