Add support for specifying install directory with "make install DESTDIR=x"

This commit is contained in:
James Benton 2016-08-25 12:04:51 +01:00
parent ee47d6da6b
commit e4c91162d4
4 changed files with 14 additions and 10 deletions

View File

@ -6,7 +6,11 @@ endif
TARGETS := tools crt rpl
DESTDIR ?= $(CURDIR)
INSTALLDIR := $(shell cd ${DESTDIR} ; pwd)
export WUT_ROOT
export INSTALLDIR
all:
@for dir in $(TARGETS); do \
@ -26,8 +30,8 @@ clean:
done
install:
@mkdir -p bin
@mkdir -p lib
@mkdir -p $(INSTALLDIR)
@cp -r include $(INSTALLDIR)
@for dir in $(TARGETS); do \
echo; \
echo Installing $$dir; \

View File

@ -12,8 +12,8 @@ clean:
@rm -f $(OFILES) $(OUTPUT).a
install: all
@mkdir -p $(WUT_ROOT)/lib
@cp -f *.a $(WUT_ROOT)/lib
@mkdir -p $(INSTALLDIR)/lib
@cp -f *.a $(INSTALLDIR)/lib
%.o: %.S
@echo "[CC] $(notdir $<)"

View File

@ -15,10 +15,10 @@ clean:
done
install: all
@mkdir -p $(WUT_ROOT)/lib
@mkdir -p $(INSTALLDIR)/lib
@for dir in $(TARGETS); do \
echo Installing $$dir; \
cp $$dir/*.a $(WUT_ROOT)/lib; \
cp $$dir/*.a $(INSTALLDIR)/lib; \
done
.PHONY: all install clean

View File

@ -18,10 +18,10 @@ else
endif
install: all
@mkdir -p $(WUT_ROOT)/bin
@mkdir -p $(INSTALLDIR)/bin
@for dir in $(TARGETS); do \
echo Installing $$dir; \
cp bin/$$dir $(WUT_ROOT)/bin; \
cp bin/$$dir $(INSTALLDIR)/bin; \
done
else
@ -40,10 +40,10 @@ clean:
done
install: all
@mkdir -p $(WUT_ROOT)/bin
@mkdir -p $(INSTALLDIR)/bin
@for dir in $(TARGETS); do \
echo Installing $$dir; \
cp $$dir/$$dir $(WUT_ROOT)/bin; \
cp $$dir/$$dir $(INSTALLDIR)/bin; \
done
endif