diff options
author | Marvin Borner | 2021-07-28 20:15:18 +0200 |
---|---|---|
committer | Marvin Borner | 2021-07-28 20:15:18 +0200 |
commit | 91c00d2fbec848f05971005c5718a0f90b1cc7bf (patch) | |
tree | 1300ed8ecd381bce24512fcb922b49b62c04eb42 | |
parent | bfdc8d2d843c08bd01517256a63518d03da236f6 (diff) |
Update
-rw-r--r-- | Makefile | 9 | ||||
-rw-r--r-- | test.fun | 13 |
2 files changed, 19 insertions, 3 deletions
@@ -4,7 +4,10 @@ BUILDDIR = $(PWD)/build SOURCES = $(wildcard $(SOURCEDIR)/*.c) OBJS = $(patsubst $(SOURCEDIR)/%.c, $(BUILDDIR)/%.o, $(SOURCES)) -CC = ccache gcc +CA = ccache +AS = $(CA) nasm +LD = $(CA) ld +CC = $(CA) gcc CFLAGS = -Ofast -Wall -Wextra -Werror -pedantic -Wshadow -Wpointer-arith -Wwrite-strings -Wredundant-decls -Wnested-externs -Wformat=1 -Wmissing-declarations -Wstrict-prototypes -Wmissing-prototypes -Wcast-qual -Wswitch-default -Wswitch-enum -Wlogical-op -Wunreachable-code -Wundef -Wold-style-definition -Wvla -std=c99 -fsanitize=address -fsanitize=undefined -fstack-protector-strong -I$(INCLUDEDIR) all: $(OBJS) @@ -20,6 +23,10 @@ $(BUILDDIR)/%.o: $(SOURCEDIR)/%.c @mkdir -p $(BUILDDIR) @$(CC) -c -o $@ $(CFLAGS) $< +compile: + @$(AS) -f elf64 -o $(BUILDDIR)/test.o $(BUILDDIR)/test.asm + @$(LD) $(BUILDDIR)/test.o -o $(BUILDDIR)/test + sync: @ctags -R --exclude=.git --exclude=build . @make --always-make --dry-run | grep -wE 'gcc|g\+\+' | grep -w '\-c' | jq -nR '[inputs|{directory:".", command:., file: match(" [^ ]+$$").string[1:]}]' > compile_commands.json @@ -1,2 +1,11 @@ -#inc other.fun -u32:x u32:a u32:b = a * ((u32:_ u32:c u32:d = c + d) a b); +#inc stdlib.fun + +## u32:x u32:a u32:b = a * ((u32:_ u32:c u32:d = c + d) a b); +u32:x u32:a u32:b = (* a ((u32:_ u32:c u32:d = (+ c d)) a b)); + +## print 12 +print (x 2 4); + +## Racket inspiration +## (define (fact [n 8]) +## (if (zero? n) 1 (* n (fact (- n 1))))) |