-
Notifications
You must be signed in to change notification settings - Fork 11
/
Makefile.esdk
59 lines (43 loc) · 1.24 KB
/
Makefile.esdk
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
CC = epiphany-elf-gcc
CPP = epiphany-elf-cpp
AR = epiphany-elf-ar
READELF = epiphany-elf-readelf
CFLAGS += -Os -Wall -Wno-unused-function
#DEFS += -DSHMEM_USE_HEADER_ONLY # Uncomment to build header only library
INCS =
LIBS =
ifeq ($(PREFIX),)
PREFIX := /usr/local
endif
TARGETS = libshmem_esdk.a libshmem.a
SRC_FILES = $(wildcard *.c)
ASM_FILES = $(wildcard *.S)
OBJS = $(SRC_FILES:.c=.elf) $(ASM_FILES:.S=.o)
all: $(TARGETS) expanded_shmem.h
.PHONY: clean distclean install uninstall
.SUFFIXES:
.SUFFIXES: .S .c .o .elf
info: $(TARGETS)
@$(READELF) -s --wide libshmem_esdk.a | \
awk '/FUNC|OBJECT/{printf "%7s %-6s %s\n",$$3,$$4,$$8;sum+=$$3}; \
END{printf "===================\n%7s TOTAL BYTES\n", sum}'
.c.elf:
$(CC) $(CFLAGS) $(DEFS) $(INCS) $(LIBS) -c $< -o $@
libshmem_esdk.a: $(OBJS)
$(AR) rcv $@ $(OBJS)
libshmem.a: libshmem_esdk.a
ln -sf $< $@
.S.o:
$(CC) $(DEFS) -c $<
expanded_shmem.h:
$(CPP) $(DEFS) -E shmem.h > expanded_shmem.h
clean:
rm -f *.elf *.o
distclean: clean
rm -f *.a
rm -f expanded_shmem.h
install: all expanded_shmem.h
install -d $(DESTDIR)$(PREFIX)/lib/
install -m 644 $(TARGETS) $(DESTDIR)$(PREFIX)/lib/
install -d $(DESTDIR)$(PREFIX)/include/
install -m 644 expanded_shmem.h $(DESTDIR)$(PREFIX)/include/shmem.h