summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--INSTALL.md3
-rw-r--r--Makefile8
-rw-r--r--tools/.gitignore8
-rw-r--r--tools/Makefile8
-rw-r--r--tools/lzcomp.c6
5 files changed, 25 insertions, 8 deletions
diff --git a/INSTALL.md b/INSTALL.md
index e126c20ea..cfdd04da2 100644
--- a/INSTALL.md
+++ b/INSTALL.md
@@ -17,7 +17,6 @@ cd ..
git clone https://github.com/pret/pokecrystal
cd pokecrystal
-make tools
```
To build **pokecrystal.gbc**:
@@ -42,7 +41,6 @@ cd ..
git clone https://github.com/pret/pokecrystal
cd pokecrystal
-make tools
```
To build **pokecrystal.gbc**:
@@ -67,7 +65,6 @@ In the **Cygwin terminal**:
git clone https://github.com/pret/pokecrystal
cd pokecrystal
-make tools CC=gcc
```
To build **pokecrystal.gbc**:
diff --git a/Makefile b/Makefile
index 3382d9a41..5f77c9e0f 100644
--- a/Makefile
+++ b/Makefile
@@ -36,8 +36,16 @@ all: crystal
crystal: pokecrystal.gbc
crystal11: pokecrystal11.gbc
+# Ensure that the tools are built when making the ROM
+ifneq ($(MAKECMDGOALS),clean)
+ifneq ($(MAKECMDGOALS),tools)
+Makefile: tools
+endif
+endif
+
clean:
rm -f $(roms) $(crystal_obj) $(crystal11_obj) $(roms:.gbc=.map) $(roms:.gbc=.sym)
+ make clean -C tools/
compare: $(roms)
@$(SHA1) -c roms.sha1
diff --git a/tools/.gitignore b/tools/.gitignore
new file mode 100644
index 000000000..6fc2134d5
--- /dev/null
+++ b/tools/.gitignore
@@ -0,0 +1,8 @@
+gfx
+lzcomp
+md5
+palette
+png_dimensions
+pokemon_animation
+pokemon_animation_graphics
+scan_includes
diff --git a/tools/Makefile b/tools/Makefile
index 202961c3e..752658b06 100644
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -1,8 +1,8 @@
-.PHONY: all
+.PHONY: all clean
CFLAGS := -std=c99
-all: \
+tools := \
lzcomp \
png_dimensions \
scan_includes \
@@ -11,7 +11,11 @@ all: \
pokemon_animation_graphics \
gfx \
md5
+all: $(tools)
@:
+clean:
+ rm -f $(tools)
+
%: %.c
$(CC) $(CFLAGS) -o $@ $<
diff --git a/tools/lzcomp.c b/tools/lzcomp.c
index 1b7b32a5d..c3fae1001 100644
--- a/tools/lzcomp.c
+++ b/tools/lzcomp.c
@@ -177,11 +177,11 @@ struct command find_best_copy (const unsigned char * data, unsigned short positi
struct command simple = {.command = 7};
struct command flipped = simple, backwards = simple;
short count, offset;
- if (count = scan_forwards(data + position, length - position, data, position, &offset))
+ if ((count = scan_forwards(data + position, length - position, data, position, &offset)))
simple = (struct command) {.command = 4, .count = count, .value = offset};
- if (count = scan_forwards(data + position, length - position, bitflipped, position, &offset))
+ if ((count = scan_forwards(data + position, length - position, bitflipped, position, &offset)))
flipped = (struct command) {.command = 5, .count = count, .value = offset};
- if (count = scan_backwards(data, length - position, position, &offset))
+ if ((count = scan_backwards(data, length - position, position, &offset)))
backwards = (struct command) {.command = 6, .count = count, .value = offset};
struct command command;
switch (flags / 24) {