Updated makefile for MingW support, fixed some strict compilation warnings.

git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@133 416bcca6-2ee7-4201-b75f-2eb2f807beb1
This commit is contained in:
Yves Rizoud 2008-09-11 23:40:06 +00:00
parent cd2af629d4
commit 3894c39631
15 changed files with 103 additions and 115 deletions

104
Makefile
View File

@ -1,81 +1,43 @@
# Windows specific
ifdef COMSPEC
DELCOMMAND = del
BIN = grafx2.exe
COPT = -Wall -O -g -ggdb -Dmain=SDL_main $(SCREEN)
LOPT = -mwindows -lmingw32 -lSDLmain -lSDL
else
# Linux specific
DELCOMMAND = rm -rf
BIN = grafx2
COPT = -Wall -c -g $(SCREEN)
LOPT = -lSDL -o $(BIN)
endif
.PHONY : all debug release clean depend
CC = gcc
COPT = -Wall -c -g
LOPT = -lSDL -o grafx2
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
SCREEN = -D WINDOWED
OBJDIR = obj/
debug: grafx2
@echo --- Everything OK.
all : $(BIN)
release: grafx2
strip grafx2
debug : $(BIN)
grafx2 : 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
$(CC) $(LOPT) main.o graph.o divers.o init.o files.o linux.o loadsave.o boutons.o moteur.o sdlscreen.o aide.o palette.o pages.o operatio.o op_c.o readline.o special.o op_asm.o readini.o saveini.o shade.o
release : $(BIN)
strip $(BIN)
aide.o : const.h struct.h global.h divers.h graph.h moteur.h aide.h aide.c
$(CC) $(COPT) aide.c
boutons.o : boutons.h boutons.c shade.c const.h struct.h global.h divers.h graph.h moteur.h readline.h files.h loadsave.h init.h readini.h saveini.h
$(CC) $(COPT) boutons.c
divers.o : global.h const.h divers.h divers.c
$(CC) $(COPT) divers.c
files.o : const.h struct.h global.h graph.h divers.h files.h files.c
$(CC) $(COPT) files.c
graph.o : graph.c pages.c const.h struct.h global.h divers.h erreurs.h
$(CC) $(COPT) graph.c
init.o : const.h struct.h global.h graph.h boutons.h palette.h aide.h operatio.h init.c readini.c saveini.c
$(CC) $(COPT) init.c
linux.o : linux.h linux.c
$(CC) $(COPT) linux.c
loadsave.o : const.h struct.h global.h divers.h graph.h loadsave.c pages.h op_c.h op_asm.h
$(CC) $(COPT) loadsave.c
main.o : const.h struct.h global.h graph.h divers.h init.h boutons.h moteur.h files.h loadsave.h main.c readini.h saveini.h
$(CC) $(COPT) main.c
moteur.o : const.h struct.h global.h graph.h divers.h moteur.c
$(CC) $(COPT) moteur.c
op_c.o : struct.h op_c.c op_c.h op_asm.h
$(CC) $(COPT) op_c.c
op_asm.o : op_asm.h op_asm.c
$(CC) $(COPT) op_asm.c
operatio.o : const.h struct.h global.h divers.h moteur.h graph.h operatio.h operatio.c
$(CC) $(COPT) operatio.c
pages.o : pages.h pages.c
$(CC) $(COPT) pages.c
palette.o : const.h struct.h global.h divers.h graph.h moteur.h readline.h palette.c
$(CC) $(COPT) palette.c
readini.o : readini.h readini.c
$(CC) $(COPT) readini.c
readline.o : const.h struct.h global.h divers.h graph.h readline.c
$(CC) $(COPT) readline.c
savenini.o : saveini.h saveini.c
$(CC) $(COPT) saveini.c
sdlscreen.o : sdlscreen.c sdlscreen.h
$(CC) $(COPT) sdlscreen.c $(SCREEN)
shade.o : shade.c shade.h
$(CC) $(COPT) shade.c
$(BIN) : $(OBJ)
$(CC) $(OBJ) -o $(BIN) $(LOPT)
special.o : const.h struct.h global.h graph.h moteur.h special.c
$(CC) $(COPT) special.c
%.o :
$(CC) $(COPT) -c $*.c -o $*.o
depend :
$(CC) -MM $(OBJ:.o=.c) > Makefile.dep
clean :
rm -rf *.o
rm grafx2
$(DELCOMMAND) *.o
$(DELCOMMAND) $(BIN)
include Makefile.dep

