Files

36 lines
1.2 KiB
Makefile
Raw Permalink Normal View History

2018-06-07 17:39:50 -03:00
OUT_DIR = build
SCR_DIR = $(OUT_DIR)/scripts
2018-05-24 22:57:11 -03:00
2018-06-07 17:39:50 -03:00
all: $(SCR_DIR) $(OUT_DIR)/unicode.c $(OUT_DIR)/unicode.h $(OUT_DIR)/test.out
$(SCR_DIR):
mkdir -p $(SCR_DIR)
# Compile and run the tests
$(OUT_DIR)/test.out: $(SCR_DIR)/unitest
$(SCR_DIR)/unitest > $(OUT_DIR)/test.out
$(SCR_DIR)/unitest: $(SCR_DIR)/unicode.c $(SCR_DIR)/unicode.h
2018-06-20 21:12:45 -03:00
gcc $(CFLAGS) -o $(SCR_DIR)/unitest $(SCR_DIR)/unicode.c
2018-06-07 17:39:50 -03:00
# We want to patch together two different versions of the generated source code:
# one for the kernel module, and another for running tests in user space
$(OUT_DIR)/unicode.c: $(SCR_DIR)/mktrie code/unicode.c code/bld_head.c
$(SCR_DIR)/mktrie
cat code/bld_head.c code/unicode.c unicode.c.tmp > $(OUT_DIR)/unicode.c
rm -f unicode.c.tmp
2018-11-13 00:36:13 -03:00
$(SCR_DIR)/unicode.c: $(SCR_DIR)/mktrie code/unicode.c code/test_head.c
$(SCR_DIR)/mktrie
2018-06-07 17:39:50 -03:00
cat code/test_head.c code/unicode.c unicode.c.tmp > $(SCR_DIR)/unicode.c
rm -f unicode.c.tmp
$(OUT_DIR)/unicode.h: code/unicode.h code/bld_head.h
cat code/bld_head.h code/unicode.h > $(OUT_DIR)/unicode.h
$(SCR_DIR)/unicode.h: code/unicode.h code/test_head.h
cat code/test_head.h code/unicode.h > $(SCR_DIR)/unicode.h
$(SCR_DIR)/mktrie: mktrie.c
2018-06-20 21:12:45 -03:00
gcc $(CFLAGS) -o $(SCR_DIR)/mktrie mktrie.c
2018-05-24 22:57:11 -03:00
clean:
2018-06-07 17:39:50 -03:00
rm -Rf $(OUT_DIR)
rm -f unicode.c.tmp