Add 'install' targets
[fw/pdclib] / Makefile
index 0fbc337376260bd30485703d2b0b2f1160c60d6b..2afbc20d5b43b7056533ba6aec0ad1a064ddf842 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,10 @@
 # $Id$
 
+DESTDIR=
+prefix=/home/keithp/sat
+libdir=$(prefix)/lib
+includedir=$(prefix)/include
+
 CC=arm-none-eabi-gcc
 
 # This is where you chose which platform to compile for (see 'make links' / './platform')
@@ -15,6 +20,7 @@ SRCFILES := $(shell find -L $(PROJDIRS) -type f -name "*.c")
 BUILDFILES := $(shell find -L build -type f -name "*.c")
 # All header files of the project
 HDRFILES := $(shell find -L $(PROJDIRS) -type f -name "*.h")
+BUILDHDRFILES := $(shell find -L build -type f -name "*.h")
 # All .c files in functions/_PDCLIB that do not have a regression test driver
 INTFILES := _Exit atomax digits open print scan remove rename seed stdinit strtox_main strtox_prelim filemode eol errno seek prepread prepwrite allocpages tmpfilename closeall
 # All object files in the library
@@ -59,6 +65,16 @@ pdclib.a: $(OBJFILES)
        @ar rc pdclib.a $?
        @echo
 
+install: install-lib install-hdr
+
+install-lib: pdclib.a
+       install -D -c pdclib.a $(DESTDIR)$(libdir)/pdclib.a
+
+install-hdr: $(BUILDHDRFILES)
+       for file in $(BUILDHDRFILES); do \
+               install -D -c $$file $(DESTDIR)$(includedir)/.; \
+       done
+
 test: functions/$(FILE)
        functions/$(FILE)