Do actual separate compilation

code-review-i
Dave Vandervies 5 years ago
parent aef524d8ce
commit 84bf9d782f
  1. 2
      .gitignore
  2. 9
      Makefile
  3. 2
      character.c
  4. 2
      character.h
  5. 5
      chargen.c
  6. 6
      chargen.h

2
.gitignore vendored

@ -0,0 +1,2 @@
chargen
*.o

@ -1,9 +1,10 @@
CC=cc
LIBS=-lm LIBS=-lm
server: all:
${CC} -o chargen ${LIBS} chargen.c
all: server generator chargen: chargen.o character.o
${CC} -o chargen ${LIBS} $^ $>
all: chargen
.PHONY: all .PHONY: all

@ -2,6 +2,8 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <math.h> #include <math.h>
#include "chargen.h"
#include "character.h" #include "character.h"
int dieroll(int num,int sides){ int dieroll(int num,int sides){

@ -93,5 +93,3 @@ char* backgrounds[] = { "Acolyte", "Charlatan", "Criminal", "Entertainer", "Folk
int stats[6]; int stats[6];
int mods[6]; int mods[6];
int hp; int hp;
char* genChar();

@ -11,7 +11,7 @@
#include <unistd.h> #include <unistd.h>
#include <netdb.h> #include <netdb.h>
#include "character.c" #include "chargen.h"
void usage_and_die(const char *myname, const char *fmt, ...) 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) if (num_packet + num_listen == 0)
errx(EXIT_FAILURE, "No listeners to run on!\n"); errx(EXIT_FAILURE, "No listeners to run on!\n");
if (pledge("stdio inet error", NULL) == -1)
warn("pledge");
while(1) while(1)
{ {
fd_set r, w; fd_set r, w;

@ -0,0 +1,6 @@
#ifndef H_CHARGEN
#define H_CHARGEN
char* genChar();
#endif
Loading…
Cancel
Save