|
@@ -19,44 +19,25 @@ PYTHON_CONFIG=$(PYTHON)-config
|
19
|
19
|
PYTHON_CFLAGS=`$(PYTHON_CONFIG) --includes` `$(PYTHON_CONFIG) --cflags`
|
20
|
20
|
PYTHON_LDFLAGS=-shared -fPIC `$(PYTHON_CONFIG) --libs` `$(PYTHON_CONFIG) --ldflags|cut -d' ' -f1,2`
|
21
|
21
|
|
22
|
|
-all: .deps pyrpn.so
|
23
|
|
-
|
24
|
|
-pyrpn.so: python_pyrpn.o python_rpnexpr.o python_if.o python_const.o rpn_lib.o rpn_jit.o rpn_parse.o rpn_mutation.o rpn_if.o rpn_if_default.o rpn_ifs.o
|
25
|
|
- $(LD) $(LDFLAGS) $(PYTHON_LDFLAGS) -o $@ $^
|
26
|
|
-
|
27
|
|
-python_pyrpn.o: python_pyrpn.c python_rpnexpr.h python_rpnexpr.o rpn_jit.o
|
28
|
|
- $(CC) $(PYTHON_CFLAGS) $(CFLAGS) -c $<
|
29
|
|
-
|
30
|
|
-python_rpnexpr.o: python_rpnexpr.c python_rpnexpr.h rpn_jit.o
|
31
|
|
- $(CC) $(PYTHON_CFLAGS) $(CFLAGS) -c $<
|
32
|
|
-
|
33
|
|
-python_if.o: python_if.c python_if.h
|
34
|
|
- $(CC) $(PYTHON_CFLAGS) $(CFLAGS) -c $<
|
35
|
|
-
|
36
|
|
-python_const.o: python_const.c python_const.h
|
37
|
|
- $(CC) $(PYTHON_CFLAGS) $(CFLAGS) -c $<
|
|
22
|
+C_SOURCES=$(wildcard *.c)
|
|
23
|
+C_OBJS=$(patsubst %.c,%.o,$(C_SOURCES))
|
|
24
|
+HEADERS=$(wildcard *.h)
|
|
25
|
+ASM_SOURCES=$(wildcard *.asm)
|
|
26
|
+ASM_OBJS=$(patsubst %.asm,%.o,$(ASM_SOURCES))
|
|
27
|
+OBJS=$(ASM_OBJS) $(C_OBJS)
|
|
28
|
+LIB=pyrpn.so
|
38
|
29
|
|
39
|
|
-rpn_jit.o: rpn_jit.c rpn_jit.h rpn_parse.o rpn_lib.o
|
40
|
|
- $(CC) $(CFLAGS) -c $<
|
41
|
|
-
|
42
|
|
-rpn_parse.o: rpn_parse.c rpn_parse.h rpn_lib.o
|
43
|
|
- $(CC) $(CFLAGS) -c $<
|
44
|
|
-
|
45
|
|
-rpn_mutation.o: rpn_mutation.c rpn_mutation.h rpn_parse.o
|
46
|
|
- $(CC) $(CFLAGS) -c $<
|
47
|
|
-
|
48
|
|
-rpn_if.o: rpn_if.c rpn_if.h rpn_jit.o
|
49
|
|
- $(CC) $(CFLAGS) -c $<
|
50
|
|
-
|
51
|
|
-rpn_if_default.o: rpn_if_default.c rpn_if_default.h rpn_if.o
|
52
|
|
- $(CC) $(CFLAGS) -c $<
|
|
30
|
+all: .deps pyrpn.so
|
53
|
31
|
|
54
|
|
-rpn_ifs.o: rpn_ifs.c rpn_ifs.h rpn_if.o
|
55
|
|
- $(CC) $(CFLAGS) -c $<
|
|
32
|
+$(C_OBJS): %.o: %.c $(HEADERS)
|
|
33
|
+ $(CC) $(PYTHON_CFLAGS) $(CFLAGS) -c -o $@ $<
|
56
|
34
|
|
57
|
|
-rpn_lib.o: rpn_lib.asm rpn_lib.h
|
|
35
|
+$(ASM_OBJS): %.o: %.asm $(HEADERS)
|
58
|
36
|
$(NASM) $(NASMCFLAGS) -o $@ $<
|
59
|
37
|
|
|
38
|
+$(LIB): $(OBJS)
|
|
39
|
+ $(LD) $(LDFLAGS) $(PYTHON_LDFLAGS) -o $@ $^
|
|
40
|
+
|
60
|
41
|
# Doxygen documentation
|
61
|
42
|
doc: doc/.doxygen.stamp
|
62
|
43
|
|
|
@@ -77,17 +58,19 @@ doc/.doxygen.stamp: $(wildcard *.c) $(wildcard *.h) Doxyfile
|
77
|
58
|
|
78
|
59
|
checks: runtest unittest benchmark
|
79
|
60
|
|
80
|
|
-benchmark: pyrpn.so
|
81
|
|
- PYTHONPATH=`pwd` $(PYTHON) tests/benchmark.py 0x200 0x3000
|
|
61
|
+benchmark: $(LIB)
|
|
62
|
+ PYTHONPATH=`pwd` $(PYTHON) tests/benchmark.py 0x500 0x2000; \
|
|
63
|
+ PYTHONPATH=`pwd` $(PYTHON) tests/benchmark.py 0x500 0x4000;
|
|
64
|
+
|
82
|
65
|
|
83
|
|
-unittest: pyrpn.so
|
|
66
|
+unittest: $(LIB)
|
84
|
67
|
PYTHONPATH=`pwd` $(PYTHON) -m unittest -v -f
|
85
|
68
|
|
86
|
69
|
runtest:
|
87
|
70
|
make -C tests
|
88
|
71
|
|
89
|
72
|
clean:
|
90
|
|
- -rm -fv *.o pyrpn.so test;\
|
|
73
|
+ -rm -fv $(OBJS) $(LIB) test;\
|
91
|
74
|
rm -fRv doc/.doxygen.stamp doc/* Doxyfile;\
|
92
|
75
|
make -C tests clean
|
93
|
76
|
|