| 1 | #!/bin/csh | 
|---|
| 2 | # $Id: mkmf,v 1.4 1999-10-20 10:25:12 ansari Exp $ | 
|---|
| 3 |  | 
|---|
| 4 | # creation de MakefileUser.h a partir de Makefile.h | 
|---|
| 5 | echo 'mkmf: Creation de MakefileUser.h' | 
|---|
| 6 | echo 'pour la librairie cfitsio : definir la variable d environnement SITE et donner l adresse de la librairie dans Makefile.h' | 
|---|
| 7 | cat Makefile.h | awk -f makefileuser.awk >! MakefileUser.h | 
|---|
| 8 |  | 
|---|
| 9 | # creation des liens pour les includes | 
|---|
| 10 | echo 'mkmf: Creation des liens (appel mkmflien)' | 
|---|
| 11 | ./mkmflien | 
|---|
| 12 |  | 
|---|
| 13 | echo 'mkmf: Creation makefile global :' | 
|---|
| 14 | rm -f GNUmakefile | 
|---|
| 15 |  | 
|---|
| 16 | echo 'include Mgr/Makefile.h' >> GNUmakefile | 
|---|
| 17 |  | 
|---|
| 18 | echo 'LIBF = ' `sed -e 's/.*/$(LIB)lib&.a/' libdirs` >> GNUmakefile | 
|---|
| 19 | echo 'LIBS = -L$(LIB)' `sed -e 's/.*/-l&/' libdirs` '-lm' >> GNUmakefile | 
|---|
| 20 | echo 'LIBG = -L$(GLB) -lstdc++' >> GNUmakefile | 
|---|
| 21 | echo 'ifeq ($(HOSTTYPE), powerpc)' >> GNUmakefile | 
|---|
| 22 | echo '  LIBG = -L$(GLB)' >> GNUmakefile | 
|---|
| 23 | echo 'endif' >> GNUmakefile | 
|---|
| 24 |  | 
|---|
| 25 | cat >> GNUmakefile <<EOF | 
|---|
| 26 |  | 
|---|
| 27 | defaut: libs | 
|---|
| 28 |  | 
|---|
| 29 | all: libs PI | 
|---|
| 30 |  | 
|---|
| 31 |  | 
|---|
| 32 | libs: cxxlibs | 
|---|
| 33 | # Dans cet ordre pour les templates de cxx, a cause des dependances | 
|---|
| 34 | # pour instantiation automatique/manuels | 
|---|
| 35 |  | 
|---|
| 36 | cxxlibs: Blitz SysTools NTools Samba FitsIOServer | 
|---|
| 37 |  | 
|---|
| 38 | EOF | 
|---|
| 39 |  | 
|---|
| 40 |  | 
|---|
| 41 | #  Attention, ne pas changer l'ordre de libnames dependances cxx | 
|---|
| 42 | set libnames = (Blitz SysTools NTools Samba FitsIOServer) | 
|---|
| 43 | set i = 1 | 
|---|
| 44 | set j = $#libnames ; @ j-- | 
|---|
| 45 | while ($i <= $#libnames) | 
|---|
| 46 | set f = $libnames[$i] | 
|---|
| 47 | set k = $i ; @ k++ | 
|---|
| 48 | if ( -d ../$f ) then | 
|---|
| 49 | set cmd = "./mkmflib $f $libnames[$k-$j]" | 
|---|
| 50 | echo "mkmf: Creation makefile lib $f" | 
|---|
| 51 | echo "   execution $cmd" | 
|---|
| 52 | $cmd | 
|---|
| 53 | endif | 
|---|
| 54 | echo '.PHONY: ' $f >> GNUmakefile | 
|---|
| 55 | echo $f':' >> GNUmakefile | 
|---|
| 56 | echo '        if [ -d '$f' ] ; then cd ' $f '; $(MAKE) ; fi' >> GNUmakefile | 
|---|
| 57 | echo ' ' >> GNUmakefile | 
|---|
| 58 | @ i++ | 
|---|
| 59 | end | 
|---|
| 60 |  | 
|---|
| 61 |  | 
|---|
| 62 | if ( -d ../PI ) then | 
|---|
| 63 | set cmd = './mkmfPI PI SysTools' | 
|---|
| 64 | echo "mkmf: Creation makefile lib PI" | 
|---|
| 65 | echo "   execution $cmd" | 
|---|
| 66 | $cmd | 
|---|
| 67 | endif | 
|---|
| 68 | if ( -d ../PIext ) then | 
|---|
| 69 | set cmd = './mkmfPI PIext SysTools NTools PI' | 
|---|
| 70 | echo "mkmf: Creation makefile lib PIext" | 
|---|
| 71 | echo "   execution $cmd" | 
|---|
| 72 | $cmd | 
|---|
| 73 | endif | 
|---|
| 74 | echo '.PHONY: PI' >> GNUmakefile | 
|---|
| 75 | echo 'PI:' >> GNUmakefile | 
|---|
| 76 | echo '  if [ -d PI ] ; then cd PI ; $(MAKE) ; fi' >> GNUmakefile | 
|---|
| 77 | echo '  if [ -d PIext ] ; then cd PIext ; $(MAKE) ; fi' >> GNUmakefile | 
|---|
| 78 |  | 
|---|
| 79 | cat Makefile.slb >> GNUmakefile | 
|---|
| 80 |  | 
|---|
| 81 | cat >> GNUmakefile << __END__ | 
|---|
| 82 |  | 
|---|
| 83 | clean: | 
|---|
| 84 | if [ -d \$(LIB) ] ; then cd \$(LIB)/. ; rm -f *.a  ; fi | 
|---|
| 85 | if [ -d \$(SLB) ] ; then cd \$(SLB)/. ; rm -f *.so ; fi | 
|---|
| 86 | if [ -d \$(OBJ) ] ; then cd \$(OBJ)/. ; rm -f *.o  ; fi | 
|---|
| 87 | if [ -d \$(OBJ)/cxxrep ] ; then cd \$(OBJ)/cxxrep/. ; rm -f *.o  ; fi | 
|---|
| 88 | if [ -d PI ]     ; then cd PI/.     ; \$(MAKE) clean ; fi | 
|---|
| 89 |  | 
|---|
| 90 | __END__ | 
|---|
| 91 |  | 
|---|
| 92 | mv GNUmakefile ../GNUmakefile | 
|---|
| 93 |  | 
|---|
| 94 | echo '*** mkmf done ***' | 
|---|
| 95 |  | 
|---|