From a2d3374c9cf56a3f25765fd6649759b99627c05d Mon Sep 17 00:00:00 2001 From: Yves Rizoud Date: Fri, 17 Oct 2008 00:02:33 +0000 Subject: [PATCH] The SVN revision used to compile is now reported in the Statistics window. Needs testing on linux, including the cross-compilation. Pkm, see if the naming scheme suits you. HOWTO: "make version" and "make ziprelease" both force an update of version.c, by querying the directory's svn status. Developers can use "make version" for their own usage. Do not upload your version.c in svn, it's a generated file. PACKAGING: version.c must be included in source packages, so that non-developpers who have no svn can build with the constant file that shipped with the sources. Commit any pending changes first, then make ziprelease, and run grafx2 to check that the Statistics window shows something like "123", not "123M" (which means "rev123 + local modifications") This will have created the src and win32 packages. git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@274 416bcca6-2ee7-4201-b75f-2eb2f807beb1 --- Makefile | 27 +++++++++++++++++++++++---- aide.c | 36 ++++++++++++++++++++---------------- 2 files changed, 43 insertions(+), 20 deletions(-) diff --git a/Makefile b/Makefile index 7a1239f8..ca1ca329 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,6 @@ # Grafx2 - The Ultimate 256-color bitmap paint program # +# Copyright 2008 Yves Rizoud # Copyright 2007 Adrien Destugues # Copyright 1996-2001 Sunset Design (Guillaume Dorme & Karl Maritaud) # @@ -45,9 +46,11 @@ else endif endif -.PHONY : all debug release clean depend zip +.PHONY : all debug release clean depend zip version force -OBJ = main.o init.o graph.o sdlscreen.o divers.o special.o boutons.o palette.o aide.o operatio.o pages.o loadsave.o readline.o moteur.o files.o op_c.o linux.o op_asm.o readini.o saveini.o shade.o clavier.o io.o +OBJ = main.o init.o graph.o sdlscreen.o divers.o special.o boutons.o palette.o \ + aide.o operatio.o pages.o loadsave.o readline.o moteur.o files.o op_c.o \ + linux.o op_asm.o readini.o saveini.o shade.o clavier.o io.o version.o CFGOBJ = gfxcfg.o SFont.o clavier.o io.o OBJDIR = obj/ @@ -61,16 +64,30 @@ release : $(BIN) $(CFGBIN) strip $(CFGBIN) # A release zip archive -ziprelease: +ziprelease: version $(BIN) $(BINCFG) release tar cvzf src-svn`svnversion`.tgz *.c *.h Makefile Makefile.dep - zip grafx2-beta-svn`svnversion`-win32.zip $(BIN) $(CFGBIN) gfx2.dat gfx2.ico doc/gpl-2.0.txt SDL.dll 8pxfont.png SDL_image.dll + zip grafx2-svn`svnversion`-win32.zip $(BIN) $(CFGBIN) gfx2.dat gfx2.ico doc/gpl-2.0.txt SDL.dll 8pxfont.png SDL_image.dll src-svn`svnversion`.tgz + $(DELCOMMAND) src-svn`svnversion`.tgz + tar cvzf grafx2-svn`svnversion`-src.tgz *.c *.h Makefile Makefile.dep gfx2.dat gfx2.ico doc/gpl-2.0.txt 8pxfont.png $(BIN) : $(OBJ) $(CC) $(OBJ) -o $(BIN) $(LOPT) $(CFGBIN) : $(CFGOBJ) $(CC) $(CFGOBJ) -o $(CFGBIN) $(LOPT) -lSDL_image + +# SVN revision number +version.c : + echo "char SVNRevision[]=\"`svnversion`\";" > version.c + +version.o : version.c + $(CC) $(COPT) -c $*.c -o $*.o +version : delversion version.c version.o + +delversion : + $(DELCOMMAND) version.c + %.o : $(CC) $(COPT) -c $*.c -o $*.o @@ -82,4 +99,6 @@ clean : $(DELCOMMAND) $(BIN) $(DELCOMMAND) $(CFGBIN) +test : + include Makefile.dep diff --git a/aide.c b/aide.c index e4db6d43..56001ebb 100644 --- a/aide.c +++ b/aide.c @@ -46,6 +46,8 @@ #endif #endif +extern char SVNRevision[]; + // -- Menu d'aide ----------------------------------------------------------- void Afficher_aide(void) @@ -332,12 +334,14 @@ void Bouton_Stats(void) Fenetre_Definir_bouton_normal(120,153,70,14,"OK",0,1,SDLK_ESCAPE); // 1 // Affichage du numéro de version - Print_dans_fenetre(10,19,"Version:",STATS_COULEUR_TITRES,CM_Noir); + Print_dans_fenetre(10,19,"Program version:",STATS_COULEUR_TITRES,CM_Noir); sprintf(Buffer,"GrafX 2.00 %s%s",ALPHA_BETA,POURCENTAGE_VERSION); - Print_dans_fenetre(82,19,Buffer,STATS_COULEUR_DONNEES,CM_Noir); + Print_dans_fenetre(146,19,Buffer,STATS_COULEUR_DONNEES,CM_Noir); + Print_dans_fenetre(10,27,"SVN revision #:",STATS_COULEUR_TITRES,CM_Noir); + Print_dans_fenetre(146,27,SVNRevision,STATS_COULEUR_DONNEES,CM_Noir); // Affichage de la mémoire restante - Print_dans_fenetre(10,35,"Free memory: ",STATS_COULEUR_TITRES,CM_Noir); + Print_dans_fenetre(10,43,"Free memory: ",STATS_COULEUR_TITRES,CM_Noir); freeRam = Memoire_libre(); @@ -349,11 +353,11 @@ void Bouton_Stats(void) sprintf(Buffer,"%d Kilobytes",(unsigned int)(freeRam/1024)); else sprintf(Buffer,"%d bytes",(unsigned int)freeRam); - Print_dans_fenetre(114,35,Buffer,STATS_COULEUR_DONNEES,CM_Noir); + Print_dans_fenetre(114,43,Buffer,STATS_COULEUR_DONNEES,CM_Noir); // Affichage de l'espace disque libre sprintf(Buffer,"Free space on %c:",Principal_Repertoire_courant[0]); - Print_dans_fenetre(10,51,Buffer,STATS_COULEUR_TITRES,CM_Noir); + Print_dans_fenetre(10,59,Buffer,STATS_COULEUR_TITRES,CM_Noir); #ifdef __linux__ statfs(Principal_Repertoire_courant,&Informations_Disque); @@ -374,26 +378,26 @@ void Bouton_Stats(void) sprintf(Buffer,"%d Kilobytes",(unsigned int)(Taille/1024)); else sprintf(Buffer,"%d bytes",(unsigned int)Taille); - Print_dans_fenetre(146,51,Buffer,STATS_COULEUR_DONNEES,CM_Noir); + Print_dans_fenetre(146,59,Buffer,STATS_COULEUR_DONNEES,CM_Noir); // Affichage des informations sur l'image - Print_dans_fenetre(10,67,"Picture info.:",STATS_COULEUR_TITRES,CM_Noir); + Print_dans_fenetre(10,75,"Picture info.:",STATS_COULEUR_TITRES,CM_Noir); // Affichage des dimensions de l'image - Print_dans_fenetre(18,75,"Dimensions :",STATS_COULEUR_TITRES,CM_Noir); + Print_dans_fenetre(18,83,"Dimensions :",STATS_COULEUR_TITRES,CM_Noir); sprintf(Buffer,"%dx%d",Principal_Largeur_image,Principal_Hauteur_image); - Print_dans_fenetre(122,75,Buffer,STATS_COULEUR_DONNEES,CM_Noir); - - // Affichage du nombre de couleur utilisé - Print_dans_fenetre(18,83,"Colors used:",STATS_COULEUR_TITRES,CM_Noir); - bzero(Utilisation_couleur,256*sizeof(Utilisation_couleur[0])); - sprintf(Buffer,"%d",Palette_Compter_nb_couleurs_utilisees(Utilisation_couleur)); Print_dans_fenetre(122,83,Buffer,STATS_COULEUR_DONNEES,CM_Noir); + // Affichage du nombre de couleur utilisé + Print_dans_fenetre(18,91,"Colors used:",STATS_COULEUR_TITRES,CM_Noir); + bzero(Utilisation_couleur,256*sizeof(Utilisation_couleur[0])); + sprintf(Buffer,"%d",Palette_Compter_nb_couleurs_utilisees(Utilisation_couleur)); + Print_dans_fenetre(122,91,Buffer,STATS_COULEUR_DONNEES,CM_Noir); + // Affichage des dimensions de l'écran - Print_dans_fenetre(10,99,"Resolution:",STATS_COULEUR_TITRES,CM_Noir); + Print_dans_fenetre(10,107,"Resolution:",STATS_COULEUR_TITRES,CM_Noir); sprintf(Buffer,"%dx%d",Largeur_ecran,Hauteur_ecran); - Print_dans_fenetre(106,99,Buffer,STATS_COULEUR_DONNEES,CM_Noir); + Print_dans_fenetre(106,107,Buffer,STATS_COULEUR_DONNEES,CM_Noir); UpdateRect(Fenetre_Pos_X,Fenetre_Pos_Y,Menu_Facteur_X*310,Menu_Facteur_Y*174);