7
aide.c
View File

@ -1,4 +1,5 @@
#include <stdio.h>
#include <string.h>
#include "const.h"
#include "struct.h"
#include "global.h"
@ -10,7 +11,7 @@
#ifdef __linux__
#include <sys/vfs.h>
#elif __WATCOMC__
#else
#include <windows.h>
#endif
@ -210,7 +211,7 @@ void Bouton_Stats(void)
#ifdef __linux__
struct statfs Informations_Disque;
unsigned long long Taille = 0;
#elif __WATCOMC__
#else
unsigned __int64 Taille;
ULARGE_INTEGER tailleU;
#endif
@ -253,7 +254,7 @@ void Bouton_Stats(void)
#ifdef __linux__
statfs(Principal_Repertoire_courant,&Informations_Disque);
Taille=Informations_Disque.f_bfree * Informations_Disque.f_bsize;
#elif __WATCOMC__
#else
GetDiskFreeSpaceEx(Principal_Repertoire_courant,&tailleU,NULL,NULL);
Taille = tailleU.QuadPart;
#endif

View File

@ -1,3 +1,11 @@
#include <fcntl.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <ctype.h>
#include <SDL/SDL.h>
#include "const.h"
#include "struct.h"
#include "global.h"
@ -8,20 +16,13 @@
#include "files.h"
#include "loadsave.h"
#include "init.h"
#include <fcntl.h>
#include <stdio.h>
#include <SDL/SDL.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <ctype.h>
#include "boutons.h"
#include "operatio.h"
#include "pages.h"
#include "erreurs.h"
#include "readini.h"
#include "saveini.h"
#include "shade.h"
#ifdef __WATCOMC__
#include <windows.h>

View File

@ -1,4 +1,6 @@
#include <SDL/SDL.h>
#include <string.h>
#include <stdlib.h>
#include "struct.h"
#include "sdlscreen.h"
#include "global.h"

View File

@ -19,9 +19,13 @@
#include "linux.h"
#include <dirent.h>
#define isHidden(Enreg) ((Enreg)->d_name[0]=='.')
#elif __WATCOMC__
#elif defined(__WATCOMC__)
#include <direct.h>
#define isHidden(Enreg) ((Enreg)->d_attr & _A_HIDDEN)
#elif defined(__MINGW32__)
#include <dirent.h>
/* TODO: trouver une méthode portable pour déterminer si un fichier est caché */
#define isHidden(Enreg) (0)
#endif
#define COULEUR_FICHIER_NORMAL CM_Clair // Couleur du texte pour une ligne de fichier non sélectionné

View File

@ -472,6 +472,8 @@ unsigned long Memoire_libre(void)
mstt.dwLength = sizeof(MEMORYSTATUSEX);
GlobalMemoryStatusEx(&mstt);
return mstt.ullAvailPhys;
#else
return 10*1024*1024;
#endif
}

View File

