Makefile pour developpement multi-OS, multi-variants

crabs_makefile-5.2 ©2003-2008 - Christophe Cazajus (crabs-mettre_le_signe_at-crabs-world.com)

~~ / Makefile
Makefile include.LINUX include.SOLARIS include.CGI include.CGI_BIN include.XPI xpi_rdf.xsl Pdepend.c Pinfo.c PrelativeHome.c PrelativePath.c Pprojetgpl.c Prelative.c PinfoGPL.sh PgenInfo_c.sh PenvProjet.sh Pinfo2html.sh Pinstall.sh PgenInfo_include.sh projet.env crabs_mk.sh crabs_mk.csh fr/crabs_makefile.po Makefile.SOLARIS
    1 #
    2 # =============================================================================
    3 #  crabs_makefile-5.2 : Makefile pour developpement multi-OS, multi-variants
    4 #  Copyright (C) 2003-2008 : Christophe Cazajus (crabs-mettre_le_signe_at-crabs-world.com)
    5 #
    6 #  Ce source fait partie d'un projet logiciel libre. Vous pouvez le distribuer
    7 #  et/ou le modifier en respectant les termes de la GNU General Public License
    8 #  version 2 ou (suite a votre propre choix) une version ulterieure.
    9 #
   10 #  Ce programme est distribue dans l'espoir qu'il puisse etre utile, mais
   11 #  sans aucune garantie, meme si il est associe a un produit qui vous en
   12 #  propose une. Conformez-vous a la GNU General Public License pour avoir
   13 #  plus de precisions.
   14 #
   15 #  L'auteur ne peut etre tenu responsable de l'utilisation faite des
   16 #  composantes associees a ce projet (en partie ou dans leur totalite).
   17 #
   18 #  Une copie du fichier de la GNU GPL est fournie dans le repertoire DOC
   19 #  de ce projet sous le nom gnu_gpl.txt
   20 #
   21 # =============================================================================
   22 #
   23 .SILENT:
   24 SHELL= /bin/sh
   25 #Modifier le repertoire d'installation si nécessaire
   26 INSTALL=/usr/local/crabs
   27 
   28 #NOTE: les po sont rajoutés à la main
   29 ETC=include.LINUX include.SOLARIS include.CGI include.CGI_BIN include.XPI \
   30     xpi_rdf.xsl
   31 LCL=projet.env crabs_mk.sh crabs_mk.csh fr/crabs_makefile.po Makefile.SOLARIS
   32 SRC= Pdepend.c  Pinfo.c  PrelativeHome.c  PrelativePath.c Pprojetgpl.c \
   33     Prelative.c
   34 SBIN= PinfoGPL.sh PgenInfo_c.sh PenvProjet.sh Pinfo2html.sh Pinstall.sh \
   35     PgenInfo_include.sh
   36 
   37 I18N_SRC= PinfoGPL.sh Pinfo2html.sh Pdepend.c Pprojetgpl.c Pinstall.sh \
   38     Prelative.c
   39 I18N_LANG=fr
   40 I18N_PK= crabs_makefile
   41 # DO NOT MODIDY AFTER THIS
   42 I18N_POT=$(I18N_PK).pot
   43 I18N_PO=$(I18N_LANG:%=%/$(I18N_PK).po)
   44 I18N_MO=$(I18N_LANG:%=%/$(I18N_PK).mo)
   45 
   46 BINDIR=../BIN/$(OS)
   47 _BIN=$(SRC:%.c=$(BINDIR)/%)
   48 _SBIN=$(SBIN:%=$(BINDIR)/%)
   49 _ETC=$(ETC:%=../ETC/%)
   50 
   51 all : ../ETC $(BINDIR) $(_BIN) $(_SBIN) $(_ETC) $(I18N_MO)
   52 install : all FORCE
   53     test -d $(INSTALL) || mkdir -p $(INSTALL) ;\
   54     for d in bin etc locale ; do \
   55         test -d $(INSTALL)/$$d || mkdir $(INSTALL)/$$d ;\
   56     done ;\
   57     for f in $(_BIN) $(_SBIN) ; do \
   58         cp $$f $(INSTALL)/bin ;\
   59         echo "INSTALL: `basename $$f`" ;\
   60     done ;\
   61     for f in $(_ETC) ; do \
   62         cp $$f $(INSTALL)/etc ;\
   63         echo "INSTALL: `basename $$f`" ;\
   64     done ;\
   65     for f in $(I18N_MO) ; do \
   66         L=`dirname $$f` MO=`basename $$f` ;\
   67         echo "Install $$MO ($$L)" ;\
   68         mkdir -p $(INSTALL)/locale/$$L/LC_MESSAGES ;\
   69         cp $$f $(INSTALL)/locale/$$L/LC_MESSAGES/$$MO ;\
   70     done ;\
   71     for ext in sh csh ; do \
   72         echo "CREATE: /etc/profile.d/crabs_mk.$$ext" ;\
   73         cat crabs_mk.$$ext \
   74             | sed 's?%%INSTALL%%?$(INSTALL)?' \
   75             | sed 's?%%OS%%?$(OS)?' \
   76             >/etc/profile.d/crabs_mk.$$ext ;\
   77         chmod a+x /etc/profile.d/crabs_mk.$$ext ;\
   78     done ;\
   79     etc="$(INSTALL)/etc" ;\
   80     if [ -f "$$PROJET_MK/projet.env" ] ; then \
   81         [ -f "$$etc/projet.env" ] || cp "$$PROJET_MK/projet.env" "$$etc" ;\
   82     else \
   83         if [ ! -f $$etc/projet.env ] ; then cp "projet.env" "$$etc" ; fi;\
   84     fi ;\
   85     if [ $(OS) != LINUX ] ; then \
   86         [ -f $$etc/include.$(OS) ] && rm -f $$etc/include.$(OS) ;\
   87         ( cd $$etc ; ln -s include.LINUX include.$(OS) ) ;\
   88     fi
   89 
   90 ../ETC : FORCE
   91     [ -d $@ ] || mkdir -p $@
   92 
   93 $(BINDIR) : FORCE
   94     [ -d $@ ] || mkdir -p $@
   95 
   96 $(BINDIR)/% : %.c
   97     cc -O2 -o $@ $*.c
   98     echo BIN: $@
   99 
  100 $(BINDIR)/% : %
  101     cp  $* $@
  102     chmod +x $@
  103     echo SBIN: $@
  104 
  105 ../ETC/% : %
  106     echo Install ETC $<
  107     cp $< $@
  108 
  109 $(I18N_POT) : $(I18N_SRC)
  110     echo "POT file : $@"
  111     if [ -f $@ ] ; then \
  112         xgettext -o $@ -j $(I18N_SRC) ; \
  113     else \
  114         xgettext -o $@ $(I18N_SRC) ; \
  115     fi
  116 
  117 %.mo : %.po
  118     L=`dirname $@` ;\
  119     echo "MO file : $@ ($$L)" ;
  120     msgfmt -c -v -o $@ $<
  121     touch $@
  122 
  123 $(I18N_PO) : $(I18N_POT)
  124     L=`dirname $@` ;\
  125     [ -d $$L ] || mkdir -p $$L ; \
  126     echo "PO file : $@ ($$L) $<" ;\
  127     if [ ! -f $@ ] ; then \
  128         msginit --no-translator -l $$L -i $(I18N_POT) -o $@ ;\
  129     else \
  130         msgmerge -v -s -U $@ $(I18N_POT) ;\
  131     fi
  132     touch $@
  133 
  134 FORCE:
Makefile include.LINUX include.SOLARIS include.CGI include.CGI_BIN include.XPI xpi_rdf.xsl Pdepend.c Pinfo.c PrelativeHome.c PrelativePath.c Pprojetgpl.c Prelative.c PinfoGPL.sh PgenInfo_c.sh PenvProjet.sh Pinfo2html.sh Pinstall.sh PgenInfo_include.sh projet.env crabs_mk.sh crabs_mk.csh fr/crabs_makefile.po Makefile.SOLARIS
~~ / Makefile

Haut de page

Contacter crabs

Date de génération : 22/09/2011 21:47