Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Makefile to reference correct libraries #4

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,10 @@
*.o
*.obj
*.exe
cmdc
gimgch
gimgextract
gimgfixcmd
gimginfo
gimgunlock
gimgxor
10 changes: 8 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
12 changes: 6 additions & 6 deletions gimgunlock.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 <input file> <output file>\n", argv[0]);
return 1;
}
if (strcmp(argv[1], "-h") == 0 ||
strcmp(argv[1], "--help") == 0 ||
strcmp(argv[1], "-?") == 0) {
printf("usage: %s file.img\n", argv[0]);
printf("usage: %s <input file> <output file>\n", argv[0]);
return 1;
}

Expand All @@ -238,10 +238,10 @@ int main (int argc, char *argv[])
if (patch == NULL)
return 1;

printf("Writing to file.\n");
fp = fopen(argv[1], "rb+");
printf("Writing to file:%s\n", argv[2]);
fp = fopen(argv[2], "rb+");
if (fp == NULL) {
printf("can't open %s for writing\n", argv[1]);
printf("can't open %s for writing\n", argv[2]);
return 1;
}
apply_patch(fp, patch);
Expand Down