From 496b1f56938a38016a138fb7716ce5b76437186a Mon Sep 17 00:00:00 2001 From: "James A. Ross" Date: Sun, 8 Sep 2019 04:39:41 +0000 Subject: [PATCH] install option, including expanded shmem.h --- src/Makefile.esdk | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/src/Makefile.esdk b/src/Makefile.esdk index 09c845b..34dfa1e 100644 --- a/src/Makefile.esdk +++ b/src/Makefile.esdk @@ -1,10 +1,16 @@ CC = epiphany-elf-gcc +CPP = epiphany-elf-cpp AR = epiphany-elf-ar READELF = epiphany-elf-readelf -DEFS = -O3 -Wall -Wno-unused-function -fno-unroll-loops -mfp-mode=caller +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) @@ -12,9 +18,9 @@ ASM_FILES = $(wildcard *.S) OBJS = $(SRC_FILES:.c=.elf) $(ASM_FILES:.S=.o) -all: $(TARGETS) +all: $(TARGETS) expanded_shmem.h -.PHONY: clean install uninstall +.PHONY: clean distclean install uninstall .SUFFIXES: .SUFFIXES: .S .c .o .elf @@ -34,10 +40,20 @@ libshmem.a: libshmem_esdk.a ln -sf $< $@ .S.o: - $(CC) -c $< + $(CC) $(DEFS) -c $< + +expanded_shmem.h: + $(CPP) $(DEFS) -E shmem.h > expanded_shmem.h clean: rm -f *.elf *.o -distclean: clean +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