Various makefile related changes.
authorFlorian Schulze <crow@icculus.org>
Mon, 25 Feb 2002 18:43:52 +0000 (18:43 +0000)
committerFlorian Schulze <crow@icculus.org>
Mon, 25 Feb 2002 18:43:52 +0000 (18:43 +0000)
.cvsignore [new file with mode: 0644]
Makefile
data/Makefile [new file with mode: 0644]
main.c
modify/.cvsignore [new file with mode: 0644]
modify/pack.c
modify/unpack.c
sdl/.cvsignore [new file with mode: 0644]

diff --git a/.cvsignore b/.cvsignore
new file mode 100644 (file)
index 0000000..26cb3fa
--- /dev/null
@@ -0,0 +1,2 @@
+*.o *.exe
+jnb.tmpmusic.mod stdout.txt stderr.txt
index cf6a41e..ab73464 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,14 +1,30 @@
 OBJS = sdl/gfx.o sdl/interrpt.o sdl/sound.o sdl/input.o fireworks.o main.o menu.o
 TARGET = jumpnbump
 
-
 CC = gcc
 CFLAGS = -Wall -O2 -ffast-math -funroll-loops -Dstricmp=strcasecmp -Dstrnicmp=strncasecmp -DUSE_SDL -DNDEBUG -I. $(shell sdl-config --cflags)
 LIBS = -lm $(shell sdl-config --libs) -lSDL_mixer
 
+.PHONY: data
+
+all: $(TARGET) pack unpack data
+
 $(TARGET): $(OBJS)
        $(CC) $(LFLAGS) -o $(TARGET) $(OBJS) $(LIBS)
 
+pack: modify/pack.o
+       $(CC) $(LFLAGS) -o pack modify/pack.o $(LIBS)
+
+unpack: modify/unpack.o
+       $(CC) $(LFLAGS) -o unpack modify/unpack.o $(LIBS)
+
+data: pack
+       $(MAKE) -C data
+
 clean:
-       rm -f $(TARGET) *.o sdl/*.o *~ log
+       rm -f $(TARGET) pack unpack *.o sdl/*.o *~ log modify/*.o
+       $(MAKE) -C data clean
 
+install:
+       install -o root -g games -m 755 $(TARGET) $(DESTDIR)/usr/games/$(TARGET)
+       install -o root -g games -m 644 data/jumpbump.dat $(DESTDIR)/usr/share/jumpnbump/jumpbump.dat
diff --git a/data/Makefile b/data/Makefile
new file mode 100644 (file)
index 0000000..d0c8b2d
--- /dev/null
@@ -0,0 +1,7 @@
+all: jumpbump.dat
+
+jumpbump.dat: bump.mod calib.dat death.smp fly.smp font.gob jump.mod jump.smp levelmap.txt level.pcx mask.pcx menu.pcx menumask.pcx numbers.gob objects.gob rabbit.gob scores.mod splash.smp spring.smp
+       ../pack -o jumpbump.dat bump.mod calib.dat death.smp fly.smp font.gob jump.mod jump.smp levelmap.txt level.pcx mask.pcx menu.pcx menumask.pcx numbers.gob objects.gob rabbit.gob scores.mod splash.smp spring.smp
+
+clean:
+       rm -f jumpbump.dat
diff --git a/main.c b/main.c
index f5ae932..3dc783f 100644 (file)
--- a/main.c
+++ b/main.c
@@ -1834,7 +1834,11 @@ int init_program(int argc, char *argv[], char *pal)
 
        memset(&main_info, 0, sizeof(main_info));
 
+#ifdef _WIN32
        strcpy(datfile_name, "data/jumpbump.dat");
+#else
+       strcpy(datfile_name, "/usr/share/jumpnbump/jumpbump.dat");
+#endif
 
        force2 = force3 = 0;
 
diff --git a/modify/.cvsignore b/modify/.cvsignore
new file mode 100644 (file)
index 0000000..5761abc
--- /dev/null
@@ -0,0 +1 @@
+*.o
index 76f1cc6..ff0b130 100644 (file)
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <string.h>
-#ifndef _MSC_VER
+#ifndef _WIN32
 #include <getopt.h>
+#endif
+#ifndef _MSC_VER
 #include <unistd.h>
 #else
 #include <io.h>
-typedef unsigned int u_int32_t;
 #endif
 
 typedef struct {
        char filename[12];
-       u_int32_t offset;
-       u_int32_t size;
+       unsigned int offset;
+       unsigned int size;
 } DirEntry;
 
 int main(int argc, char **argv)
@@ -56,7 +57,7 @@ int main(int argc, char **argv)
        char *outfile = NULL;
        int offset = 0;
 
-#ifndef _MSC_VER
+#ifndef _WIN32
        while ((c = getopt(argc, argv, "o:")) != EOF) {
                switch (c) {
                case 'o':
index cc1c969..f8051ca 100644 (file)
 #include <unistd.h>
 #else
 #include <io.h>
-typedef unsigned int u_int32_t;
 #endif
 
 typedef struct {
     char filename[12];
-    u_int32_t offset;
-    u_int32_t size;
+    unsigned int offset;
+    unsigned int size;
 } DirEntry;
 
 int main(int argc, char **argv)
diff --git a/sdl/.cvsignore b/sdl/.cvsignore
new file mode 100644 (file)
index 0000000..5761abc
--- /dev/null
@@ -0,0 +1 @@
+*.o