properly handle install PREFIX etc.
This commit is contained in:
parent
81530c207d
commit
8924d33424
21
makefile
21
makefile
@ -11,23 +11,6 @@ UNINSTALL_CMD = rm
|
||||
|
||||
include makefile_include.mk
|
||||
|
||||
|
||||
# Compiler and Linker Names
|
||||
ifndef PREFIX
|
||||
PREFIX=
|
||||
endif
|
||||
|
||||
ifeq ($(CC),cc)
|
||||
CC = $(PREFIX)gcc
|
||||
endif
|
||||
LD=$(PREFIX)ld
|
||||
AR=$(PREFIX)ar
|
||||
RANLIB=$(PREFIX)ranlib
|
||||
|
||||
ifndef MAKE
|
||||
MAKE=make
|
||||
endif
|
||||
|
||||
ifeq ($V,1)
|
||||
silent=
|
||||
else
|
||||
@ -104,12 +87,12 @@ timing: $(LIBNAME) demo/timing.o
|
||||
$(CC) $(CFLAGS) demo/timing.o $(LIBNAME) $(PROF) -o timing
|
||||
|
||||
profiled:
|
||||
CC="$(CC)" PREFIX="${PREFIX} CFLAGS="${CFLAGS} -fprofile-generate" MAKE=${MAKE} ${MAKE} timing
|
||||
CC="$(CC)" CROSS_COMPILE="${CROSS_COMPILE} CFLAGS="${CFLAGS} -fprofile-generate" MAKE=${MAKE} ${MAKE} timing
|
||||
./test
|
||||
rm -f `find . -type f -name "*.o" | xargs`
|
||||
rm -f `find . -type f -name "*.a" | xargs`
|
||||
rm -f test
|
||||
CC=$(CC) PREFIX="${PREFIX} CFLAGS="${CFLAGS} -fprofile-use" MAKE=${MAKE} ${MAKE} timing
|
||||
CC=$(CC) CROSS_COMPILE="${CROSS_COMPILE} CFLAGS="${CFLAGS} -fprofile-use" MAKE=${MAKE} ${MAKE} timing
|
||||
|
||||
# target that pre-processes all coverage data
|
||||
lcov-single-create:
|
||||
|
@ -60,12 +60,12 @@ $(LIBNAME): $(OBJECTS)
|
||||
$(LT) --mode=link --tag=CC $(CC) $(CFLAGS) $(LDFLAGS) $(LOBJECTS) -o $(LIBNAME) -rpath $(LIBPATH) -version-info $(VERSION_LIB) -export-symbols libtfm.symbols
|
||||
|
||||
install: .common_install
|
||||
sed -e 's,^Version:.*,Version: $(VERSION),' tomsfastmath.pc.in > tomsfastmath.pc
|
||||
install -d $(LIBPATH)/pkgconfig
|
||||
install -m 644 tomsfastmath.pc $(LIBPATH)/pkgconfig/
|
||||
sed -e 's,^Version:.*,Version: $(VERSION_PC),' tomsfastmath.pc.in > tomsfastmath.pc
|
||||
install -d $(DESTDIR)$(LIBPATH)/pkgconfig
|
||||
install -m 644 tomsfastmath.pc $(DESTDIR)$(LIBPATH)/pkgconfig/
|
||||
|
||||
uninstall: .common_uninstall
|
||||
rm $(LIBPATH)/pkgconfig/tomsfastmath.pc
|
||||
rm $(DESTDIR)$(LIBPATH)/pkgconfig/tomsfastmath.pc
|
||||
|
||||
mtest/mtest: mtest/mtest.c
|
||||
cd mtest ; make mtest
|
||||
|
@ -14,6 +14,23 @@ endif
|
||||
#
|
||||
VERSION=0.13.1-next
|
||||
VERSION_LIB=1:0:0
|
||||
VERSION_PC=0.13.1
|
||||
|
||||
# Compiler and Linker Names
|
||||
ifndef CROSS_COMPILE
|
||||
CROSS_COMPILE:=
|
||||
endif
|
||||
|
||||
ifeq ($(CC),cc)
|
||||
CC := $(CROSS_COMPILE)gcc
|
||||
endif
|
||||
LD:=$(CROSS_COMPILE)ld
|
||||
AR:=$(CROSS_COMPILE)ar
|
||||
RANLIB=$(CROSS_COMPILE)ranlib
|
||||
|
||||
ifndef MAKE
|
||||
MAKE=make
|
||||
endif
|
||||
|
||||
#
|
||||
# Compilation flags
|
||||
@ -52,9 +69,10 @@ endif
|
||||
#
|
||||
# (Un)Install related variables
|
||||
#
|
||||
DESTDIR ?= /usr/local
|
||||
LIBPATH ?= $(DESTDIR)/lib
|
||||
INCPATH ?= $(DESTDIR)/include
|
||||
DESTDIR ?=
|
||||
PREFIX ?= /usr/local
|
||||
LIBPATH ?= $(PREFIX)/lib
|
||||
INCPATH ?= $(PREFIX)/include
|
||||
|
||||
|
||||
#
|
||||
@ -65,16 +83,16 @@ default: $(LIBNAME)
|
||||
|
||||
|
||||
.common_install: $(LIBNAME)
|
||||
install -d $(LIBPATH)
|
||||
$(INSTALL_CMD) $(LIBNAME) $(LIBPATH)/$(LIBNAME)
|
||||
install -d $(INCPATH)
|
||||
install $(HEADERS_PUB) $(INCPATH)
|
||||
install -d $(DESTDIR)$(LIBPATH)
|
||||
$(INSTALL_CMD) $(LIBNAME) $(DESTDIR)$(LIBPATH)/$(LIBNAME)
|
||||
install -d $(DESTDIR)$(INCPATH)
|
||||
install $(HEADERS_PUB) $(DESTDIR)$(INCPATH)
|
||||
|
||||
|
||||
HEADER_FILES=$(notdir $(HEADERS_PUB))
|
||||
.common_uninstall:
|
||||
$(UNINSTALL_CMD) $(LIBPATH)/$(LIBNAME)
|
||||
rm $(HEADER_FILES:%=$(INCPATH)/%)
|
||||
$(UNINSTALL_CMD) $(DESTDIR)$(LIBPATH)/$(LIBNAME)
|
||||
rm $(HEADER_FILES:%=$(DESTDIR)$(INCPATH)/%)
|
||||
|
||||
|
||||
#This rule cleans the source tree of all compiled code, not including the pdf
|
||||
|
Loading…
Reference in New Issue
Block a user