blob: 94429549514377dfe0459a9267fdd04e7465b2e8 (
plain)
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
|
# SPDX-License-Identifier: Apache-2.0
.DEFAULT_GOAL := all
GET_ARCH := ../../external/common/get_arch.sh
include ../../external/common/rules.mk
include rules.mk
PREFIX ?= /usr/local/
LIBDIR := $(PREFIX)/lib
INCDIR := $(PREFIX)/include/libflash
ifneq ($(ARCH), ARCH_ARM)
CFLAGS += -m64
endif
CFLAGS += -Werror -Wall -g2 -ggdb -I. -fPIC
LIBFLASH_OBJS := libflash-file.o libflash-libflash.o libflash-libffs.o \
libflash-ecc.o libflash-blocklevel.o
ARCHFLASH_OBJS := common-arch_flash.o
OBJS := $(LIBFLASH_OBJS) $(ARCHFLASH_OBJS)
LIBFLASH_H := libflash/file.h libflash/libflash.h libflash/libffs.h \
libflash/ffs.h libflash/ecc.h libflash/blocklevel.h libflash/errors.h
ARCHFLASH_H := common/arch_flash.h
LIBFLASH_FILES := libflash.c libffs.c ecc.c blocklevel.c file.c
LIBFLASH_SRC := $(addprefix libflash/,$(LIBFLASH_FILES))
$(LIBFLASH_SRC): | links
$(LIBFLASH_OBJS) : libflash-%.o : libflash/%.c
$(CC) $(CFLAGS) $(CPPFLAGS) -c $< -o $@
clean:
rm -f $(OBJS) common-*.o *.so*
distclean: clean
rm -f ccan libflash common
all: links arch_links $(OBJS)
$(CC) -shared -Wl,-soname,libflash.so -o $(SHARED_NAME) $(OBJS)
install-lib: all
install -D -m 0755 $(SHARED_NAME) $(DESTDIR)$(LIBDIR)/$(SHARED_NAME)
ln -sf $(SHARED_NAME) $(DESTDIR)$(LIBDIR)/libflash.so
install-dev: links arch_links
mkdir -p $(DESTDIR)$(INCDIR)
install -m 0644 $(LIBFLASH_H) $(ARCHFLASH_H) $(DESTDIR)$(INCDIR)
install: install-lib install-dev
uninstall:
rm -f $(DESTDIR)$(LIBDIR)/libflash*
rm -rf $(DESTDIR)$(INCDIR)
|