@ -1,5 +1,14 @@
#define _XOPEN_SOURCE
#include <fcntl.h>
#include <sys/stat.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <limits.h>
#include <SDL/SDL_byteorder.h>
#include "const.h"
#include "struct.h"
#include "global.h"
@ -7,28 +16,19 @@
#include "divers.h"
#include "pages.h"
#include "op_c.h"
#include <fcntl.h>
#include <sys/stat.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <limits.h>
#include "boutons.h"
#include "erreurs.h"
#ifdef __linux__
#include <endian.h>
#include <byteswap.h>
#include "linux.h"
#if __BYTE_ORDER == __BIG_ENDIAN
#define endian_magic(x) bswap_16(x)
#else
#define endian_magic(x) (x)
#endif
#elif __WATCOMC__
#define endian_magic(x) (x)
#if SDL_BYTEORDER == SDL_LIL_ENDIAN
#define endian_magic(x) (x)
#else
#define endian_magic(x) (SDL_Swap16(x))
#endif
#ifdef S_IRGRP
#define PERMISSIONS_ECRITURE (S_IRUSR|S_IWUSR|S_IRGRP)
#else
#define PERMISSIONS_ECRITURE (S_IRUSR|S_IWUSR)
#endif
// Chargement des pixels dans l'écran principal
@ -689,7 +689,7 @@ void Save_PAL(void)
Erreur_fichier=0;
// Ouverture du fichier
Fichier=open(Nom_du_fichier,O_WRONLY|O_CREAT|O_TRUNC,S_IRUSR|S_IWUSR|S_IRGRP);
Fichier=open(Nom_du_fichier,O_WRONLY|O_CREAT|O_TRUNC,PERMISSIONS_ECRITURE);
if (Fichier!=-1)
{
// Enregistrement de Principal_Palette dans le fichier
@ -850,7 +850,7 @@ void Save_IMG(void)
Erreur_fichier=0;
// Ouverture du fichier
Fichier=open(Nom_du_fichier,O_WRONLY|O_CREAT|O_TRUNC,S_IRUSR|S_IWUSR|S_IRGRP);
Fichier=open(Nom_du_fichier,O_WRONLY|O_CREAT|O_TRUNC,PERMISSIONS_ECRITURE);
if (Fichier!=-1)
{
memcpy(IMG_Header.Filler1,Signature,6);
@ -1239,7 +1239,7 @@ void Save_PKM(void)
Erreur_fichier=0;
// Ouverture du fichier
Fichier=open(Nom_du_fichier,O_WRONLY|O_CREAT|O_TRUNC,S_IRUSR|S_IWUSR|S_IRGRP);
Fichier=open(Nom_du_fichier,O_WRONLY|O_CREAT|O_TRUNC,PERMISSIONS_ECRITURE);
if (Fichier!=-1)
{
// Ecriture du header
@ -2021,7 +2021,7 @@ void Save_LBM(void)
Nom_fichier_complet(Nom_du_fichier,0);
// Ouverture du fichier
LBM_Fichier=open(Nom_du_fichier,O_WRONLY|O_CREAT|O_TRUNC,S_IRUSR|S_IWUSR|S_IRGRP);
LBM_Fichier=open(Nom_du_fichier,O_WRONLY|O_CREAT|O_TRUNC,PERMISSIONS_ECRITURE);
if (LBM_Fichier!=-1)
{
write(LBM_Fichier,"FORM",4);
@ -2499,7 +2499,7 @@ void Save_BMP(void)
Nom_fichier_complet(Nom_du_fichier,0);
// Ouverture du fichier
Fichier=open(Nom_du_fichier,O_WRONLY|O_CREAT|O_TRUNC,S_IRUSR|S_IWUSR|S_IRGRP);
Fichier=open(Nom_du_fichier,O_WRONLY|O_CREAT|O_TRUNC,PERMISSIONS_ECRITURE);
if (Fichier!=-1)
{
if (Principal_Largeur_image & 7)
@ -3158,7 +3158,7 @@ void Save_GIF(void)
Nom_fichier_complet(Nom_du_fichier,0);
GIF_Fichier=open(Nom_du_fichier,O_WRONLY|O_CREAT|O_TRUNC,S_IRUSR|S_IWUSR|S_IRGRP);
GIF_Fichier=open(Nom_du_fichier,O_WRONLY|O_CREAT|O_TRUNC,PERMISSIONS_ECRITURE);
if (GIF_Fichier!=-1)
{
// On écrit la signature du fichier
@ -3846,7 +3846,7 @@ void Save_PCX(void)
Erreur_fichier=0;
if ((Fichier=open(Nom_du_fichier,O_WRONLY|O_CREAT|O_TRUNC,S_IRUSR|S_IWUSR|S_IRGRP))!=-1)
if ((Fichier=open(Nom_du_fichier,O_WRONLY|O_CREAT|O_TRUNC,PERMISSIONS_ECRITURE))!=-1)
{
// On prépare la palette pour écrire les 16 premieres valeurs
Palette_64_to_256(Principal_Palette);
@ -4169,7 +4169,7 @@ void Save_CEL(void)
Erreur_fichier=0;
Nom_fichier_complet(Nom_du_fichier,0);
if ((Fichier=open(Nom_du_fichier,O_WRONLY|O_CREAT|O_TRUNC,S_IRUSR|S_IWUSR|S_IRGRP))!=-1)
if ((Fichier=open(Nom_du_fichier,O_WRONLY|O_CREAT|O_TRUNC,PERMISSIONS_ECRITURE))!=-1)
{
// On regarde si des couleurs >16 sont utilisées dans l'image
for (Pos_X=16;((Pos_X<256) && (!Utilisation[Pos_X]));Pos_X++);
@ -4509,7 +4509,7 @@ void Save_KCF(void)
Erreur_fichier=0;
Nom_fichier_complet(Nom_du_fichier,0);
if ((Fichier=open(Nom_du_fichier,O_WRONLY|O_CREAT|O_TRUNC,S_IRUSR|S_IWUSR|S_IRGRP))!=-1)
if ((Fichier=open(Nom_du_fichier,O_WRONLY|O_CREAT|O_TRUNC,PERMISSIONS_ECRITURE))!=-1)
{
// Sauvegarde de la palette
@ -4729,7 +4729,7 @@ void Save_SCx(void)
Erreur_fichier=0;
// Ouverture du fichier
Fichier=open(Nom_du_fichier,O_WRONLY|O_CREAT|O_TRUNC,S_IRUSR|S_IWUSR|S_IRGRP);
Fichier=open(Nom_du_fichier,O_WRONLY|O_CREAT|O_TRUNC,PERMISSIONS_ECRITURE);
if (Fichier!=-1)
{
memcpy(SCx_Header.Filler1,"RIX3",4);
@ -5000,7 +5000,7 @@ void Save_PI1(void)
Erreur_fichier=0;
// Ouverture du fichier
Fichier=open(Nom_du_fichier,O_WRONLY|O_CREAT|O_TRUNC,S_IRUSR|S_IWUSR|S_IRGRP);
Fichier=open(Nom_du_fichier,O_WRONLY|O_CREAT|O_TRUNC,PERMISSIONS_ECRITURE);
if (Fichier!=-1)
{
// allocation d'un buffer mémoire
@ -5343,7 +5343,7 @@ void Save_PC1(void)
Erreur_fichier=0;
// Ouverture du fichier
Fichier=open(Nom_du_fichier,O_WRONLY|O_CREAT|O_TRUNC,S_IRUSR|S_IWUSR|S_IRGRP);
Fichier=open(Nom_du_fichier,O_WRONLY|O_CREAT|O_TRUNC,PERMISSIONS_ECRITURE);
if (Fichier!=-1)
{
// Allocation des buffers mémoire

View File

@ -1,4 +1,6 @@
#include <math.h>
#include <string.h>
#include <stdlib.h>
#include "const.h"
#include "struct.h"
#include "global.h"

View File

@ -1,4 +1,6 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "const.h"
#include "struct.h"
#include "global.h"

View File

@ -1,4 +1,6 @@
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "const.h"
#include "global.h"

View File

@ -4,6 +4,9 @@
* *
************************************************************************/
#include <stdlib.h>
#include <string.h>
#include "const.h"
#include "struct.h"
#include "global.h"

View File

@ -1,4 +1,6 @@
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "const.h"
#include "global.h"
#include "readini.h"

View File

@ -1,3 +1,4 @@
#include <string.h>
#include <SDL/SDL.h>
#include "global.h"
#include "sdlscreen.h"

View File

@ -1,3 +1,5 @@
#include <string.h>
#include <stdlib.h>
#include "global.h"
#include "graph.h"
#include "moteur.h"

View File

@ -1,9 +1,11 @@
#include <stdlib.h>
#include <string.h>
#include "const.h"
#include "struct.h"
#include "global.h"
#include "graph.h"
#include "moteur.h"
#include <stdlib.h>
//---------------------- Modifier le pinceau spcial -------------------------