From cd2d1af8bf99ac00894df9d57e6a16f7af75b654 Mon Sep 17 00:00:00 2001 From: Jakob Kaivo Date: Tue, 14 Jan 2020 15:38:22 -0500 Subject: add LD and LDFLAGS --- make.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/make.c b/make.c index 919cac8..7983979 100644 --- a/make.c +++ b/make.c @@ -16,7 +16,10 @@ static void make_header(FILE *makefile, const char *target) fprintf(makefile, "default: all\n\n"); fprintf(makefile, "CC=c99\n"); - fprintf(makefile, "CFLAGS=-Wall -Wextra -Wpedantic -Werror -g\n\n"); + fprintf(makefile, "LD=$(CC)\n"); + fprintf(makefile, "CFLAGS=-Wall -Wextra -Wpedantic -Werror -g\n"); + fprintf(makefile, "LDFLAGS=\n"); + fprintf(makefile, "\n"); fprintf(makefile, "all: %s\n\n", target); @@ -51,7 +54,7 @@ void make_makefile(const char *makepath, char **sources, const char *target) } fprintf(makefile, "%s:\n", target); - fprintf(makefile, "\t$(CC) -o $@ *.o\n"); + fprintf(makefile, "\t$(LD) $(LDFLAGS) -o $@ *.o\n"); fclose(makefile); } -- cgit v1.2.1