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

Migrate pt-run to a complete Lua frontend #21

Merged
merged 7 commits into from
Aug 14, 2024
Merged
Show file tree
Hide file tree
Changes from 5 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
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
*.a
*.so

pt-run
pt-lua
4 changes: 3 additions & 1 deletion AUTHORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ Pallene Tracer Authors
----------------------

Here we thank the many people who have contributed code to this project.
This list was last updated in 2024-07-07, using `compute-authors.lua`.
This list was last updated in 2024-08-13, using `compute-authors.lua`.

SD Asif Hossein

Hugo Musso Gualandi
23 changes: 12 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ BINDIR = $(PREFIX)/bin
INCDIR = $(PREFIX)/include

# Where to find Lua libraries
LUA_PREFIX = /usr/local
LUA_PREFIX = /usr
LUA_BINDIR = $(LUA_PREFIX)/bin
LUA_INCDIR = $(LUA_PREFIX)/include
LUA_LIBDIR = $(LUA_PREFIX)/lib
Expand All @@ -20,14 +20,15 @@ INSTALL_EXEC= $(INSTALL) -m 0755
INSTALL_DATA= $(INSTALL) -m 0644

# C compilation flags
CFLAGS = -DPT_DEBUG -O2 -std=c99 -pedantic -Wall -Wextra -Wformat-security
CPPFLAGS = -I$(LUA_INCDIR) -I.
CFLAGS = -DPT_DEBUG -g -std=c99 -pedantic -Wall -Wextra -Wformat-security
# Explicitly mention which Lua headers to capture
CPPFLAGS = -isystem$(LUA_INCDIR) -I.
singul4ri7y marked this conversation as resolved.
Show resolved Hide resolved
LIBFLAG = -fPIC -shared

# The -Wl,-E tells the linker to not throw away unused Lua API symbols.
# We need them for Lua modules that are dynamically linked via require
PTRUN_LDFLAGS = -L$(LUA_LIBDIR) -Wl,-E
PTRUN_LDLIBS = -llua -lm
PTLUA_LDFLAGS = -L$(LUA_LIBDIR) -Wl,-E
PTLUA_LDLIBS = -llua -lm

# ===================
# Compilation targets
Expand All @@ -36,7 +37,7 @@ PTRUN_LDLIBS = -llua -lm
.PHONY: library examples tests all install uninstall clean

library: \
pt-run
pt-lua

examples: library \
examples/fibonacci/fibonacci.so
Expand All @@ -52,22 +53,22 @@ tests: library \

all: library examples tests

install:
$(INSTALL_EXEC) pt-run $(BINDIR)
install: library
$(INSTALL_EXEC) pt-lua $(BINDIR)
$(INSTALL_DATA) ptracer.h $(INCDIR)

uninstall:
rm -rf $(INCDIR)/ptracer.h
rm -rf $(BINDIR)/pt-run

clean:
rm -rf pt-run examples/*/*.so spec/tracebacks/*/*.so
rm -rf pt-lua examples/*/*.so spec/tracebacks/*/*.so

%.so: %.c
$(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) $(LIBFLAG) $< -o $@

pt-run: pt-run.c ptracer.h
$(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) $(PTRUN_LDFLAGS) $< -o $@ $(PTRUN_LDLIBS)
pt-lua: pt-lua.c ptracer.h
$(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) $(PTLUA_LDFLAGS) $< -o $@ $(PTLUA_LDLIBS)

examples/fibonacci/fibonacci.so: examples/fibonacci/fibonacci.c ptracer.h
spec/tracebacks/anon_lua/module.so: spec/tracebacks/anon_lua/module.c ptracer.h
Expand Down
Loading
Loading