automake
[Top][All Lists]
Advanced

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

[PATCH] IDL support for automake-1.5


From: Bjørn Wennberg
Subject: [PATCH] IDL support for automake-1.5
Date: 08 Oct 2001 00:39:57 +0200
User-agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/20.7

Hi there!

Following is a patch for automake-1.5 to make it support
IDL (Interface Definition Language). Please flame as
perl isn't my language of choise :-)

Currently this patch will only work with omniORB3's omniidl compiler.
Hopefully others can contribute other vendors compilers.

AM_PROG_IDLC is a new macro for finding and setting up
  IDLC     =  compiler to use (default omniidl)
  IDLFLAGS = flags to pass to compiler (default -bcxx -Wbh=.h -Wbs=.cpp)

In a Makefile.am you can now write:
xxx_SOURCES = foo.cpp bar.idl


maintainer-clean will delete autogenerated bar.cpp and bar.h

bjornw>
-- 
------------------------------------------------------------------------
    address@hidden  Bjørn Wennberg, Fifth Season AS


diff -Nrc3 -X .exclude automake-1.5-org/automake.in automake-1.5/automake.in
*** automake-1.5-org/automake.in        Thu Aug 23 07:26:53 2001
--- automake-1.5/automake.in    Mon Oct  8 00:29:26 2001
***************
*** 986,991 ****
--- 986,1006 ----
                   'pure' => 1,
                   'extensions' => ['java', 'class', 'zip', 'jar']);
  
+ # Support for omniORB3 idl compiler
+ # idlc = Interface Definition Language compiler
+ # TODO: Make idl-compiler checks for other idl->lang converters
+ register_language ('name' => 'idlc',
+                  'Name' => 'IDL',
+                  'config_vars' => ['IDLC', 'IDLFLAGS'],
+                  'flags' => 'IDLFLAGS',
+                  'define_flag' => 0,
+                  'compiler' => 'IDLCOMPILE',
+                  'compile' => '$(IDLC) $(IDLFLAGS)',
+                  'rule_file' => 'idlc',
+                  'extensions' => ['idl'],
+                  '_target_hook' => \&lang_idl_target_hook
+                  );
+ 
  ################################################################
  
  # Parse command line.
***************
*** 4984,4989 ****
--- 4999,5015 ----
      return $LANG_SUBDIR;
  }
  
+ # Rewrite a single .idl file into .cpp
+ sub lang_idlc_rewrite
+ {
+     my ($directory, $base, $ext) = @_;
+ 
+     my $r = &lang_sub_obj;
+     (my $newext = $ext) =~ s/idl/cpp/;
+ 
+     return ($r, $newext);
+ }
+ 
  # The lang_X_finish functions are called after all source file
  # processing is done.  Each should handle defining rules for the
  # language, etc.  A finish function is only called if a source file of
***************
*** 5064,5069 ****
--- 5090,5119 ----
        # do.
        push (@maintainer_clean_files, $header);
      }
+ }
+ 
+ # This is a IDL helper which is called whenever we have decided to 
+ # compile an .idl file
+ #
+ # input is file.idl
+ # output is file.cpp
+ # We generate a header=file.h
+ # maintainer-clean: file.cpp, file.h
+ sub lang_idl_target_hook
+ {
+     my ($self, $aggregate, $output, $input) = @_;
+     
+     (my $output_base = $output) =~ s/\..*$//;
+     my $header = $output_base . '.h';
+     
+     # We want to make the header-file distributed
+     &push_dist_common ($header);
+ 
+     # For maintainer-clean, we want to remove the generated source+header file
+     # $output = generated idl-file.cpp
+     # $header = generated idl-file.h
+     push (@maintainer_clean_files, "$header ");
+     push (@maintainer_clean_files, "$output ");
  }
  
  # This is a helper for both lex and yacc.
diff -Nrc3 -X .exclude automake-1.5-org/lib/am/Makefile.am 
automake-1.5/lib/am/Makefile.am
*** automake-1.5-org/lib/am/Makefile.am Mon May 14 06:48:45 2001
--- automake-1.5/lib/am/Makefile.am     Sat Oct  6 18:25:35 2001
***************
*** 8,11 ****
  lex.am library.am libs.am libtool.am lisp.am ltlib.am ltlibrary.am \
  mans-vars.am mans.am multilib.am program.am progs.am python.am \
  remake-hdr.am scripts.am subdirs.am tags.am texi-vers.am texibuild.am \
