########################################################################## # package: makefiles # # version: 2.4.16, 18-Aug-2003 # # file: makefiles.txt # # author: Jerzy.Borkowski@obs.unige.ch # # copyright: ISDC, chemin d'Ecogia 16, 1290 Versoix, Switzerland # ########################################################################## 1. Introduction 1.1. Upgrading from makefiles-1.3 (ac_stuff/clean_old_junk script) 1.2. ac_stuff/configure or ${ISDC_ENV}/bin/ac_stuff/configure ? 2. Anatomy of ISDC make files 3. Usage of ac_stuff/configure script and make program 4. Finetuning ac_stuff/configure script 5. How to write makeisdc1.in 5.1. The simplest "hello world" case 5.2. Typical C program linking with ISDC system libraries 5.3. Few notes on libraries 5.4. Recursive make files 5.5. Multithreaded applications 5.6. C executable makeisdc1.in template 5.7. C++ executable makeisdc1.in template 5.8. Fortran 90 executable makeisdc1.in template 5.9. static library makeisdc1.in template 5.10. mixed language executable 5.11. log files 5.12. NAG library 6. isdc_install program 7. Additional information 1. Introduction ISDC uses make files and configure scripts to automate compilation and building process of various software packages. Compared to previous version Makefiles internal structure has been substantially changed (for users almost nothing has changed however). Makefiles version 2.0 have the following improvements over previous version (1.3.X ) : a) only 1 (one) additional file per directory : makeisdc1.in. Previously one had to put about 10 files per directory. This greatly simplifies writing makefiles by users. Developers can now forget about cfortran.h, cfortran_isdc.h, ./configure, ./configure.in, Makefile, Makefile.in, autoconf/* and the stuff like that. Just remember, only 1 (one) makeisdc1.in file per directory. And templates ready for copy-and-paste are in this file. b) make files are now fully recursive. SUBDIRS keyword in makeisdc1.in specifies subdirectories (if any) of current directory which contain sub-makefiles. Those subdirectories are automatically configured by ac_stuff/configure script. Subdirectories can have its own subsubdirectories. c) more verbose messages. makefiles now check for GNU make, consistency of makeisdc1.in and report any errors found. d) improved isdc_install program. Now it can install any file in any place with any file modes, user/group ID (provided it has sufficient permissions). See description of TO_INSTALL_EXTRA_GLOBAL and TO_INSTALL_EXTRA_LOCAL. e) compilation rules for .c.o, .C.o .cxx.o, .cpp.o, .f90.o rules now always specify output object file with -o option. Object file is now always put into same directory as source file, no matter whether it is in current directory or not. Thus source code can now be split accross several directories (within one makeisdc1.in file) f) compilation of Fortran90 code can be disabled altogether with --without-fortran90 or --with-fortran90=no option passed to the configure script. g) compilation of ISDC root code can be disabled altogether with --without-isdcroot or --with-isdcroot=no option passed to the configure script. See also par. 4 (ROOTSYS env. variable). 1.1. Upgrading from makefiles-1.3 (ac_stuff/clean_old_junk script) Upgrading from previous versions of makefiles is relatively easy : a) run ac_stuff/clean_old_junk (or ${ISDC_ENV}/bin/ac_stuff/clean_old_junk) script. This removes all files which were used in version 1.3 and are no longer used in version 2.0 (cfortran.h, cfortran_isdc.h, ./configure, ./configure.in, Makefile, Makefile.in, autoconf/*, etc) note: removal of Makefile and Makefile.in may seem strange, but those files willl be automatically recreated by subsequent run of configure script. b) edit makeisdc1.in file (rarely required). This is needed mostly in situations when one wants to add subdirectories to SUBDIRS keyword. 1.2. ac_stuff/configure or ${ISDC_ENV}/bin/ac_stuff/configure ? Initially (for most packages) there is no ac_stuff subdirectory under current directory. So one needs to run configure script which was installed system-wide in ${ISDC_ENV}/bin/ac_stuff/configure. This script creates ac_stuff subdirectory under current directory and copies all files from ${ISDC_ENV}/bin/ac_stuff to it (including configure script itself). Since ac_stuff subdirectory is never deleted (with the exception of ${ISDC_ENV}/bin/ac_stuff/clean_old_junk script) thus to configure package for the second (and subsequent times) one can type ac_stuff/configure. Wherever this document references ac_stuff/configure or ac_stuff/clean_old_junk and subdirectory ac_stuff under current directory does not exist developer has to use ${ISDC_ENV}/bin/ac_stuff/configure or ${ISDC_ENV}/bin/ac_stuff/clean_old_junk. 2. Anatomy of ISDC make files One of computer system's very annoying 'feature' is lack of 100% compatibility. Compiler options change not only between compilers of different vendors, but also between two versions of the same compiler. System libraries and system header files change as well (both location and contents). Some function calls are moved from one library to other. With each new OS version several new features (and bugs) are introduced together with fixes to previous version's bugs. To overcome all those OSversion/bug/feature problems ISDC make files use symbolic names instead of hardcoded compiler options. To facilitate this further make files are split into 2 parts : - larger file "Makefile" which defines all symbolic names. This file is common to all ISDC software packages, and is already written. - smaller file "makeisdc1" which actually defines make targets using exclusively symbolic names from Makefile. This file has to be written for each ISDC software package (one file per directory). This file is included from Makefile. This approach leverages developers from make files and OS quirks and allows him/her focus on real job. The dirty task of verifying/correcting symbolic names values depending on OS/compiler/library versions is left to the configure script (make files cannot be self-modifying, thus external program has to do it). This program (part of ISDC makefiles version 2.0) reads both Makefile and makeisdc1, makes any necessary translations and writes back corrected files. This is recursively repeated for all subdirectories specified, if any (SUBDIRS keyword). Since input and output files have to have different names thus input files have by convention .in suffix appended. Additionally, before reading Makefile.in file this file is copied from directory where ISDC make files version 2.0 were installed (this is possible since Makefile.in is common to all ISDC software packages). To recapitulate : a) for almost each directory with source code developer writing software for ISDC has to write only 1 (one) small file makeisdc1.in. b) once makeisdc1.in is written developer runs configure script (from ISDC make files installation directory, usually /isdc/dev/bin/ac_stuff) which copies Makefile.in to current directory, then reads Makefile.in and makeisdc1.in files and writes corrected version in files Makefile and makeisdc1 respectively. This command additionally creates ac_stuff subdirectory under current directory. This directory contains a copy of all ISDC make files related files (copied from ISDC make files installation directory). This is necessary because installation directory can be read-only. c) developer now can compile/run/install/test its software by running "make" program with appropriate option d) once development is complete and software is ready for delivery developer creates gzip-ped tar file with a "make targz". This command excludes all temporary files (*.o, ac_stuff/* *~, config.*, locally_installed/* and many more) from being archived in tar file. After creating tar.gz file developer should copy it into new empty directory, unpack it, and configure and build and/or install software package to verify that tar.gz contains all necessary files. When everything is OK tar.gz should be delivered to the ISDC. 3. Usage of ac_stuff/configure script and make program As a prerequisite developers should assure they have : *) working compilers, GNU make, tar, gzip, sed and grep programs in their PATH. *) ISDC_ENV environment variable is set correctly. This is not an issue for ISDC, since ISDC make files treat undefined ISDC_ENV as set to /isdc/dev. Outside ISDC however failing to define ISDC_ENV results usually in inability to compile/link programs. *) LD_LIBRARY_PATH is set correctly (on most systems this is the case). Once the forementioned conditions are met developers can : a) unpack ISDC software package from its tarfile : create and/or cd to an empty directory copy packagename.tar.gz to that directory gzip -d packagename.tar.gz tar xvf packagename.tar b) set some environment variables (this is _OPTIONAL_) setenv CC cc (assumes csh/tcsh shell) setenv CXX CC (assumes csh/tcsh shell) setenv F90 f90 (assumes csh/tcsh shell) c) configure package ${ISDC_ENV}/bin/ac_stuff/configure or for some packages (makefiles, support-sw) simply : ac_stuff/configure If configure fails, one may set/unset some additional environment variables and rerun ac_stuff/configure. Once ac_stuff/configure script is done Makefile and makeisdc1 files are updated and package is ready to be compiled. One has to rerun ac_stuff/configure after running make targz or make tarclean. d) compile package (main target) make If one wants to compile only specific executable/library then one should type : make executable_or_library_name e) install package locally (optional, this does also main target) make install By default (one can override it by setting LOCAL_INSTALL_ANCHOR before running ac_stuff/configure) files are installed under : current_dir/installed_locally/bin - executables and current_dir/installed_locally/pfiles - parameter files current_dir/installed_locally/lib - libraries current_dir/installed_locally/help - *.txt help files current_dir/installed_locally/f90mod - F90 module files current_dir/installed_locally/include - C/C++ header files (*.h) current_dir/installed_locally/share - various share files current_dir/installed_locally/templates - *.tpl template files In addition, by means of TO_INSTALL_EXTRA_LOCAL files can be installed in arbitrary directory. f) install package globally (optional, this does also main target) make global_install This installs package under /isdc/dev or other directory as defined by ${ISDC_ENV} : ${ISDC_ENV}/bin - executables ${ISDC_ENV}/pfiles - parameter files (TO_INSTALL_PAR) ${ISDC_ENV}/lib - libraries (TO_INSTALL_LIB) ${ISDC_ENV}/help - *.txt help files (TO_INSTALL_HELP) ${ISDC_ENV}/f90mod - F90 module files ${ISDC_ENV}/include - C/C++ header files (*.h) (TO_INSTALL_INC) ${ISDC_ENV}/share - various shared files (TO_INSTALL_SHARE) ${ISDC_ENV}/templates - *.tpl template files (TO_INSTALL_TEMPLATES) In addition, by means of TO_INSTALL_EXTRA_GLOBAL files can be installed in arbitrary directory. Please note that one should have sufficient write permissions, otherwise 'make global_install' will fail. g) clean all *.o, executables, libraries make clean h) delete almost everything which was not present in tar file make distclean without destroying make files structure. This also does 'make clean' This command in particular deletes config.cache file, thus subsequent run of ac_stuff/configure script will not use results from previous run. Invalidating configure's cache file is necessary when compiler names or options (as defined by CC, CXX, F90 variables) are changed. i) delete everything which was not present in tar file make tarclean This also does 'make distclean'. Once this command is executed, one has to rerun ac_stuff/configure stript to rebuild make files structure. This is only necessary for make files which have subdirectories. For each subdirectory this command deletes ac_stuff subsubdirectory only when ac_stuff_keep_flag file in not present. j) create tar file make targz This does also 'make tarclean'. One should set TAR_FILE_NAME (beginning of makeisdc1.in) to the basename of tar file (without .tar.gz suffix). For example for pil library this could be pil-1.3.4, for make files this could be makefiles-2.0. Once this command is executed, one has to rerun ac_stuff/configure stript to rebuild make files structure. This is only necessary for make files which have subdirectories. h) create tar file without unit*test subdirectories Except for recursive removal of unit*test subdirectories this is equivalent to "make targz" note: steps a) to h) can be repeated many times and in (almost) any order during development. 4. Finetuning ac_stuff/configure script The following environment variables override built-in ac_tuff/configure's script defaults (it should be stressed that those variables have to be set __BEFORE__ running ac_stuff/configure script. Changing them later has no effect. If you change them, you have to rerun ac_stuff_configure) : ISDC_ENV if defined overrides default location of ISDC software repository which is /isdc/dev. Default rules add -I${ISDC_ENV}/include, -L${ISDC_ENV}/lib when building make targets. CC forces ac_stuff/configure to choose ${CC} as its C compiler. By default it favors gcc over other compilers if both are found in the PATH. Value written to Makefile(s) by ac_stuff/configure script may contain compiler specific flags appended at the end. For example setenv CC "cc -D_MY_SYMBOL" is valid. CXX forces ac_stuff/configure to choose ${CXX} as its C++ compiler. By default it favors g++ over other compilers if both are found in the PATH. Value written to Makefile(s) by ac_stuff/configure script may contain compiler specific flags appended at the end. F90 forces ac_stuff/configure to choose ${F90} as its F90 compiler. Value written to Makefile(s) by ac_stuff/configure script may contain compiler specific flags appended at the end. CFLAGS forces ac_stuff/configure to add ${CFLAGS} to the list of command line options for C compiler. If none specified "-g" is used (sometimes "-O2 -g" for gcc). This option is used to pass any compiler specific options not detected by ac_stuff/configure script. This can include any additional directories to look for, special optimization flags, options needed to create shared library, etc. CXXFLAGS forces ac_stuff/configure to add ${CXXFLAGS} to the list of command line options for C++ compiler. If none specified "-g" is used (sometimes "-O2 -g" for g++) F90FLAGS forces ac_stuff/configure to add ${F90FLAGS} to the list of command line options for F90 compiler. If none specified "-g" is used. LOCAL_INSTALL_ANCHOR forces ac_stuff/configure to choose ${LOCAL_INSTALL_ANCHOR} as its local install directory. In general make files define 2 different install targets : "global_install" which installs given software package (library/executables) globally for everybody in /isdc/dev tree and "install" which installs given software package (library/executables) locally in local subdirectory. Default value is "locally_installed". One may want to set this value to say "../locally_installed" to have a sort of semi-global install when several packages are compiled/installed. ROOTSYS if ROOT support is enabled (this is default, can be disabled with --with-isdcroot=no command line option) -I$ROOTSYS/include is added to the list of directories searched for include files and -L$ROOTSYS/lib is added to the list of directories searched for libraries (during linking). NOTE: the default value for ROOTSYS variable is "/". So in general you want to override its value. Anyway ROOTSYS should be always defined. The following environment variables are seldom needed : EXTERN_1_INC_DIR forces ac_stuff/configure to add ${EXTERN_1_INC_DIR} directory to the list of directories scanned when looking for include files. Ignored when not specified. EXTERN_1_LIB_DIR forces ac_stuff/configure to add ${EXTERN_1_LIB_DIR} directory to the list of directories scanned when looking for library files. Ignored when not specified. EXTERN_1_F90MOD_DIR forces ac_stuff/configure to add ${EXTERN_1_F90MOD_DIR} directory to the list of directories scanned when looking for F90 module files. Ignored when not specified. F90 modules file extension and case is system/compiler dependent. EXTERN_2_INC_DIR EXTERN_2_LIB_DIR EXTERN_2_F90MOD_DIR additional directories one wants to add. May to point to any 3rd party software (NAG libraries, etc...). Ignored when undefined. note: since some of those variables are cached in config.cache file, one should run "make distclean" (or simply delete config.cache file) before rerunning ac_stuff/configure. Otherwise some values (notably CC, CXX, F90) will be taken from cache file (causing confusion at best). 5. How to write makeisdc1.in Current version of makeisdc1.in allows almost arbitrary targets be defined. It is backward compatible with previous versions plus some additional capabilities. 5.1. The simplest "hello world" case The best method to master writing make files is look at the examples, so let's start with traditional "hello_world" example, it is 1 file only, written in C, which does not require any extra libraries/header files : /********** hello.c **********/ #include int main() { puts("Greetings from ISDC in C language"): return(0); } /******* end of hello.c *******/ makeisdc1.in file for this simple program can look like : ########################### makeisdc1.in ################################## TAR_FILE_NAME = hello-1.0 C_EXEC_1_NAME = hello C_EXEC_1_SOURCES = hello.c C_EXEC_1_OBJECTS = hello.o ${C_EXEC_1_NAME}: ${C_EXEC_1_OBJECTS} ${CC} ${ALL_C_CFLAGS} -o ${C_EXEC_1_NAME} ${C_EXEC_1_OBJECTS} ${ALL_C_LDFLAGS} ${C_EXEC_1_LIBRARIES} CLEAN_TARGETS += ${C_EXEC_1_NAME} ALL_TARGETS += ${C_EXEC_1_NAME} TO_INSTALL_BIN += ${C_EXEC_1_NAME} ########################### end of makeisdc1.in ########################### Symbols in makeisdc1.in file have the following meaning : TAR_FILE_NAME base name (without .tar.gz suffix) of tar file created when "make targz" is executed. That name can be arbitrary, but by convention it is in format : package_name-version.number TAR_FILE_NAME has to be always specified, and never should be left empty/undefined. C_EXEC_1_NAME name of executable to build C_EXEC_1_SOURCES names of C source files C_EXEC_1_OBJECTS names of object files CLEAN_TARGETS add here (with += syntax) name of executable if executable should be removed when "make clean" is executed ALL_TARGETS add here (with += syntax) name of executable if executable should be built when "make" is executed TO_INSTALL_BIN add here (with += syntax) name of executable if executable should be installed when "make install" or "make global_install" is executed The two lines : ${C_EXEC_1_NAME}: ${C_EXEC_1_OBJECTS} ${CC} ${ALL_C_CFLAGS} -o $@ $^ ${ALL_C_LDFLAGS} ${C_EXEC_1_LIBRARIES} specify how to link executable from object files. While they may look quite complicated, the rule to build executable from object file is exactly the same for all executables built from C code, so one can simply copy-and-paste those 2 lines when writing his makeisdc1.in. 5.2. Typical C program linking with ISDC system libraries The second example is more complicated. The scenario is as follows : application is written in C language, according to ISDC conventions (so there is appname_main.c file, executable has its own parameter file, and .txt help file), linked with several ISDC libraries. makeisdc1.in file is listed below : ########################### makeisdc1.in ################################## TAR_FILE_NAME = rttmd-1.0 C_EXEC_1_NAME = rttmd C_EXEC_1_SOURCES = rttmd_main.c rttm.c tcpserver.c netclient.c C_EXEC_1_OBJECTS = rttmd_main.o rttm.o tcpserver.o netclient.o C_EXEC_1_LIBRARIES = -ldal3aux -ldal3gen ${ISDC_COMMON_LIBS} ${C_EXEC_1_NAME}: ${C_EXEC_1_OBJECTS} ${CC} ${ALL_C_CFLAGS} -o $@ $^ ${ALL_C_LDFLAGS} ${C_EXEC_1_LIBRARIES} CLEAN_TARGETS += ${C_EXEC_1_NAME} ALL_TARGETS += ${C_EXEC_1_NAME} TO_INSTALL_BIN += ${C_EXEC_1_NAME} TO_INSTALL_PAR += rttmd.par TO_INSTALL_HELP += rttmd.txt ########################### end of makeisdc1.in ########################### One can see that this example is very much the same as previous one. The differences are : - more than one source file constitute application - TO_INSTALL_PAR specifies name of parameter file installed by "make install" or "make global_install" - TO_INSTALL_HELP specifies name of help file installed by "make install" or "make global_install" - C_EXEC_1_LIBRARIES specifies list of libraries to link with. 5.3. Few notes on libraries Order of libraries specified in C_EXEC_1_LIBRARIES is important. Dependent libraries have to be put before libraries they depend on. For ISDC software this translates into more or less following order (those unused by application should be deleted) : -ldalspi -ldal3jemx -ldal3aux -ldal3gen -lslalib -lcommon -ldal -lril -lpil -lcfitsio ${LAST_LIBS} If your application links with -lcommon then instead of the forementioned line you can you (and this is preferred method) : -ldalspi -ldal3jemx -ldal3aux -ldal3gen -lslalib ${ISDC_COMMON_LIBS} Do not explicitly link with any of the following libraries : -lnsl -lsocket -lm link instead with ${LAST_LIBS}, and always put ${LAST_LIBS} as the last item in C_EXEC_1_LIBRARIES. The reason for doing so, is that on some systems (Solaris) those libraries exist, on other (Linux) those libraries are built into system C library, thus attempt to link with all of them will fail with a message "library not found". Correct value for LAST_LIBS is computed by ac_stuff/configure script, thus assuring portability accross different architectures. Note that ${LAST_LIBS} is included in ${ISDC_COMMON_LIBS}, so if you link with ${ISDC_COMMON_LIBS} there is no need to specify ${LAST_LIBS}. 5.4. Recursive make files Version 2.0 of ISDC make files fully supports recursive make files via SUBDIRS and EXTERNAL_PACKAGES keywords. When running given makeisdc1 file, for each subdirectory specified in SUBDIRS make program will cd to that subdirectory and invoke make program in that directory. This is done for the following make targets : all (main targets, no command line option), clean, distclean, tarclean, install, global_install. tarclean target however is not build for any subdirectory which is specified in SUBDIRS and EXTERNAL_PACKAGES. More on this later. Furthermore, tarclean target (invoked also by targz targets) removes ac_stuff/* (only when ac_stuff_keep_flag file is not present) and Makefile* and makeisdc1 files (among others) in all subdirectories specified in SUBDIRS and not specified in EXTERNAL_PACKAGES. make program processes subdirectories in order they appear in SUBDIRS. when running "make install" or "make global_install" make program for each subdirectory, invokes "make install" or "make global_install", so if : SUBDIRS = aaaaa bbbb then makeisdc1 for bbbb can safely assume that aaaaa package is already install-ed (or global_install-ed). When ac_stuff/configure script is run, it reads SUBDIRS keyword and for each subdirectory tries to find makeisdc1.in file in that subdirectory. If that makeisdc1.in file references subsubdirectories than again, it descends the whole tree down to leaves (makeisdc1.in files with empty/undefined SUBDIRS). Once the complete list of makeisdc1.in files was scanned all those files are configured in one pass by ac_stuff/configure script. It is left to developer whether given makeisdc1.in which has its own subdirectories has its own main target defined or not (C executable, library, as in previous examples). If no main target is defined then then simplest makeisdc1.in can look like : ########################### makeisdc1.in ################################## TAR_FILE_NAME = examples-makefiles-2.0 SUBDIRS = hello_c hello_c_plus_plus hello_fortran_90 ########################### end of makeisdc1.in ########################### There is also rudimentary support for external packages (external means here package which is configured by its own configure script - CFITSIO for instance) by means of EXTERNAL_PACKAGES keyword. It behaves very much the same as SUBDIRS, with the following differences : a) directories specified in EXTERNAL_PACKAGES must also be specified in SUBDIRS. If this is not the case they are ognored. They are processed in the order specified in SUBDIRS. b) tarclean is not invoked for those directories. c) for each external package ac_stuff/configure script invokes separate (external package's own) configure script. d) it is expected that external package's private Makefile.in supports at least the following targets : main (make run without any argument), clean, distclean, install, global_install. Since it is very unlikely that global_install target is already defined there, developer usually has to hand-edit external package's Makefile.in file. notes : Due to some pecularities in configure script, both SUBDIRS and EXTERNAL_PACKAGES variables cannot be split accross multiple lines using backslash '\\' syntax. In other worlds the following syntax is invalid : # !!!! INVALID SYNTAX !!!! SUBDIRS = anydir1 \ anydir2 \ anydir3 Please use either : SUBDIRS = anydir1 anydir2 anydir3 or : SUBDIRS = anydir1 SUBDIRS += anydir2 SUBDIRS += anydir3 'make global_install' and 'make' stop at the first error. 'make global_install_ignore_err' does the same as 'make global_install' but it ignores all compile/build errors and tries to build/install all targets. 5.5. Multithreaded applications Multithreaded application changes very little in makeisdc1.in file. Assuming this is pure C application makeisdc1.in can look like : ########################### makeisdc1.in ################################## TAR_FILE_NAME = mtdr-3.7 CFLAGS += -D_REENTRANT C_EXEC_1_NAME = mtdr C_EXEC_1_SOURCES = mtdr_main.c mtdr.c C_EXEC_1_OBJECTS = mtdr_main.o mtdr.o C_EXEC_1_LIBRARIES = [...] -lpil -lcfitsio [...] -L/usr/lib -lpthread ${LAST_LIBS} ${C_EXEC_1_NAME}: ${C_EXEC_1_OBJECTS} ${CC} ${ALL_C_CFLAGS} -o ${C_EXEC_1_NAME} ${C_EXEC_1_OBJECTS} ${ALL_C_LDFLAGS} ${C_EXEC_1_LIBRARIES} [...] ########################### end of makeisdc1.in ########################### Less important parts of makeisdc1.in were substituted by [...]. As one can see only 2 things are added : a) CFLAGS defines _REENTRANT symbol : CFLAGS += -D_REENTRANT b) 1 extra library is linked (this library has to be specified in C_EXEC_1_LIBRARIES as the second last item just before ${LAST_LIBS}) : -L/usr/lib -lpthread 5.6. C executable makeisdc1.in template For C executables use the following template. When copy_and_pasting make sure that TAB characters on left side of equal signs are not converted to spaces. # ============ cut_and_paste begin ============ TAR_FILE_NAME = C_EXEC_1_NAME = C_EXEC_1_SOURCES = C_EXEC_1_OBJECTS = C_EXEC_1_LIBRARIES = ${C_EXEC_1_NAME}: ${C_EXEC_1_OBJECTS} ${CC} ${ALL_C_CFLAGS} -o ${C_EXEC_1_NAME} ${C_EXEC_1_OBJECTS} ${ALL_C_LDFLAGS} ${C_EXEC_1_LIBRARIES} CLEAN_TARGETS += ${C_EXEC_1_NAME} ALL_TARGETS += ${C_EXEC_1_NAME} TO_INSTALL_BIN += ${C_EXEC_1_NAME} TO_INSTALL_HELP += TO_INSTALL_INC += TO_INSTALL_LIB += TO_INSTALL_PAR += TO_INSTALL_TEMPLATES += TO_INSTALL_EXTRA_GLOBAL += TO_INSTALL_EXTRA_LOCAL += # ============= cut_and_paste end ============= Template assumes that executable is written in C. One may define more than one C executable. In that case one should use C_EXEC_1_XXX names for 1st C executable, C_EXEC_2 for 2nd, etc... Meaning of symbols is as follows : TAR_FILE_NAME base name (without .tar.gz suffix) of tar file created when "make targz" is executed. That name can be arbitrary, but by convention it is in format : package_name-version.number TAR_FILE_NAME has to be always specified, and never should be left empty/undefined. C_EXEC_N_NAME name of executable file C_EXEC_N_SOURCES list of source files C_EXEC_N_OBJECTS list of object files. Should match C_EXEC_N_SOURCES C_EXEC_N_LIBRARIES list of libraries executable should be linked with (like -ldal, -lpil, -lril, ..). Do not explicitly link with any of the following libraries : -lnsl -lsocket -lm. Instead, link with ${LAST_LIBS}, and always put ${LAST_LIBS} as the last item in C_EXEC_N_LIBRARIES. The reason for doing so, is that on some systems (Solaris) those libraries exist, on other (Linux) those libraries are built into system C library, thus attempt to link with all of them will fail with a message "library not found". Correct value for LAST_LIBS is computed by ac_stuff/configure script, thus assuring portability across different architectures. One can always safely add ${LAST_LIBS} at the end. Linker will display warning message when some of them are not referenced in the source code. In Unix world order of libraries is (unfortunately) meaningful and dependent libraries should be put before libraries they depend on. For ISDC this translates approximately into : -ldal3 -lcommon -lril -lpil -ldal -cfitsio -lslalib ${LAST_LIBS} For very simple application this list can be empty. CLEAN_TARGETS adds name of executable to the list of files to be deleted when 'make clean' is executed. Please use += syntax. Most common value is ${C_EXEC_N_NAME}. ALL_TARGETS adds name of executable to the list of targets to be build when 'make' is executed. Please use += syntax. Most common value is ${C_EXEC_N_NAME}. TO_INSTALL_BIN adds name of executable to the list of files to be copied when 'make install' or 'make global_install' is executed. Please use += syntax. During 'make install' parameter file(s) are copied to ${LOCAL_INSTALL_ANCHOR}/bin. During 'make global_install' files are copied to ${ISDC_ENV}/bin. Most common value is ${C_EXEC_N_NAME}. TO_INSTALL_HELP adds names of help/README (*.txt, *.hlp, *.html) files to the list of files which should be copied during 'make install' or 'make global_install'. Please use '+=' syntax. During 'make install' parameter file(s) are copied to ${LOCAL_INSTALL_ANCHOR}/help. During 'make global_install' files are copied to ${ISDC_ENV}/help. For ISDC executables most common value is ${C_EXEC_N_NAME}.txt TO_INSTALL_INC adds name(s) of C header files (*.h) to the list of files copied when 'make install' or 'make global_install' is executed. Please use += syntax. During 'make install' parameter file(s) are copied to ${LOCAL_INSTALL_ANCHOR}/include. During 'make global_install' files are copied to ${ISDC_ENV}/include. TO_INSTALL_LIB adds name(s) of library(ies) (*.a) to the list of files to be copied when 'make install' or 'make global_install' is executed. Please use += syntax. During 'make install' parameter file(s) are copied to ${LOCAL_INSTALL_ANCHOR}/lib. During 'make global_install' files are copied to ${ISDC_ENV}/lib. TO_INSTALL_PAR if executable has parameter file(s) to install during 'make install' or 'make global_install' then add name of those files to TO_INSTALL_PAR. Please use '+=' syntax. During 'make install' parameter file(s) are copied to ${LOCAL_INSTALL_ANCHOR}/bin. During 'make global_install' files are copied to ${ISDC_ENV}/bin. For ISDC executables most common value is ${C_EXEC_N_NAME}.par TO_INSTALL_TEMPLATES adds names of template files (*.tpl) files to the list of files which should be copied during 'make install' or 'make global_install'. Please use '+=' syntax. During 'make install' parameter file(s) are copied to ${LOCAL_INSTALL_ANCHOR}/templates. During 'make global_install' files are copied to ${ISDC_ENV}/templates. TO_INSTALL_EXTRA_GLOBAL list of files and commands passed to the isdc_install program when running 'make global_install'. Please use '+=' syntax. This list allows installation of arbitrary files in arbitrary location, with arbitrary mode, UID, GID. For more information refer to the description of isdc_install program. TO_INSTALL_EXTRA_LOCAL list of files and commands passed to the isdc_install program when running 'make install'. Please use '+=' syntax. This list allows installation of arbitrary files in arbitrary location, with arbitrary mode, UID, GID. For more information refer to the description of isdc_install program. To recapitulate here is simple example. Lets assume our executable name is helloc. Library is written in C, and there are 2 C source files : helloc.c error_handler.c Executable links only with system libraries. Executable does not have any parameter file. Respective makeisdc1.in could be : ########################################################################## # package: makefiles # # version: 2.0, 17-Jan-2000 # # file: makeisdc1(.in) # # author: Jerzy.Borkowski@obs.unige.ch # # copyright: ISDC, chemin d'Ecogia 16, 1290 Versoix, Switzerland # ########################################################################## TAR_FILE_NAME = helloc-0.0.7 C_EXEC_1_NAME = helloc C_EXEC_1_SOURCES = helloc.c error_handler.c C_EXEC_1_OBJECTS = helloc.o error_handler.o C_EXEC_1_LIBRARIES = ${LAST_LIBS} ${C_EXEC_1_NAME}: ${C_EXEC_1_OBJECTS} ${CC} ${ALL_C_CFLAGS} -o ${C_EXEC_1_NAME} ${C_EXEC_1_OBJECTS} ${ALL_C_LDFLAGS} ${C_EXEC_1_LIBRARIES} CLEAN_TARGETS += ${C_EXEC_1_NAME} ALL_TARGETS += ${C_EXEC_1_NAME} TO_INSTALL_BIN += ${C_EXEC_1_NAME} TO_INSTALL_HELP += TO_INSTALL_INC += TO_INSTALL_LIB += TO_INSTALL_PAR += TO_INSTALL_TEMPLATES += TO_INSTALL_EXTRA_GLOBAL += TO_INSTALL_EXTRA_LOCAL += 5.7. C++ executable makeisdc1.in template For C++ executables use the following template. When copy_and_pasting make sure that TAB characters on left side of equal signs are not converted to spaces. # ============ cut_and_paste begin ============ ########################################################################## # package: makefiles # # version: 2.0, 17-Jan-2000 # # file: makeisdc1(.in) # # author: Jerzy.Borkowski@obs.unige.ch # # copyright: ISDC, chemin d'Ecogia 16, 1290 Versoix, Switzerland # ########################################################################## TAR_FILE_NAME = CXX_EXEC_1_NAME = CXX_EXEC_1_SOURCES = CXX_EXEC_1_OBJECTS = CXX_EXEC_1_LIBRARIES = ${CXX_EXEC_1_NAME}: ${CXX_EXEC_1_OBJECTS} ${CXX} ${ALL_CXX_CFLAGS} -o ${CXX_EXEC_1_NAME} ${CXX_EXEC_1_OBJECTS} ${ALL_CXX_LDFLAGS} ${CXX_EXEC_1_LIBRARIES} CLEAN_TARGETS += ${CXX_EXEC_1_NAME} ALL_TARGETS += ${CXX_EXEC_1_NAME} TO_INSTALL_BIN += ${CXX_EXEC_1_NAME} TO_INSTALL_HELP += TO_INSTALL_INC += TO_INSTALL_LIB += TO_INSTALL_PAR += TO_INSTALL_TEMPLATES += TO_INSTALL_EXTRA_GLOBAL += TO_INSTALL_EXTRA_LOCAL += # ============= cut_and_paste end ============= Template assumes that executable is written in C. One may define more than one C++ executable. In that case one should use CXX_EXEC_1_XXX names for 1st C++ executable, CXX_EXEC_2 for 2nd, etc... Meaning of symbols is as follows : TAR_FILE_NAME base name (without .tar.gz suffix) of tar file created when "make targz" is executed. That name can be arbitrary, but by convention it is in format : package_name-version.number TAR_FILE_NAME has to be always specified, and never should be left empty/undefined. CXX_EXEC_N_NAME name of executable file CXX_EXEC_N_SOURCES list of source files CXX_EXEC_N_OBJECTS list of object files. Should match CXX_EXEC_N_SOURCES CXX_EXEC_N_LIBRARIES list of libraries executable should be linked with (like -ldal, -lpil, -lril, ..). Do not explicitly link with any of the following libraries : -lnsl -lsocket -lm. Instead, link with ${LAST_LIBS}, and always put ${LAST_LIBS} as the last item in CXX_EXEC_N_LIBRARIES. The reason for doing so, is that on some systems (Solaris) those libraries exist, on other (Linux) those libraries are built into system C library, thus attempt to link with all of them will fail with a message "library not found". Correct value for LAST_LIBS is computed by ac_stuff/configure script, thus assuring portability across different architectures. One can always safely add ${LAST_LIBS} at the end. Linker will display warning message when some of them are not referenced in the source code. In Unix world order of libraries is (unfortunately) meaningful and dependent libraries should be put before libraries they depend on. For ISDC this translates approximately into : -ldal3 -lcommon -lril -lpil -ldal -cfitsio -lslalib ${LAST_LIBS} For very simple application this list can be empty. CLEAN_TARGETS adds name of executable to the list of files to be deleted when 'make clean' is executed. Please use += syntax. Most common value is ${CXX_EXEC_N_NAME}. ALL_TARGETS adds name of executable to the list of targets to be build when 'make' is executed. Please use += syntax. Most common value is ${CXX_EXEC_N_NAME}. TO_INSTALL_BIN adds name of executable to the list of files to be copied when 'make install' or 'make global_install' is executed. Please use += syntax. During 'make install' parameter file(s) are copied to ${LOCAL_INSTALL_ANCHOR}/bin. During 'make global_install' files are copied to ${ISDC_ENV}/bin. Most common value is ${CXX_EXEC_N_NAME}. TO_INSTALL_HELP adds names of help/README (*.txt, *.hlp, *.html) files to the list of files which should be copied during 'make install' or 'make global_install'. Please use '+=' syntax. During 'make install' parameter file(s) are copied to ${LOCAL_INSTALL_ANCHOR}/help. During 'make global_install' files are copied to ${ISDC_ENV}/help. For ISDC executables most common value is ${CXX_EXEC_N_NAME}.txt TO_INSTALL_INC adds name(s) of C++ header files (*.h) to the list of files copied when 'make install' or 'make global_install' is executed. Please use += syntax. During 'make install' parameter file(s) are copied to ${LOCAL_INSTALL_ANCHOR}/include. During 'make global_install' files are copied to ${ISDC_ENV}/include. TO_INSTALL_LIB adds name(s) of library(ies) (*.a) to the list of files to be copied when 'make install' or 'make global_install' is executed. Please use += syntax. During 'make install' parameter file(s) are copied to ${LOCAL_INSTALL_ANCHOR}/lib. During 'make global_install' files are copied to ${ISDC_ENV}/lib. TO_INSTALL_PAR if executable has parameter file(s) to install during 'make install' or 'make global_install' then add name of those files to TO_INSTALL_PAR. Please use '+=' syntax. During 'make install' parameter file(s) are copied to ${LOCAL_INSTALL_ANCHOR}/bin. During 'make global_install' files are copied to ${ISDC_ENV}/bin. For ISDC executables most common value is ${CXX_EXEC_N_NAME}.par TO_INSTALL_TEMPLATES adds names of template files (*.tpl) files to the list of files which should be copied during 'make install' or 'make global_install'. Please use '+=' syntax. During 'make install' parameter file(s) are copied to ${LOCAL_INSTALL_ANCHOR}/templates. During 'make global_install' files are copied to ${ISDC_ENV}/templates. TO_INSTALL_EXTRA_GLOBAL list of files and commands passed to the isdc_install program when running 'make global_install'. Please use '+=' syntax. This list allows installation of arbitrary files in arbitrary location, with arbitrary mode, UID, GID. For more information refer to the description of isdc_install program. TO_INSTALL_EXTRA_LOCAL list of files and commands passed to the isdc_install program when running 'make install'. Please use '+=' syntax. This list allows installation of arbitrary files in arbitrary location, with arbitrary mode, UID, GID. For more information refer to the description of isdc_install program. To recapitulate here is simple example. Lets assume our executable name is helloc. Library is written in C, and there are 2 C++ source files : hellocplusplus.C error_handler.C Executable links only with system libraries. Executable does not have any parameter file. Respective makeisdc1.in could be : ########################################################################## # package: makefiles # # version: 2.0, 17-Jan-2000 # # file: makeisdc1(.in) # # author: Jerzy.Borkowski@obs.unige.ch # # copyright: ISDC, chemin d'Ecogia 16, 1290 Versoix, Switzerland # ########################################################################## TAR_FILE_NAME = hellocplusplus-0.0.7 CXX_EXEC_1_NAME = hellocplusplus CXX_EXEC_1_SOURCES = hellocplusplus.C error_handler.C CXX_EXEC_1_OBJECTS = hellocplusplus.o error_handler.o CXX_EXEC_1_LIBRARIES = ${LAST_LIBS} ${CXX_EXEC_1_NAME}: ${CXX_EXEC_1_OBJECTS} ${CXX} ${ALL_CXX_CFLAGS} -o ${CXX_EXEC_1_NAME} ${CXX_EXEC_1_OBJECTS} ${ALL_CXX_LDFLAGS} ${CXX_EXEC_1_LIBRARIES} CLEAN_TARGETS += ${CXX_EXEC_1_NAME} ALL_TARGETS += ${CXX_EXEC_1_NAME} TO_INSTALL_BIN += ${CXX_EXEC_1_NAME} TO_INSTALL_HELP += TO_INSTALL_INC += TO_INSTALL_LIB += TO_INSTALL_PAR += TO_INSTALL_TEMPLATES += TO_INSTALL_EXTRA_GLOBAL += TO_INSTALL_EXTRA_LOCAL += 5.8. Fortran 90 executable makeisdc1.in template For Fortran 90 executables use the following template. When copy_and_pasting make sure that TAB characters on left side of equal signs are not converted to spaces. # ============ cut_and_paste begin ============ ########################################################################## # package: makefiles # # version: 2.0, 17-Jan-2000 # # file: makeisdc1(.in) # # author: Jerzy.Borkowski@obs.unige.ch # # copyright: ISDC, chemin d'Ecogia 16, 1290 Versoix, Switzerland # ########################################################################## TAR_FILE_NAME = F90_EXEC_1_NAME = F90_EXEC_1_SOURCES = F90_EXEC_1_OBJECTS = F90_EXEC_1_LIBRARIES = ${F90_EXEC_1_NAME}: ${F90_EXEC_1_OBJECTS} ${F90} ${ALL_F90_CFLAGS} -o ${F90_EXEC_1_NAME} ${F90_EXEC_1_OBJECTS} ${ALL_F90_LDFLAGS} ${F90_EXEC_1_LIBRARIES} CLEAN_TARGETS += ${F90_EXEC_1_NAME} ALL_TARGETS += ${F90_EXEC_1_NAME} TO_INSTALL_F90_BIN += ${F90_EXEC_1_NAME} TO_INSTALL_F90_HELP += TO_INSTALL_F90_PAR += TO_INSTALL_TEMPLATES += TO_INSTALL_EXTRA_GLOBAL += TO_INSTALL_EXTRA_LOCAL += # ============= cut_and_paste end ============= Template assumes that executable is written in C. One may define more than one Fortran 90 executable. In that case one should use F90_EXEC_1_XXX names for 1st Fortran 90 executable, F90_EXEC_2 for 2nd, etc... Meaning of symbols is as follows : TAR_FILE_NAME base name (without .tar.gz suffix) of tar file created when "make targz" is executed. That name can be arbitrary, but by convention it is in format : package_name-version.number TAR_FILE_NAME has to be always specified, and never should be left empty/undefined. F90_EXEC_N_NAME name of executable file F90_EXEC_N_SOURCES list of source files F90_EXEC_N_OBJECTS list of object files. Should match F90_EXEC_N_SOURCES F90_EXEC_N_LIBRARIES list of libraries executable should be linked with (like -ldal, -lpil, -lril, ..). Do not explicitly link with any of the following libraries : -lnsl -lsocket -lm. Instead, link with ${LAST_LIBS}, and always put ${LAST_LIBS} as the last item in F90_EXEC_N_LIBRARIES. The reason for doing so, is that on some systems (Solaris) those libraries exist, on other (Linux) those libraries are built into system C library, thus attempt to link with all of them will fail with a message "library not found". Correct value for LAST_LIBS is computed by ac_stuff/configure script, thus assuring portability across different architectures. One can always safely add ${LAST_LIBS} at the end. Linker will display warning message when some of them are not referenced in the source code. In Unix world order of libraries is (unfortunately) meaningful and dependent libraries should be put before libraries they depend on. For ISDC this translates approximately into : -ldal3 -lcommon -lril -lpil -ldal -cfitsio -lslalib ${LAST_LIBS} For very simple application this list can be empty. CLEAN_TARGETS adds name of executable to the list of files to be deleted when 'make clean' is executed. Please use += syntax. Most common value is ${F90_EXEC_N_NAME}. ALL_TARGETS adds name of executable to the list of targets to be build when 'make' is executed. Please use += syntax. Most common value is ${F90_EXEC_N_NAME}. TO_INSTALL_F90_BIN adds name of executable to the list of files to be copied when 'make install' or 'make global_install' is executed. Please use += syntax. During 'make install' parameter file(s) are copied to ${LOCAL_INSTALL_ANCHOR}/bin. During 'make global_install' files are copied to ${ISDC_ENV}/bin. Most common value is ${F90_EXEC_N_NAME}. TO_INSTALL_F90_HELP adds names of help/README (*.txt, *.hlp, *.html) files to the list of files which should be copied during 'make install' or 'make global_install'. Please use '+=' syntax. During 'make install' parameter file(s) are copied to ${LOCAL_INSTALL_ANCHOR}/help. During 'make global_install' files are copied to ${ISDC_ENV}/help. For ISDC executables most common value is ${F90_EXEC_N_NAME}.txt TO_INSTALL_F90_PAR if executable has parameter file(s) to install during 'make install' or 'make global_install' then add name of those files to TO_INSTALL_F90_PAR. Please use '+=' syntax. During 'make install' parameter file(s) are copied to ${LOCAL_INSTALL_ANCHOR}/bin. During 'make global_install' files are copied to ${ISDC_ENV}/bin. For ISDC executables most common value is ${F90_EXEC_N_NAME}.par TO_INSTALL_TEMPLATES adds names of template files (*.tpl) files to the list of files which should be copied during 'make install' or 'make global_install'. Please use '+=' syntax. During 'make install' parameter file(s) are copied to ${LOCAL_INSTALL_ANCHOR}/templates. During 'make global_install' files are copied to ${ISDC_ENV}/templates. TO_INSTALL_EXTRA_GLOBAL list of files and commands passed to the isdc_install program when running 'make global_install'. Please use '+=' syntax. This list allows installation of arbitrary files in arbitrary location, with arbitrary mode, UID, GID. For more information refer to the description of isdc_install program. TO_INSTALL_EXTRA_LOCAL list of files and commands passed to the isdc_install program when running 'make install'. Please use '+=' syntax. This list allows installation of arbitrary files in arbitrary location, with arbitrary mode, UID, GID. For more information refer to the description of isdc_install program. To recapitulate here is simple example. Lets assume our executable name is helloc. Library is written in C, and there are 2 Fortran 90 source files : hellocplusplus.C error_handler.C Executable links only with system libraries. Executable does not have any parameter file. Respective makeisdc1.in could be : ########################################################################## # package: makefiles # # version: 2.0, 17-Jan-2000 # # file: makeisdc1(.in) # # author: Jerzy.Borkowski@obs.unige.ch # # copyright: ISDC, chemin d'Ecogia 16, 1290 Versoix, Switzerland # ########################################################################## TAR_FILE_NAME = hellofortran90-0.0.7 F90_EXEC_1_NAME = hellofortran90 F90_EXEC_1_SOURCES = hellofortran90.f90 error_handler.f90 F90_EXEC_1_OBJECTS = hellofortran90.o error_handler.o F90_EXEC_1_LIBRARIES = ${LAST_LIBS} ${F90_EXEC_1_NAME}: ${F90_EXEC_1_OBJECTS} ${F90} ${ALL_F90_CFLAGS} -o ${F90_EXEC_1_NAME} ${F90_EXEC_1_OBJECTS} ${ALL_F90_LDFLAGS} ${F90_EXEC_1_LIBRARIES} CLEAN_TARGETS += ${F90_EXEC_1_NAME} ALL_TARGETS += ${F90_EXEC_1_NAME} TO_INSTALL_F90_BIN += ${F90_EXEC_1_NAME} TO_INSTALL_F90_HELP += TO_INSTALL_F90_PAR += TO_INSTALL_TEMPLATES += TO_INSTALL_EXTRA_GLOBAL += TO_INSTALL_EXTRA_LOCAL += 5.9. static library makeisdc1.in template For libraries use the following template. When copy_and_pasting make sure that TAB characters on left side of equal signs are not converted to spaces. # ============ cut_and_paste begin ============ ########################################################################## # package: makefiles # # version: 2.0, 17-Jan-2000 # # file: makeisdc1(.in) # # author: Jerzy.Borkowski@obs.unige.ch # # copyright: ISDC, chemin d'Ecogia 16, 1290 Versoix, Switzerland # ########################################################################## TAR_FILE_NAME = LIB_SHORT_NAME = LIB_FULL_NAME = LIB_SOURCES = ${LIB_F90_SOURCES} \ _LIB_F90_SOURCES = ${LIB_F90_EARLY_SOURCES} \ ${LIB_F90_INT8_SOURCES} \ _LIB_F90_EARLY_SOURCES = _LIB_F90_INT8_SOURCES = LIB_OBJECTS = ${LIB_F90_OBJECTS} \ _LIB_F90_OBJECTS = ${LIB_F90_EARLY_OBJECTS} \ ${LIB_F90_INT8_OBJECTS} \ _LIB_F90_EARLY_OBJECTS = _LIB_F90_INT8_OBJECTS = ${LIB_FULL_NAME}: ${LIB_OBJECTS} ar -rv ${LIB_FULL_NAME} ${LIB_OBJECTS} CLEAN_TARGETS += ${LIB_FULL_NAME} ALL_TARGETS += ${LIB_FULL_NAME} TO_INSTALL_BIN += TO_INSTALL_INC += TO_INSTALL_LIB += ${LIB_FULL_NAME} TO_INSTALL_HELP += TO_INSTALL_F90MOD_NORMAL+= TO_INSTALL_F90MOD_UPPER += _TO_INSTALL_F90MOD_INT8_NORMAL += _TO_INSTALL_F90MOD_INT8_UPPER += TO_INSTALL_PAR += TO_INSTALL_TEMPLATES += TO_INSTALL_EXTRA_GLOBAL += TO_INSTALL_EXTRA_LOCAL += # ============= cut_and_paste end ============= Template assumes that most of the code is written in C (or C++) and F90 bindings are done via cfortran.h package, but is also appropriate for library written in F90. Symbols have the following meaning : TAR_FILE_NAME base name (without .tar.gz suffix) of tar file created when "make targz" is executed. That name can be arbitrary, but by convention it is in format : package_name-version.number TAR_FILE_NAME has to be always specified, and never should be left empty/undefined. LIB_SHORT_NAME short name of library (like pil, ril, common, ...) LIB_FULL_NAME name of library file (libpil.a, libcommon.a, ...), do not include path here. Most common value is lib${LIB_SHORT_VALUE}.a LIB_SOURCES list of library's C/C++ source files. Do not delete ${LIB_F90_SOURCES} in template, rather append names of C/C++ files in subsequent lines. _LIB_F90_SOURCES list of library's F90 source files. Do not delete ${LIB_F90_EARLY_SOURCES} and ${LIB_F90_INT8_SOURCES} in template, rather append names of F90 files in subsequent lines. _LIB_F90_EARLY_SOURCES list of library's F90 source files which should be compiled before other F90 source files. This list is usually empty, but is necessary when F90 source files use functions and subroutines from F90_UNIX module (like INTEGER IARGC() or CALL GETARG(INTEGER, STRING)) and compiler does not have built-in prototypes. If this is the case it should have one file libraryname_f90_unix.f90 (it is pil_f90_unix.f90 or common_f90_unix.f90), and that file should look like (other prototypes of functions found in F90_UNIX modules should be added when necessary) : ! ========================= libraryname_f90_unix.f90 ====================== MODULE F90_UNIX INTERFACE IARGC FUNCTION IARGC() INTEGER :: IARGC END FUNCTION IARGC END INTERFACE INTERFACE GETARG SUBROUTINE GETARG(IDX, ARGV) INTEGER :: IDX CHARACTER*(*) :: ARGV END SUBROUTINE GETARG END INTERFACE END MODULE F90_UNIX ! ================== end of libraryname_f90_unix.f90 ====================== _LIB_F90_INT8_SOURCES list of library's additional F90 source files which should be compiled when F90 compiler fully supports 8-byte integers. Some compilers (SunSoft F90 1.2) silently maps them to 4-byte integers. ac_stuff/configure script checks whether F90 really supports 8-byte integers. LIB_OBJECTS list of library's C/C++ object files. Do not delete ${LIB_F90_OBJECTS} in template, rather append names of C/C++ object files in subsequent lines. This list should match LIB_SOURCES. _LIB_F90_OBJECTS list of library's F90 object files. Do not delete ${LIB_F90_EARLY_OBJECTS} and ${LIB_F90_INT8_OBJECTS} in template, rather append names of F90 object files in subsequent lines. This list should match _LIB_F90_SOURCES _LIB_F90_EARLY_OBJECTS list of library's F90 object files matching _LIB_F90_EARLY_SOURCES _LIB_F90_INT8_OBJECTS list of library's F90 object files matching _LIB_F90_INT8_SOURCES TO_INSTALL_INC adds name(s) of C++ header files (*.h) to the list of files copied when 'make install' or 'make global_install' is executed. Please use += syntax. During 'make install' parameter file(s) are copied to ${LOCAL_INSTALL_ANCHOR}/include. During 'make global_install' files are copied to ${ISDC_ENV}/include. TO_INSTALL_LIB adds name(s) of library(ies) (*.a) to the list of files to be copied when 'make install' or 'make global_install' is executed. Please use += syntax. During 'make install' parameter file(s) are copied to ${LOCAL_INSTALL_ANCHOR}/lib. During 'make global_install' files are copied to ${ISDC_ENV}/lib. TO_INSTALL_HELP adds names of help/README (*.txt, *.hlp, *.html) files to the list of files which should be copied during 'make install' or 'make global_install'. Please use '+=' syntax. During 'make install' parameter file(s) are copied to ${LOCAL_INSTALL_ANCHOR}/help. During 'make global_install' files are copied to ${ISDC_ENV}/help. For ISDC executables most common value is ${CXX_EXEC_N_NAME}.txt TO_INSTALL_F90MOD_NORMAL list of F90 modules which should be copied during "make install" or "make global_install". In the case ISDC system library is being built this list contains usually libraryname_f90_api.mod. Since extension is system/compiler dependent one should use ${F90MOD_EXT} macro which is defined by configure script. Please use '+=' syntax. During 'make install' parameter file(s) are copied to ${LOCAL_INSTALL_ANCHOR}/f90mod. During 'make global_install' files are copied to ${ISDC_ENV}/f90mod. TO_INSTALL_F90MOD_UPPER the same as TO_INSTALL_F90MOD_NORMAL but file names are in UPPERCASE (excluding file extension). So if TO_INSTALL_F90MOD_NORMAL contains libraryname_f90_api.mod then TO_INSTALL_F90MOD_UPPER should contain LIBRARYNAME_F90_API.mod. This is necessary to support F90 compiler found on SGI/IRIX which always creates F90 module files in uppercase (excl. extension). Please use '+=' syntax. TO_INSTALL_F90MOD_INT8_NORMAL similar to TO_INSTALL_F90MOD_NORMAL. Lists additional F90 modules which should be copied during "make install" or "make global_install" when F90 compiler supports INTEGER*8 data type. TO_INSTALL_F90MOD_INT8_UPPER similar to TO_INSTALL_F90MOD_UPPER. Lists in uppercase additional F90 modules which should be copied during "make install" or "make global_install" when F90 compiler supports INTEGER*8 data type. TO_INSTALL_EXTRA_GLOBAL list of files and commands passed to the isdc_install program when running 'make global_install'. Please use '+=' syntax. This list allows installation of arbitrary files in arbitrary location, with arbitrary mode, UID, GID. For more information refer to the description of isdc_install program. TO_INSTALL_EXTRA_LOCAL list of files and commands passed to the isdc_install program when running 'make install'. Please use '+=' syntax. This list allows installation of arbitrary files in arbitrary location, with arbitrary mode, UID, GID. For more information refer to the description of isdc_install program. To recapitulate here is simple example. Lets assume our library name is g_burst_detect. Library is written in C, and there are 4 C source files : g_burst_detect.c send_alert.c moc_interface.c db_interface.c Since library has F90 bindings via cfortran.h package so there are additional 2 files in _LIB_F90_SOURCES: g_burst_detect_f90_api.f90 g_burst_detect_f90_bind.c Library has public C/C++ include file g_burst_detect.h which has to included by C/C++ applications and g_burst_detect_f90_api F90 module which should be USE'd by F90 applications. Thus g_burst_detect.h is added to TO_INSTALL_INC, g_burst_detect_f90_api.${F90MOD_EXT} is added to TO_INSTALL_F90MOD_NORMAL and G_BURST_DETECT_F90_API.${F90MOD_EXT} is added to TO_INSTALL_F90MOD_UPPER # ============ cut_and_paste begin ============ ########################################################################## # package: makefiles # # version: 2.0, 17-Jan-2000 # # file: makeisdc1(.in) # # author: Jerzy.Borkowski@obs.unige.ch # # copyright: ISDC, chemin d'Ecogia 16, 1290 Versoix, Switzerland # ########################################################################## TAR_FILE_NAME = g_burst_detect_lib-1.0 LIB_SHORT_NAME = g_burst_detect LIB_FULL_NAME = libg_burst_detect.a LIB_SOURCES = ${LIB_F90_SOURCES} _LIB_F90_SOURCES = ${LIB_F90_EARLY_SOURCES} \ ${LIB_F90_INT8_SOURCES} \ g_burst_detect_f90_api.f90 \ g_burst_detect_f90_bind.c _LIB_F90_EARLY_SOURCES = _LIB_F90_INT8_SOURCES = LIB_OBJECTS = ${LIB_F90_OBJECTS} _LIB_F90_OBJECTS = ${LIB_F90_EARLY_OBJECTS} \ ${LIB_F90_INT8_OBJECTS} \ g_burst_detect_f90_api.o \ g_burst_detect_f90_bind.o _LIB_F90_EARLY_OBJECTS = _LIB_F90_INT8_OBJECTS = ${LIB_FULL_NAME}: ${LIB_OBJECTS} ar -rv ${LIB_FULL_NAME} ${LIB_OBJECTS} CLEAN_TARGETS += ${LIB_FULL_NAME} ALL_TARGETS += ${LIB_FULL_NAME} TO_INSTALL_BIN += TO_INSTALL_INC += g_burst_detect.h TO_INSTALL_LIB += ${LIB_FULL_NAME} TO_INSTALL_HELP += TO_INSTALL_F90MOD_NORMAL += g_burst_detect_f90_api.${F90MOD_EXT} TO_INSTALL_F90MOD_UPPER += G_BURST_DETECT_F90_API.${F90MOD_EXT} TO_INSTALL_EXTRA_GLOBAL += TO_INSTALL_EXTRA_LOCAL += 5.10. mixed language executable If executable is a mixed language application the forementioned templates should be slightly modified. The biggest problem is which compiler is used to link application. In general : if application has some code written in C++ use C++ compiler, otherwise if there is some code in F90 then use F90 compiler, otherwise use C compiler. Table below shows details : source code in linker command (incomplete) ---------------------------------------------------------------------- C C ${CC} .. ${ALL_C_LDFLAGS} .. C++ C++ ${CXX} .. ${ALL_CXX_LDFLAGS}.. Fortran 90 Fortran 90 ${F90} .. ${ALL_F90_LDFLAGS}.. C and C++ C++ ${CXX} .. ${ALL_CXX_LDFLAGS}.. C and Fortran 90 Fortran 90 ${F90} .. ${ALL_F90_LDFLAGS}.. C++ and Fortran 90 C++ ${CXX} .. ${ALL_CXX_LDFLAGS}.. C and C++ and Fortran 90 C++ ${CXX} .. ${ALL_CXX_LDFLAGS}.. In the last 2 cases one should explicitly link with F77 or F90 libraries since by default C++ compiler does not look for them during linking phase. note: all code should be compiled with more or less consistent set of options (across different compilers), especially with regard to data alignment and data size. 5.11. log files ISDC makefiles create a log file of compilation/build process in each directory. If compilation/build succeeds log file has the name make_ok.log. If it fails then the log file has the name make_failed.log. 5.12. NAG librbary The following syntax should be used for targets (programs) which make use of the NAG library : -l{NAGLIB} NAGLIB variable should be set to the correct name before "make global_install" is run. 6. isdc_install program isdc_install program is used by "make install" and "make global_install". It is part of ISDC make files version 2.0. It can install in one call multiple files in different locations. Any installed file can have any possible mode, UID and GID assigned (provided sufficient permissions are granted). After ac_stuff/configure script is run ${ISDC_INSTALL} variable points to isdc_install executable (it is usually ac_stuff/isdc_install). Executable is automatically build on demand, it is during first "make install" or "make global_install". One can also build it isdc_install by typing : make ac_stuff/isdc_install isdc_install's command line syntax is : ac_stuff/isdc_install file_or_option [file_or_option] [file_or_option] ... where file_or_option is either name of file to be installed or : -c (create directory given by previous -d or -M, -u, -g) -d install_directory (has to be specified at least once) -e integer (nonzero - fail on first error, 0 - ignore/continue) -g group_id_or_name (chgrp to group_name, default -1 disables chgrp) -m octal_mode (create mode for files, default is 0644) -M octal_mode (create mode for directories, default is 0755) -q (be quiet when no files to install in command line) -u user_id_or_name (chown to user_name, default -1 disables chown) Any option can be specified multiple times and is effective only for arguments between that and subsequent same option. This program is best used together with TO_INSTALL_EXTRA_GLOBAL and/or TO_INSTALL_EXTRA_LOCAL keywords, especially for files which have to installed outside ${ISDC_ENV} directory tree. For instance, Data Receipt daemon has to be started upon system boot, so there has to one file (S96rttm) installed in /etc/rc2.d directory. This is easily done with the following line : TO_INSTALL_EXTRA_GLOBAL += -d /etc/rc2.d -c -u root -g sys -m 744 S96rttm Here is more complicated example (exerpt from make files makeisdc1.in) : TO_INSTALL_EXTRA_GLOBAL += \ -q -m 664 \ -d ${GLOBAL_INSTALL_BIN_DIR}/ac_stuff -c \ ac_stuff/Makefile.in \ ac_stuff/Makefile \ ac_stuff/isdc_install.c \ ac_stuff/configure.in \ -m 775 \ ac_stuff/configure \ -d ${GLOBAL_INSTALL_BIN_DIR}/ac_stuff/autoconf -c \ ac_stuff/autoconf/configure \ ac_stuff/autoconf/config.sub \ ac_stuff/autoconf/config.guess \ ac_stuff/autoconf/install-sh This creates directories : ${GLOBAL_INSTALL_BIN_DIR}/ac_stuff and ${GLOBAL_INSTALL_BIN_DIR}/ac_stuff/autoconf and copies several files into them. Note that some files have modes set to 664, other to 775. 7. Additional information One may define its own additinal targets not described here. Those targets should be defined in makeisdc1.in. Be careful to use TAB characters and not spaces in target definitions (not in macro definitions). By default, "make targz" command does not include ac_stuff and CVS directories (under top level directory) in the tar file. One can force it to include those directories (if they exist) by creating in top level directory dummy files : CVS_keep_flag and/or ac_stuff_keep_flag. Only GNU make is officially supported. Version 3.77 was tested. Make programs found on SGI/IRIX 6.4 and DEC/OSF do not work (they don't understand '+=' syntax. Solaris /usr/ccs/bin/make understands '+=' syntax but has problems with macro expansion. On Linux GNU make is the default one and works. Other architectures were not checked. Be careful not to leave trailing spaces in lines which define macros (it is almost everywhere). Otherwise GNU make (and other make programs) have tendency to fail miserably and without any apparent reason/warning. When macro definition spans multiple lines all lines but last should end with backslash '\'. Macro definition should be followed by an empty line.