lin
2025-03-22 34bf7c4dd3c00c587f836898977857f2fe9bac74
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
89
90
91
92
93
94
95
96
 
#
# (C) Copyright 2017-2018
# Allwinner Technology Co., Ltd. <www.allwinnertech.com>
# wangwei <wangwei@allwinnertech.com>
#
# SPDX-License-Identifier:    GPL-2.0+
#
 
SRCTREE        := $(CURDIR)
TOPDIR        := $(SRCTREE)
CROSS_COMPILE := $(TOPDIR)/../tools/toolchain/gcc-linaro-7.2.1-2017.11-x86_64_arm-linux-gnueabi/bin/arm-linux-gnueabi-
DRIVER_DIR    := $(TOPDIR)/drivers/sunxi_flash/nand
export TOPDIR
 
AS              = $(CROSS_COMPILE)as
LD              = $(CROSS_COMPILE)ld
CC              = $(CROSS_COMPILE)gcc
AR              = $(CROSS_COMPILE)ar
NM              = $(CROSS_COMPILE)nm
LDR             = $(CROSS_COMPILE)ldr
STRIP           = $(CROSS_COMPILE)strip
OBJCOPY         = $(CROSS_COMPILE)objcopy
OBJDUMP         = $(CROSS_COMPILE)objdump
 
export AS LD CC CPP AR NM LDR STRIP OBJCOPY OBJDUMP
 
CFLGAS = -nostdinc -isystem \
  -D__KERNEL__ -D__UBOOT__ \
  -Wall -Wstrict-prototypes \
  -Wno-format-security -fno-builtin -ffreestanding -fshort-wchar -Os \
  -fno-stack-protector -fno-delete-null-pointer-checks \
  -fstack-usage -Wno-format-nonliteral \
  -Werror=date-time -D__ARM__ \
  -Wa,-mimplicit-it=always -mthumb -mthumb-interwork \
  -mabi=aapcs-linux -mword-relocations -fno-pic -mno-unaligned-access \
  -ffunction-sections -fdata-sections -fno-common \
  -ffixed-r9 -msoft-float -pipe -march=armv7-a \
  -D__LINUX_ARM_ARCH__=7
 
INCLUDE = -I$(shell dirname `$(CC)  -print-libgcc-file-name`)/include \
         -I$(SRCTREE)/include \
         -I$(SRCTREE)/arch/arm/include
 
export CFLGAS INCLUDE
platform=$(shell cat .config | grep "CONFIG_MACH_SUN8IW18=y" | awk -F '=' '{print $$1}')
 
.PHONY:clean clean_libcomm1 clean_libcomm0
 
all:libcomm0 libcomm1
 
libcomm0:clean_libcomm0
ifneq ("$(wildcard $(DRIVER_DIR)/common0/lib-nand)","")
   make -C $(DRIVER_DIR)/common0/lib-nand
endif
 
clean_libcomm0:
ifneq ("$(wildcard $(DRIVER_DIR)/common0/lib-nand)","")
   make -k -C $(DRIVER_DIR)/common0/lib-nand clean
endif
 
ifeq ("$(platform)", "CONFIG_MACH_SUN8IW18")
libcomm1:clean_libcomm1
ifneq ("$(wildcard $(DRIVER_DIR)/common1/lib-nand)","")
   make -C $(DRIVER_DIR)/common1/lib-nand
endif
 
else
libcomm1:clean_libcomm1
ifneq ("$(wildcard $(DRIVER_DIR)/common1/)","")
   make -C $(DRIVER_DIR)/common1/lib
endif
endif
libsun8iw7p1:clean_sun8iw7p1
ifneq ("$(wildcard $(DRIVER_DIR)/sun8iw7p1/lib-nand)","")
   make -C $(DRIVER_DIR)/sun8iw7p1/lib-nand
endif
 
ifeq ("$(platform)", "CONFIG_MACH_SUN8IW18")
clean_libcomm1:
ifneq ("$(wildcard $(DRIVER_DIR)/common1/lib-nand)","")
   make -k -C $(DRIVER_DIR)/common1/lib-nand clean
endif
 
else
clean_libcomm1:
ifneq ("$(wildcard $(DRIVER_DIR)/common1/lib)","")
   make -k -C $(DRIVER_DIR)/common1/lib clean
endif
endif
clean_sun8iw7p1:
ifneq ("$(wildcard $(DRIVER_DIR)/sun8iw7p1/lib-nand)","")
   make -k -C $(DRIVER_DIR)/sun8iw7p1/lib-nand clean
endif
 
clean: clean_libcomm1 clean_libcomm0 clean_sun8iw7p1