diff options
author | Jakob Kaivo <jkk@ung.org> | 2022-04-25 19:01:05 -0400 |
---|---|---|
committer | Jakob Kaivo <jkk@ung.org> | 2022-04-25 19:01:05 -0400 |
commit | 50f99eabe9204d6a1cc7cd00b5d09a02bf1f1a6f (patch) | |
tree | 9e2c640796b6789c64f4b2f6c22ffa9fb23c5b64 | |
parent | de3ccad4e9d3573d7c02f7b5e58ac951f9b3b23e (diff) |
make directories before trying to put things in them
-rw-r--r-- | make.c | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -10,7 +10,7 @@ static void make_header(FILE *makefile, const char *target) { fprintf(makefile, ".POSIX:\n\n"); fprintf(makefile, "# This Makefile was generated by maje\n"); - fprintf(makefile, "# See https://gitlab.com/jkaivo/maje/ for more information\n"); + fprintf(makefile, "# See https://src.kaivo.net/dev/maje/ for more information\n"); fprintf(makefile, "# Do not edit this Makefile by hand\n\n"); fprintf(makefile, "CC=c99\n"); @@ -30,6 +30,7 @@ static void make_header(FILE *makefile, const char *target) fprintf(makefile, "\trm -f $(BINDIR)/%s $(OBJDIR)/*.o\n\n", target); fprintf(makefile, "install: $(BINDIR)/%s\n", target); + fprintf(makefile, "\tmkdir -p $(DESTDIR)/bin\n"); fprintf(makefile, "\tcp $(BINDIR)/%s $(DESTDIR)/bin\n\n", target); } @@ -45,6 +46,7 @@ static void add_object(FILE *makefile, const struct majefile *src, const char *t obj, inc->path); } fprintf(makefile, "$(OBJDIR)/%s: $(SRCDIR)/%s\n", obj, src->path); + fprintf(makefile, "\t@mkdir -p $(@D)\n"); fprintf(makefile, "\t$(CC) $(CFLAGS) -o $@ -c $(SRCDIR)/%s\n\n", src->path); free(fullobj); @@ -64,6 +66,7 @@ void make_makefile(const char *makepath, struct majefile *sources, const char *t } fprintf(makefile, "$(BINDIR)/%s:\n", target); + fprintf(makefile, "\t@mkdir -p $(@D)\n"); fprintf(makefile, "\t$(LD) $(LDFLAGS) -o $@ $(OBJDIR)/*.o $(LDLIBS)\n"); fclose(makefile); |