CC ?= clang
CFLAGS += -Wall -I. -pedantic-errors -std=c90
-OBJ = main.o \
- lex.o \
+OBJ = lex.o \
error.o \
parse.o \
typedef.o \
asm.o \
ast.o \
ir.o
-# ast and ir test
-TEST_AST = test/ast-test.o
-TEST_IR = test/ir-test.o
+OBJ_A = test/ast-test.o
+OBJ_I = test/ir-test.o
+OBJ_C = main.o
#default is compiler only
default: gmqcc
$(CC) -c $< -o $@ $(CFLAGS)
# test targets
-test_ast: $(TEST_AST) $(OBJ)
+test_ast: $(OBJ_A) $(OBJ)
$(CC) -o $@ $^ $(CFLAGS)
-test_ir: $(TEST_IR) $(OBJ)
+test_ir: $(OBJ_I) $(OBJ)
$(CC) -o $@ $^ $(CFLAGS)
test: test_ast test_ir
# compiler target
-gmqcc: $(OBJ)
+gmqcc: $(OBJ_C) $(OBJ)
$(CC) -o $@ $^ $(CFLAGS)
#all target is test and all
typedef struct { char *name, type; } argitem;
VECTOR_MAKE(argitem, items);
-/* global options */
-bool opts_debug = false;
-bool opts_memchk = false;
-bool opts_darkplaces_stringtablebug = false;
-bool opts_omit_nullcode = false;
-int opts_compiler = COMPILER_GMQCC;
-
static const int usage(const char *const app) {
printf("usage:\n"
" %s -c<file> -oprog.dat -- compile file\n"
VECTOR_MAKE(ast_value*, globals);
VECTOR_MAKE(ast_function*, functions);
-void testast()
+int main()
{
ast_expression *exp;
ast_value *gfoo = NULL;
}
if (globals_data)
mem_d(globals_data);
+ return 0;
}
#include "gmqcc.h"
#include "ir.h"
-void builder1()
+int main()
{
ir_builder *b = ir_builder_new("test");
ir_value *va = ir_builder_create_global(b, "a", TYPE_FLOAT);
ir_value_dump_life(la, printf);
ir_builder_delete(b);
+ return 0;
}
*pos = '\0';
return (ret = pos - *lineptr);
}
+
+/* TODO: opts.c? when it gets large enugh */
+/* global options */
+bool opts_debug = false;
+bool opts_memchk = false;
+bool opts_darkplaces_stringtablebug = false;
+bool opts_omit_nullcode = false;
+int opts_compiler = COMPILER_GMQCC;