diff --git a/.gitignore b/.gitignore
index 43b7fcd..c01e4bf 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,3 +2,10 @@
*.o
*.obj
*.exe
+cmdc
+gimgch
+gimgextract
+gimgfixcmd
+gimginfo
+gimgunlock
+gimgxor
diff --git a/Makefile b/Makefile
index f47094a..3303f2f 100644
--- a/Makefile
+++ b/Makefile
@@ -2,24 +2,30 @@ CC = gcc
CFLAGS = -Wall -D_FILE_OFFSET_BITS=64
GIMGLIB_SOURCES = gimglib.c util.c sf_typ.c sf_mps.c sf_tre.c sf_rgn.c sf_lbl.c sf_net.c sf_nod.c sf_dem.c sf_mar.c sf_gmp.c
GIMGLIB_OBJS = $(GIMGLIB_SOURCES:.c=.o)
+LIBS= -liconv -lm
all: gimginfo gimgfixcmd gimgxor gimgunlock gimgch gimgextract cmdc
gimginfo: gimginfo.o $(GIMGLIB_OBJS)
+ $(CC) -o $@ $^ ${LIBS}
gimgfixcmd: gimgfixcmd.o cmdlib.o $(GIMGLIB_OBJS)
- $(CC) -o $@ $^ -lm
+ $(CC) -o $@ $^ ${LIBS}
gimgxor: gimgxor.o
+ $(CC) -o $@ $^ ${LIBS}
gimgunlock: gimgunlock.o util_indep.o
+ $(CC) -o $@ $^ ${LIBS}
gimgch: gimgch.o util_indep.o
+ $(CC) -o $@ $^ ${LIBS}
gimgextract: gimgextract.o util_indep.o
+ $(CC) -o $@ $^ ${LIBS}
cmdc: cmdc.o
- $(CC) -o $@ $< -lm
+ $(CC) -o $@ $^ ${LIBS}
.PHONY: clean
clean:
diff --git a/gimgunlock.c b/gimgunlock.c
index 1bb51b7..3ecdad4 100644
--- a/gimgunlock.c
+++ b/gimgunlock.c
@@ -216,14 +216,14 @@ int main (int argc, char *argv[])
FILE *fp;
struct patch_struct *patch;
- if (argc != 2) {
- printf("usage: %s file.img\n", argv[0]);
+ if (argc != 3) {
+ printf("usage: %s