From 84bf9d782ffe195b33de2d73b67fbff0e6d7822d Mon Sep 17 00:00:00 2001 From: Dave Vandervies Date: Sat, 14 Dec 2019 16:11:15 -0500 Subject: [PATCH] Do actual separate compilation --- .gitignore | 2 ++ Makefile | 9 +++++---- character.c | 2 ++ character.h | 2 -- chargen.c | 5 +---- chargen.h | 6 ++++++ 6 files changed, 16 insertions(+), 10 deletions(-) create mode 100644 .gitignore create mode 100644 chargen.h diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1c28580 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +chargen +*.o diff --git a/Makefile b/Makefile index c2a8881..c1085e5 100644 --- a/Makefile +++ b/Makefile @@ -1,9 +1,10 @@ -CC=cc LIBS=-lm -server: - ${CC} -o chargen ${LIBS} chargen.c +all: -all: server generator +chargen: chargen.o character.o + ${CC} -o chargen ${LIBS} $^ $> + +all: chargen .PHONY: all diff --git a/character.c b/character.c index 6eb1525..b0f226a 100644 --- a/character.c +++ b/character.c @@ -2,6 +2,8 @@ #include #include #include + +#include "chargen.h" #include "character.h" int dieroll(int num,int sides){ diff --git a/character.h b/character.h index f255fd1..c8bee84 100644 --- a/character.h +++ b/character.h @@ -93,5 +93,3 @@ char* backgrounds[] = { "Acolyte", "Charlatan", "Criminal", "Entertainer", "Folk int stats[6]; int mods[6]; int hp; - -char* genChar(); diff --git a/chargen.c b/chargen.c index 3182bd9..37b2a03 100644 --- a/chargen.c +++ b/chargen.c @@ -11,7 +11,7 @@ #include #include -#include "character.c" +#include "chargen.h" void usage_and_die(const char *myname, const char *fmt, ...) { @@ -148,9 +148,6 @@ int main(int argc, char **argv) if (num_packet + num_listen == 0) errx(EXIT_FAILURE, "No listeners to run on!\n"); - if (pledge("stdio inet error", NULL) == -1) - warn("pledge"); - while(1) { fd_set r, w; diff --git a/chargen.h b/chargen.h new file mode 100644 index 0000000..334994a --- /dev/null +++ b/chargen.h @@ -0,0 +1,6 @@ +#ifndef H_CHARGEN +#define H_CHARGEN + +char* genChar(); + +#endif