Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix building #2

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
jit1
jit2
jit3
*.c
*.h
*.gch
21 changes: 12 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@

CFLAGS=-O3 -g -std=gnu99 -Ithird_party
CFLAGS=-O3 -g -std=gnu99 -Ithird_party -D DASM_VERSION=10300

all: jit1 jit2 jit3

jit1: jit1.c

jit2: dynasm-driver.c jit2.h
$(CC) $(CFLAGS) $(CPPFLAGS) -o jit2 dynasm-driver.c -DJIT=\"jit2.h\"
jit2.h: jit2.dasc
lua dynasm/dynasm.lua jit2.dasc > jit2.h
jit2: dynasm-driver.h jit2.c
$(CC) $(CFLAGS) $(CPPFLAGS) dynasm-driver.h jit2.c -o jit2
jit2.c: jit2.dasc
lua third_party/dynasm/dynasm.lua jit2.dasc > jit2.c

jit3: dynasm-driver.c jit3.h
$(CC) $(CFLAGS) $(CPPFLAGS) -o jit3 dynasm-driver.c -DJIT=\"jit3.h\"
jit3.h: jit3.dasc
lua dynasm/dynasm.lua jit3.dasc > jit3.h
jit3: dynasm-driver.h jit3.c
$(CC) $(CFLAGS) $(CPPFLAGS) dynasm-driver.h jit3.c -o jit3
jit3.c: jit3.dasc
lua third_party/dynasm/dynasm.lua jit3.dasc > jit3.c

clean:
rm -f jit1 jit2 jit3
2 changes: 0 additions & 2 deletions dynasm-driver.c → dynasm-driver.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ void initjit(dasm_State **state, const void *actionlist);
void *jitcode(dasm_State **state);
void free_jitcode(void *code);

#include JIT

void initjit(dasm_State **state, const void *actionlist) {
dasm_init(state, 1);
dasm_setup(state, actionlist);
Expand Down
2 changes: 2 additions & 0 deletions jit2.dasc
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// Most basic DynASM JIT; generates a trivial function that
// returns a given value, and executes it.

#include "dynasm-driver.h"

// DynASM directives.
|.arch x64
|.actionlist actions
Expand Down
2 changes: 2 additions & 0 deletions jit3.dasc
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

#include <stdint.h>

#include "dynasm-driver.h"

|.arch x64
|.actionlist actions
|
Expand Down