automake
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: OS independent build results


From: Andreas Otto
Subject: Re: OS independent build results
Date: Sun, 1 Nov 2009 12:17:05 +0100
User-agent: KMail/1.10.3 (Linux/2.6.27.37-0.1-default; KDE/4.1.3; x86_64; ; )

Hi,

  this is my solution:

  this add a new target ".vpath_hook" to the build environment and this target
  copy the files/directories listed in "VPATH_FILES" from the src into the
  build environment. the "copy" is necessary because tools like "JAR"
  expect the files in the "build" directory. ".vpath_hook" is the FIRST
  target in BUILT_SOURCES to garantee that the copy is done before
  any furter action are done.


1. acinclude.m4

#------------------------------------------------------------------------
# SC_SET_VPATH_HOOK --
#
#       add support for VPATH build
#
# Arguments:
#       none
#       need variable "VPATH_FILES" be defined
#
# Results:
#
#       Add a new variable VPATH_HOOK/CLEANUP/DIST  to automake
#
#------------------------------------------------------------------------

AC_DEFUN([SC_SET_VPATH_HOOK], [
    AC_MSG_CHECKING([add VPATH hook])
    AC_SUBST([VPATH_HOOK], ['@if test ! -f .vpath_files -a "$(srcdir)" != "." 
; then (cd "$(srcdir)" && cp -r $(VPATH_FILES) "$(abs_builddir)";) && touch 
".vpath_files" && chmod -R u+w $(VPATH_FILES) && echo "VPATH copy"; else true; 
fi && touch ".vpath_hook"'])
    AC_SUBST([VPATH_HOOK_CLEANUP], ['-rm -f .vpath_hook; test -f .vpath_files 
&& rm -fr .vpath_files $(VPATH_FILES)'])
    AC_SUBST([VPATH_HOOK_DIST], ['-rm -f $(distdir)/.vpath_hook'])
])

2. example java Automake.am:

...
#####################################################################################
## VPATH setup

.vpath_hook:
        $(VPATH_HOOK)
....
VPATH_FILES = javamsgque javamsgque_MqS.h javamsgque_MqBufferS.h 
javamsgque_MqS_WAIT.h javamsgque.jar
....
BUILT_SOURCES = .vpath_hook $(mqs_DATA) javamsgque_MqS.h 
javamsgque_MqBufferS.h
MAINTAINERCLEANFILES = $(BUILT_SOURCES) javamsgque_MqS_WAIT.h 
javamsgque/*.class
...

distclean-local:
        $(VPATH_HOOK_CLEANUP)

dist-hook: $(MQS_MAIN)
        $(VPATH_HOOK_DIST)
        mkdir "$(distdir)/javamsgque"
        chmod u+w "$(distdir)/javamsgque"
        cp javamsgque/*.class "$(distdir)/javamsgque"
        chmod u+w $(distdir)/javamsgque/*.class



!important! is that "make clean" should not clean the *.class files.
I use the "MAINTAINERCLEANFILES" to clean this files also



reply via email to

[Prev in Thread] Current Thread [Next in Thread]