2023-04-26 14:22:14 +02:00
|
|
|
CC=gcc
|
2023-09-27 03:45:58 +02:00
|
|
|
COMMON_FLAGS=-no-pie -m32 -g2 -fstack-protector-all
|
|
|
|
|
PROD_FLAGS=$(COMMON_FLAGS) -DLAMA_ENV
|
|
|
|
|
TEST_FLAGS=$(COMMON_FLAGS) -DDEBUG_VERSION
|
|
|
|
|
UNIT_TESTS_FLAGS=$(TEST_FLAGS)
|
|
|
|
|
INVARIANTS_CHECK_FLAGS=$(TEST_FLAGS) -DFULL_INVARIANT_CHECKS
|
2021-02-14 18:54:44 +03:00
|
|
|
|
2023-09-27 03:45:58 +02:00
|
|
|
# this target is the most important one, its' artefacts should be used as a runtime of Lama
|
2023-05-23 13:40:46 +02:00
|
|
|
all: gc_runtime.o gc.o runtime.o
|
2023-03-27 10:09:54 +02:00
|
|
|
ar rc runtime.a gc_runtime.o runtime.o gc.o
|
|
|
|
|
|
2023-09-27 03:45:58 +02:00
|
|
|
# this is a target that runs unit tests, scenarios are written in a single file `test_main.c`
|
|
|
|
|
unit_tests.o: gc.c gc.h gc_runtime.s runtime.c runtime.h runtime_common.h virt_stack.c virt_stack.h test_main.c test_util.s
|
|
|
|
|
$(CC) -o unit_tests.o $(UNIT_TESTS_FLAGS) gc.c gc_runtime.s virt_stack.c runtime.c test_main.c test_util.s
|
|
|
|
|
|
|
|
|
|
# this target also runs unit tests but with additional expensive checks of GC invariants which aren't used in production version
|
|
|
|
|
invariants_check.o: gc.c gc.h gc_runtime.s runtime.c runtime.h runtime_common.h virt_stack.c virt_stack.h test_main.c test_util.s
|
|
|
|
|
$(CC) -o invariants_check.o $(INVARIANTS_CHECK_FLAGS) gc.c gc_runtime.s virt_stack.c runtime.c test_main.c test_util.s
|
|
|
|
|
|
|
|
|
|
# this target also runs unit tests but with additional expensive checks of GC invariants which aren't used in production version
|
|
|
|
|
# additionally, it prints debug information
|
|
|
|
|
invariants_check_debug_print.o: gc.c gc.h gc_runtime.s runtime.c runtime.h runtime_common.h virt_stack.c virt_stack.h test_main.c test_util.s
|
|
|
|
|
$(CC) -o invariants_check_debug_print.o $(INVARIANTS_CHECK_FLAGS) -DDEBUG_PRINT gc.c gc_runtime.s virt_stack.c runtime.c test_main.c test_util.s
|
2023-04-26 14:22:14 +02:00
|
|
|
|
|
|
|
|
virt_stack.o: virt_stack.h virt_stack.c
|
2023-09-27 03:45:58 +02:00
|
|
|
$(CC) $(PROD_FLAGS) -c virt_stack.c
|
2023-04-26 14:22:14 +02:00
|
|
|
|
2023-03-27 10:09:54 +02:00
|
|
|
gc.o: gc.c gc.h
|
2023-09-27 03:45:58 +02:00
|
|
|
$(CC) -rdynamic $(PROD_FLAGS) -c gc.c
|
2018-11-21 14:23:35 +03:00
|
|
|
|
|
|
|
|
gc_runtime.o: gc_runtime.s
|
2023-09-27 03:45:58 +02:00
|
|
|
$(CC) $(PROD_FLAGS) -c gc_runtime.s
|
2018-11-21 14:23:35 +03:00
|
|
|
|
2021-09-28 03:02:05 +03:00
|
|
|
runtime.o: runtime.c runtime.h
|
2023-09-27 03:45:58 +02:00
|
|
|
$(CC) $(PROD_FLAGS) -c runtime.c
|
2018-03-04 23:13:08 +03:00
|
|
|
|
|
|
|
|
clean:
|
2021-02-14 18:54:44 +03:00
|
|
|
$(RM) *.a *.o *~
|