Browse Source

Improved makefile and main for better deving

long_to_char
Cameron Weinfurt 3 years ago
parent
commit
61ebd78273
  1. 21
      Makefile
  2. 13
      main.c

21
Makefile

@ -1,25 +1,30 @@
objs = main.o token.o expr.o parse.o infint.o
flags = -g -D UNIT_TESTS
dev: FLAGS= -g -D UNIT_TESTS
dev: build
./infcalc
release: FLAGS= -O2
release: clean build
rm *.o
build: $(objs)
clang -o infcalc $(objs) $(flags)
./infcalc
clang $(FLAGS) -o infcalc $(objs)
clean:
rm *.o infcalc
main.o: main.c expr.h
clang -c main.c -o main.o $(flags)
clang $(FLAGS) -c main.c -o main.o
token.o: token.c token.h
clang -c token.c -o token.o $(flags)
clang $(FLAGS) -c token.c -o token.o
expr.o: expr.c expr.h
clang -c expr.c -o expr.o $(flags)
clang $(FLAGS) -c expr.c -o expr.o
parse.o: parse.c parse.h token.h expr.h
clang -c parse.c -o parse.o $(flags)
clang $(FLAGS) -c parse.c -o parse.o
infint.o: infint*.c
clang -c infint.c -o infint.o $(flags)
clang $(FLAGS) -c infint.c -o infint.o

13
main.c

@ -1,14 +1,19 @@
#include <stdio.h>
#include <stdlib.h>
#include "expr.h"
#include "infint.h"
#include "parse.h"
#ifdef UNIT_TESTS
int main() {
test_infint();
printf("\n**********************\n| All tests passed |\n**********************\n");
}
/*#include "expr.h"
#include "parse.h"
#else
int main() {
char *line = NULL;
@ -22,4 +27,6 @@ int main() {
print_expr_tree(e, 0);
destroy_expr(e);
}*/
}
#endif
Loading…
Cancel
Save