2017-04-26 13:27:46 +00:00
|
|
|
CFLAGS ?= -O2 -Wall -Wextra
|
|
|
|
LDFLAGS += -s
|
|
|
|
BIN = AppRun_patched
|
2017-12-06 13:37:47 +00:00
|
|
|
LIB = exec.so
|
2018-01-11 12:17:08 +00:00
|
|
|
EXEC_TEST = exec_test
|
|
|
|
ENV_TEST = env_test
|
2017-04-26 13:27:46 +00:00
|
|
|
|
2018-01-11 12:17:08 +00:00
|
|
|
checkrt: $(BIN) $(LIB)
|
2017-04-26 13:27:46 +00:00
|
|
|
|
2018-01-11 12:17:08 +00:00
|
|
|
test: $(EXEC_TEST) $(ENV_TEST)
|
|
|
|
|
|
|
|
all: checkrt test
|
2017-04-26 13:27:46 +00:00
|
|
|
|
|
|
|
clean:
|
2018-01-11 12:17:08 +00:00
|
|
|
-rm -f $(BIN) $(LIB) $(EXEC_TEST) $(ENV_TEST) *.o AppRun.c AppRun_patched.c
|
2017-04-26 13:27:46 +00:00
|
|
|
|
2018-01-11 12:17:08 +00:00
|
|
|
$(BIN): AppRun_patched.o checkrt.o env.o
|
2017-04-26 13:27:46 +00:00
|
|
|
|
2018-01-11 12:17:08 +00:00
|
|
|
$(LIB): exec.o env.o
|
2017-12-06 13:37:47 +00:00
|
|
|
$(CC) -shared $(LDFLAGS) -o $@ $^ -ldl
|
|
|
|
|
|
|
|
AppRun_patched.o checkrt.o: CFLAGS += -include checkrt.h
|
2018-01-11 12:17:08 +00:00
|
|
|
exec.o env.o: CFLAGS += -fPIC
|
|
|
|
|
|
|
|
$(EXEC_TEST): CFLAGS += -DEXEC_TEST
|
|
|
|
$(EXEC_TEST): exec.c env.c
|
|
|
|
$(CC) -o $@ $(CFLAGS) $^ -ldl
|
|
|
|
|
|
|
|
$(ENV_TEST): CFLAGS += -DENV_TEST
|
|
|
|
$(ENV_TEST): env.c
|
|
|
|
$(CC) -o $@ $(CFLAGS) $^
|
|
|
|
|
|
|
|
run_tests: $(EXEC_TEST) $(ENV_TEST)
|
|
|
|
./$(ENV_TEST)
|
|
|
|
./$(EXEC_TEST)
|
2017-12-06 13:37:47 +00:00
|
|
|
|
2017-04-26 13:27:46 +00:00
|
|
|
AppRun_patched.c: AppRun.c
|
|
|
|
patch -p1 --output $@ < AppRun.c.patch
|
|
|
|
|
|
|
|
AppRun.c:
|
2020-05-07 12:19:16 +00:00
|
|
|
wget -c "https://raw.githubusercontent.com/AppImage/AppImageKit/master/src/AppRun.c"
|
2017-04-26 13:27:46 +00:00
|
|
|
|
2018-01-11 12:17:08 +00:00
|
|
|
.PHONY: checkrt test run_tests all clean
|