commit 39858fc0d4fafca4fd97fb0bf970383e9fc9b7f1
parent 4fbfd72b67cf2806bdb9d72e629c027a47055364
Author: klewer-martin <martin.cachari@gmail.com>
Date: Thu, 24 Mar 2022 20:50:35 -0300
Updated Makefile, fixed util.c 'end' funcion
Diffstat:
3 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/Makefile b/Makefile
@@ -1,17 +1,20 @@
-CC := gcc
+CC := cc
CLIBS :=
CFLAGS := `sdl2-config --libs --cflags` -lSDL2_image -lm
-SRCS := "sav.c util.c"
+SRCS := sav.c util.c
OBJS := $(SRCS:.c=.o)
TARGET := sav
.PHONY: all clean
-all: $(TARGET)
+all: $(TARGET) clean
$(TARGET): $(OBJS)
$(CC) $(CFLAGS) -o $@ $^
+%.o: %.c
+ $(CC) $(CFLAGS) -c $< -o $@
+
clean:
rm -f $(OBJS)
diff --git a/util.c b/util.c
@@ -1,7 +1,7 @@
#include "util.h"
void end(const char *msg) {
- fprintf("%s\n", msg);
+ fprintf(stderr, "%s\n", msg);
exit(1);
}
diff --git a/util.h b/util.h
@@ -2,6 +2,7 @@
#define __UTIL_H__
#include <stdio.h>
+#include <stdlib.h>
void end(const char *msg);
void swap(int *a, int *b);