! texinfos.am yacc.am
--- 8,11 ----
  lex.am library.am libs.am libtool.am lisp.am ltlib.am ltlibrary.am \
  mans-vars.am mans.am multilib.am program.am progs.am python.am \
  remake-hdr.am scripts.am subdirs.am tags.am texi-vers.am texibuild.am \
! texinfos.am yacc.am idlc.am
diff -Nrc3 -X .exclude automake-1.5-org/lib/am/idlc.am 
automake-1.5/lib/am/idlc.am
*** automake-1.5-org/lib/am/idlc.am     Thu Jan  1 01:00:00 1970
--- automake-1.5/lib/am/idlc.am Mon Oct  8 00:23:45 2001
***************
*** 0 ****
--- 1,9 ----
+ ## ---------- ##
+ ## Building.  ##
+ ## ---------- ##
+ 
+ ##
+ ## Rule for generating a .idl file into a .cpp file
+ ##
+ .idl.cpp:
+       $(IDLCOMPILE) $<
diff -Nrc3 -X .exclude automake-1.5-org/m4/Makefile.am 
automake-1.5/m4/Makefile.am
*** automake-1.5-org/m4/Makefile.am     Fri Aug  3 10:28:20 2001
--- automake-1.5/m4/Makefile.am Sat Oct  6 18:46:54 2001
***************
*** 5,10 ****
  dmalloc.m4 error.m4 gcj.m4 header.m4 init.m4 install-sh.m4 lex.m4 \
  lispdir.m4 make.m4 maintainer.m4 minuso.m4 missing.m4 multi.m4 \
  obstack.m4 protos.m4 ptrdiff.m4 python.m4 regex.m4 sanity.m4 strip.m4 \
! strtod.m4 termios.m4 winsz.m4
  
  EXTRA_DIST = $(m4data_DATA)
--- 5,10 ----
  dmalloc.m4 error.m4 gcj.m4 header.m4 init.m4 install-sh.m4 lex.m4 \
  lispdir.m4 make.m4 maintainer.m4 minuso.m4 missing.m4 multi.m4 \
  obstack.m4 protos.m4 ptrdiff.m4 python.m4 regex.m4 sanity.m4 strip.m4 \
! strtod.m4 termios.m4 winsz.m4 idlc.m4
  
  EXTRA_DIST = $(m4data_DATA)
diff -Nrc3 -X .exclude automake-1.5-org/m4/idlc.m4 automake-1.5/m4/idlc.m4
*** automake-1.5-org/m4/idlc.m4 Thu Jan  1 01:00:00 1970
--- automake-1.5/m4/idlc.m4     Mon Oct  8 00:28:14 2001
***************
*** 0 ****
--- 1,30 ----
+ #
+ # Provide a function for finding the IDL compiler
+ #
+ # Right now this works for omniORB3 idl compiler
+ #
+ # People using other compilers from other vendors
+ # might want to contribute
+ #
+ # Compat future enhacements:
+ # One example:
+ # AM_PROG_IDLC(<program to look for>, <command line>, header-extention, 
source-extension, skeleteon-header-extension, skeleton-source-extension)
+ # Other example using intermediate compiler would be to
+ # make a script that generates a subdirectory (or other techniques)
+ # and put the idl-compiler generated files into this directory
+ # creating dummy-header and dummy-source file which includes
+ # file in the subdirectory
+ #
+ # automake.in needs to be rewritten to support new extension
+ 
+ AC_DEFUN([AM_PROG_IDLC],
+ [
+   # Find omniORB3 idl compiler
+   AC_CHECK_PROG(IDLC, omniidl, omniidl)
+   test -z "$IDLC" && AC_MSG_ERROR([no idl compiler found in \$PATH])
+ 
+   # from a .idl file generate -> .cpp and .h file
+   IDLFLAGS="-bcxx -Wbh=.h -Wbs=.cpp"
+   AC_SUBST(IDLFLAGS)
+ ])
+ 



reply via email to

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