From b3c377e647b5eb14c2ed0ff27db4ac14a3fd4e2d Mon Sep 17 00:00:00 2001
From: Pixel <Pixel>
Date: Sun, 23 Jun 2002 15:37:45 +0000
Subject: Attribute ((packed)) fix...

---
 Makefile           | 4 ++--
 VP/Makefile        | 2 +-
 Xenogears/Makefile | 2 +-
 cdutils.cpp        | 2 +-
 cdutils.h          | 5 +++--
 generic.h          | 4 ++++
 lzss.h             | 2 +-
 psxdev/Makefile    | 8 +++++---
 psxdev/xadecode.h  | 4 +++-
 str-util.cpp       | 2 +-
 10 files changed, 22 insertions(+), 13 deletions(-)

diff --git a/Makefile b/Makefile
index 92c0745..cd471e4 100755
--- a/Makefile
+++ b/Makefile
@@ -3,7 +3,7 @@
 CPPFLAGS=-Wall -g -O3 -mcpu=i686 -pedantic -pedantic-errors -Werror
 CXX=g++
 
-SUBDIRS = psxdev Xenogears VP
+SUBDIRS = psxdev Xenogears VP MegamanX5
 TARGET = lzss dlzss cd-tool str-tool
 
 all: subdirs ${TARGET}
@@ -30,6 +30,6 @@ str-tool: str-util.o generic.h generic.o fileutils.o fileutils.h cdutils.o cduti
 	${CXX} ${LDFLAGS} str-util.o generic.o fileutils.o cdutils.o yazedc.o psxdev/bs.o psxdev/idctfst.o psxdev/jfdctint.o psxdev/vlc.o -o str-tool -lSDL
 
 clean:
-	rm -f *.o ${TARGET} compil.c
 	for d in ${SUBDIRS} ; do make -C $$d clean ; done
+	rm -f *.o ${TARGET} compil.c
 
diff --git a/VP/Makefile b/VP/Makefile
index 890516b..608cf7e 100755
--- a/VP/Makefile
+++ b/VP/Makefile
@@ -1,6 +1,6 @@
 #!/usr/bin/make -f
 
-CPPFLAGS=-Wall -g -I. -O3 -mcpu=i686 -pedantic -pedantic-errors -Werror -I..
+CPPFLAGS=-Wall -g -O3 -mcpu=i686 -pedantic -pedantic-errors -Werror -I..
 CXX=g++
 
 TARGET = main_dump VP-CD1.sqr
diff --git a/Xenogears/Makefile b/Xenogears/Makefile
index 3df895f..9b8d9db 100755
--- a/Xenogears/Makefile
+++ b/Xenogears/Makefile
@@ -1,6 +1,6 @@
 #!/usr/bin/make -f
 
-CPPFLAGS=-Wall -g -I. -O3 -mcpu=i686 -I.. -pedantic -pedantic-errors -Werror
+CPPFLAGS=-Wall -g -O3 -mcpu=i686 -pedantic -pedantic-errors -Werror -I..
 CXX=g++
 
 TARGET = reinsert main_dump Decrypt script-comp script-dec XenoCD1.sqr XenoCD2.sqr
diff --git a/cdutils.cpp b/cdutils.cpp
index 230099c..0dd0e8a 100644
--- a/cdutils.cpp
+++ b/cdutils.cpp
@@ -22,9 +22,9 @@
 #include <malloc.h>
 #include <stdlib.h>
 #include <unistd.h>
+#include "generic.h"
 #include "cdutils.h"
 #include "fileutils.h"
-#include "generic.h"
 
 FILE * ppf_file = 0;
 int pt1 = -1, pt2 = -1, snum = 0, ptl = 0, root = 0;
diff --git a/cdutils.h b/cdutils.h
index af899b9..3dcf7ac 100644
--- a/cdutils.h
+++ b/cdutils.h
@@ -20,7 +20,8 @@
 #ifndef __CDUTILS_H__
 #define __CDUTILS_H__
 
-#include <yazedc.h>
+#include "yazedc.h"
+#include "generic.h"
 
 #define GUESS 5
 
@@ -45,7 +46,7 @@ struct DirEntry {
     unsigned short BEVolSeq;
     unsigned char N;
     char id;
-} __attribute__((packed));
+} PACKED;
 
 extern struct DirEntry rootDir;
 
diff --git a/generic.h b/generic.h
index b8ab95b..04c91fa 100644
--- a/generic.h
+++ b/generic.h
@@ -69,6 +69,10 @@ typedef Uint16 Word;
 typedef Uint32 DWord;
 #endif
 
+#if defined __linux__ || defined __CYGWIN32__
+#define PACKED __attribute__((packed))
+#endif
+
 extern char verbosity;
 void printm(int level, char * fmt, ...);
 char ** split(char * s, char t);
diff --git a/lzss.h b/lzss.h
index a4fc71f..127a494 100644
--- a/lzss.h
+++ b/lzss.h
@@ -21,7 +21,7 @@
 #define __LZSS_H__
 
 #include <stdio.h>
-#include <generic.h>
+#include "generic.h"
 
 #define LZSS_VERSION "3.0.0-pre1"
 #define LZSS_NAME "lzss"
diff --git a/psxdev/Makefile b/psxdev/Makefile
index 5cc33ca..fb1cc78 100644
--- a/psxdev/Makefile
+++ b/psxdev/Makefile
@@ -1,15 +1,17 @@
+#!/usr/bin/make -f
+
 TARGETS=xadecode.o bs.o idctfst.o jfdctint.o vlc.o
 
 CC=gcc
-CPPFLAGS=-Wall -g -O3 -mcpu=i686 -pedantic
+CPPFLAGS=-Wall -g -O3 -mcpu=i686 -pedantic -I..
 # -Werror
 # -pedantic-errors
 
-all: $(TARGETS)
+all: ${TARGETS}
 
 bstoppm: xadecode.o bs.o idctfst.o jfdtint.o vlc.o bstoppm.o
 	${CC} ${LDFLAGS} xadecode.o bs.o idcfst.o jfdtint.o vlc.o bstoppm.o -o bstoppm
 
 clean:
-	rm -f *.o
+	rm -f *.o ${TARGETS}
 
diff --git a/psxdev/xadecode.h b/psxdev/xadecode.h
index 264012c..025d36a 100644
--- a/psxdev/xadecode.h
+++ b/psxdev/xadecode.h
@@ -3,6 +3,8 @@
 	slightly modified by dbalster
 */
 
+#include "generic.h"
+
 #ifndef XADECODE_H
 #define XADECODE_H
 
@@ -50,7 +52,7 @@ typedef char SoundGroup[128];
 typedef struct SoundSector {
 	char            sectorFiller[8];
 	SoundGroup      SoundGroups[kNumOfSGs];
-} __attribute__((packed)) SoundSector;
+} PACKED SoundSector;
 
 typedef unsigned long DWORD;
 typedef unsigned short WORD;
diff --git a/str-util.cpp b/str-util.cpp
index 33c7a6a..7c76917 100644
--- a/str-util.cpp
+++ b/str-util.cpp
@@ -40,7 +40,7 @@ struct STR_Header {
     Uint32 StMOVIE_HEADM;
     Uint32 StMOVIE_HEADV;
     Uint16 Channels;
-} __attribute__((packed));
+} PACKED;
 
 Byte * video = 0, * audio = 0;
 
-- 
cgit v1.2.3