I am using the FreeBSD make environment to build a local library that I now want to install and make available to other projects. I can build, link and install the library.a but need to install a set of header files from the local build directories as well. Here is what I believe is the closest I got:
It seems
I can force a copy each time by using the following and even use the options to the install program like -C or -p but its not quite the same as it doesn't check 'out of date' timestamps.
Is there a way of getting make to copy a set of header files from a source to destination.
Code:
HEADERS = a.h \
b.h
INCDIR = /tmp
TARGETS = ${HEADERS:S/^/$(INCDIR)\//g}
install: $(TARGETS)
$(INCDIR)/%.h: %.h
echo $(INSTALL) -m 444 ${_INSTALLFLAGS} ${.IMPSRC} $(.TARGET)
It seems
$(INCDIR)/%.h: %.h
doesn't match correctly. If I change to the following rules it all works but this is not sustainable.
Code:
/tmp/a.h : a.h
$(INSTALL) -m 444 ${_INSTALLFLAGS} ${.IMPSRC} $(.TARGET)
/tmp/b.h : b.h
$(INSTALL) -m 444 ${_INSTALLFLAGS} ${.IMPSRC} $(.TARGET)
I can force a copy each time by using the following and even use the options to the install program like -C or -p but its not quite the same as it doesn't check 'out of date' timestamps.
Code:
HEADERS = a.h \
b.h
INCLDIR = /tmp
install:
.for H in ${HEADERS}
@$(INSTALL) -v -m 444 ${_INSTALLFLAGS} ${H} $(INCLDIR)/${H}
.endfor
Is there a way of getting make to copy a set of header files from a source to destination.