diff options
| author | 2025-10-19 08:09:09 +0200 | |
|---|---|---|
| committer | 2025-10-19 08:09:09 +0200 | |
| commit | dea8fd171acb54b6d9685422d5e391fb55074008 (patch) | |
| tree | 2c149892f35c5183c9b2a1da4ab437228dc432ef | |
| parent | 3437945692f2b87883a4f066473c9deed50f25f5 (diff) | |
Organize source files into directories
| -rw-r--r-- | .gitignore | 2 | ||||
| -rw-r--r-- | Makefile | 12 | ||||
| -rw-r--r-- | amd64/all.h | 2 | ||||
| -rw-r--r-- | amd64/emit.c | 2 | ||||
| -rw-r--r-- | c/c.c (renamed from c.c) | 6 | ||||
| -rw-r--r-- | c/c.h (renamed from c.h) | 2 | ||||
| -rw-r--r-- | c/eval.c (renamed from eval.c) | 0 | ||||
| -rw-r--r-- | c/keywords.def (renamed from keywords.def) | 0 | ||||
| -rw-r--r-- | c/lex.c (renamed from lex.c) | 0 | ||||
| -rw-r--r-- | c/lex.h (renamed from lex.h) | 2 | ||||
| -rw-r--r-- | io.c | 4 | ||||
| -rw-r--r-- | ir/abi0.c (renamed from abi0.c) | 0 | ||||
| -rw-r--r-- | ir/cfg.c (renamed from cfg.c) | 0 | ||||
| -rw-r--r-- | ir/dump.c (renamed from irdump.c) | 2 | ||||
| -rw-r--r-- | ir/intrin.c (renamed from intrin.c) | 1 | ||||
| -rw-r--r-- | ir/intrin.def (renamed from intrin.def) | 0 | ||||
| -rw-r--r-- | ir/ir.c (renamed from ir.c) | 2 | ||||
| -rw-r--r-- | ir/ir.h (renamed from ir.h) | 2 | ||||
| -rw-r--r-- | ir/op.def (renamed from op.def) | 0 | ||||
| -rw-r--r-- | ir/optmem.c (renamed from optmem.c) | 0 | ||||
| -rw-r--r-- | ir/regalloc.c (renamed from regalloc.c) | 0 | ||||
| -rw-r--r-- | ir/ssa.c (renamed from ssa.c) | 1 | ||||
| -rw-r--r-- | main.c | 2 | ||||
| -rw-r--r-- | obj/elf.c (renamed from elf.c) | 5 | ||||
| -rw-r--r-- | obj/elf.h (renamed from elf.h) | 2 | ||||
| -rw-r--r-- | obj/obj.c (renamed from obj.c) | 3 | ||||
| -rw-r--r-- | obj/obj.h (renamed from obj.h) | 2 |
27 files changed, 25 insertions, 29 deletions
@@ -1,5 +1,5 @@ antcc -obj/ +build/ compile_commands.json .cache/ .gdb_history @@ -1,8 +1,8 @@ -SRC=main.c io.c mem.c c.c lex.c type.c targ.c eval.c ir.c irdump.c ssa.c cfg.c \ - intrin.c abi0.c optmem.c regalloc.c amd64/sysv.c amd64/isel.c amd64/emit.c obj.c elf.c\ +SRC=main.c io.c mem.c c/c.c c/lex.c c/eval.c type.c targ.c ir/ir.c ir/dump.c ir/ssa.c ir/cfg.c \ + ir/intrin.c ir/abi0.c ir/optmem.c ir/regalloc.c amd64/sysv.c amd64/isel.c amd64/emit.c obj/obj.c obj/elf.c \ embedfilesdir.c CFLAGS=-Wall -std=c11 -pedantic -OBJ=$(patsubst %.c,obj/%.o,$(SRC)) +OBJ=$(patsubst %.c,build/%.o,$(SRC)) DEP=$(OBJ:.o=.d) OUT=antcc @@ -18,12 +18,12 @@ dbg: $(OUT) $(OUT): $(OBJ) $(CC) $(CFLAGS) -o $@ $(OBJ) -obj/%.o: %.c common.h +build/%.o: %.c common.h @mkdir -p `dirname $@` - $(CC) $(CFLAGS) -MMD -MP -MT $@ -MF obj/$*.d -c -o $@ $< + $(CC) $(CFLAGS) -MMD -MP -MT $@ -MF build/$*.d -c -o $@ $< clean: - $(RM) -r obj/ $(OUT) *.o a.out + $(RM) -r build// $(OUT) *.o a.out .PHONY: clean diff --git a/amd64/all.h b/amd64/all.h index 42f4d23..992d47e 100644 --- a/amd64/all.h +++ b/amd64/all.h @@ -1,4 +1,4 @@ -#include "../ir.h" +#include "../ir/ir.h" #define LIST_REGS(_) \ _(RAX) _(RCX) _(RDX) _(RBX) _(RSP) _(RBP) _(RSI) _(RDI) \ diff --git a/amd64/emit.c b/amd64/emit.c index a6ce774..1db5093 100644 --- a/amd64/emit.c +++ b/amd64/emit.c @@ -1,5 +1,5 @@ #include "all.h" -#include "../obj.h" +#include "../obj/obj.h" #include "../endian.h" /** Instruction operands ** @@ -1,8 +1,8 @@ #include "c.h" #include "lex.h" -#include "ir.h" -#include "endian.h" -#include "obj.h" +#include "../endian.h" +#include "../ir/ir.h" +#include "../obj/obj.h" /** C compiler state **/ struct comp { @@ -1,4 +1,4 @@ -#include "common.h" +#include "../common.h" /*************/ /* EXPR TREE */ diff --git a/keywords.def b/c/keywords.def index 258a396..258a396 100644 --- a/keywords.def +++ b/c/keywords.def @@ -1,4 +1,4 @@ -#include "common.h" +#include "../common.h" static inline bool joinspan(struct span0 *dst, struct span0 snd) @@ -1,4 +1,4 @@ -#include "lex.h" +#include "c/lex.h" #include <limits.h> #include <stdlib.h> #include <string.h> @@ -576,7 +576,7 @@ vbfmt(struct wbuf *out, const char *fmt, va_list ap) if (tok->t >= TKWBEGIN_ && tok->t <= TKWEND_) { static const char *tab[] = { #define _(kw, c) #kw, - #include "keywords.def" + #include "c/keywords.def" #undef _ }; n += bfmt(buf, "%s", tab[tok->t - TKWBEGIN_]); @@ -1,5 +1,5 @@ #include "ir.h" -#include "obj.h" +#include "../obj/obj.h" static int nextdat; @@ -1,4 +1,3 @@ -#include "common.h" #include "ir.h" struct arg { union ref *arg, *ty; }; diff --git a/intrin.def b/ir/intrin.def index 2ccc3b5..2ccc3b5 100644 --- a/intrin.def +++ b/ir/intrin.def @@ -1,5 +1,5 @@ #include "ir.h" -#include "obj.h" +#include "../obj/obj.h" uchar type2cls[NTYPETAG]; uchar cls2siz[KF8+1]; @@ -1,4 +1,4 @@ -#include "common.h" +#include "../common.h" enum irclass { KXXX, diff --git a/regalloc.c b/ir/regalloc.c index 64dcfac..64dcfac 100644 --- a/regalloc.c +++ b/ir/regalloc.c @@ -1,4 +1,3 @@ -#include "common.h" #include "ir.h" /* require use, keeps use */ @@ -1,5 +1,5 @@ #include "common.h" -#include "obj.h" +#include "obj/obj.h" #include <errno.h> #include <stdlib.h> #include <sys/types.h> @@ -1,8 +1,7 @@ #include "elf.h" -#include "common.h" #include "obj.h" -#include "ir.h" -#include "endian.h" +#include "../ir/ir.h" /* mctarg */ +#include "../endian.h" #include <unistd.h> #include <stdlib.h> /* qsort */ @@ -1,4 +1,4 @@ -#include "common.h" +#include "../common.h" #define ELFMAG "\177ELF" enum { @@ -1,6 +1,5 @@ #include "obj.h" -#include "common.h" -#include "ir.h" +#include "../ir/ir.h" #include <errno.h> #include <fcntl.h> #include <unistd.h> @@ -1,4 +1,4 @@ -#include "common.h" +#include "../common.h" extern struct objfile { const char *infile, *outfile; |