about summary refs log tree commit diff
path: root/pkgs/games/build-support/build-sandbox/src/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/games/build-support/build-sandbox/src/Makefile')
-rw-r--r--pkgs/games/build-support/build-sandbox/src/Makefile17
1 files changed, 17 insertions, 0 deletions
diff --git a/pkgs/games/build-support/build-sandbox/src/Makefile b/pkgs/games/build-support/build-sandbox/src/Makefile
new file mode 100644
index 00000000..57c732af
--- /dev/null
+++ b/pkgs/games/build-support/build-sandbox/src/Makefile
@@ -0,0 +1,17 @@
+BINARIES = $(wildcard $(BINDIR)/*)
+WRAPPERS = $(subst $(BINDIR),$(out)/bin,$(BINARIES))
+
+CFLAGS = -Wall -std=gnu11 -DFS_ROOT_DIR=\"$(out)\"
+CXXFLAGS = -Wall -std=c++14 `pkg-config --cflags nix-main`
+LDFLAGS = `pkg-config --libs nix-main`
+
+all: get-closure.o
+
+$(out)/bin/%: CFLAGS += -DWRAPPED_PROGNAME=\"$(@F)\"
+$(out)/bin/%: CFLAGS += -DWRAPPED_PATH=\"$(BINDIR)/$(@F)\"
+$(out)/bin/%: get-closure.o
+	mkdir -p $(out)/bin
+	$(CC) -o $@ $(CFLAGS) $(LDFLAGS) $? sandbox.c
+
+.PHONY: install
+install: $(WRAPPERS)