-
Notifications
You must be signed in to change notification settings - Fork 17
/
hob3lop.mk
134 lines (103 loc) · 3.45 KB
/
hob3lop.mk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
# -*- Mode: Makefile -*-
# Copyright (C) 2018-2024 by Henrik Theiling, License: GPLv3, see LICENSE file
H_hob3lop := $(notdir $(wildcard include/hob3lop/*.h))
######################################################################
# Integer Algorithms:
MOD_C.libhob3lop.a := \
hob3lop/hedron.c \
hob3lop/gon.c \
hob3lop/op-def.c \
hob3lop/matq.c \
hob3lop/op-slice.c \
hob3lop/op-poly.c \
hob3lop/op-trianglify.c \
hob3lop/op-sweep.c \
hob3lop/op-sweep-trace.c \
hob3lop/op-sweep-reduce.c
ifeq ($(PSTRACE),1)
MOD_C.libhob3lop.a += \
hob3lop/op-ps.c
endif
MOD_O.libhob3lop.a := $(addprefix out/bin/,$(MOD_C.libhob3lop.a:.c=.o))
MOD_D.libhob3lop.a := $(addprefix out/bin/,$(MOD_C.libhob3lop.a:.c=.d))
######################################################################
# Int Test Executable:
MOD_C.hob3lop-test.x := \
hob3lop/hob3lop-test.c
MOD_O.hob3lop-test.x := $(addprefix out/bin/,$(MOD_C.hob3lop-test.x:.c=.o))
MOD_D.hob3lop-test.x := $(addprefix out/bin/,$(MOD_C.hob3lop-test.x:.c=.d))
LIB.hob3lop-test.x := \
hob3lop \
hob3lbase \
hob3lmat
LIB_A.hob3lop-test.x := \
$(addsuffix $(_LIB), \
$(addprefix out/bin/$(LIB_), $(LIB.hob3lop-test.x)))
LIB_L.hob3lop-test.x := $(addprefix -l, $(LIB.hob3lop-test.x))
######################################################################
_ := $(shell mkdir -p out/bin/hob3lop)
_ := $(shell mkdir -p out/test/hob3lop)
_ := $(shell mkdir -p out/src/hob3lop)
-include out/bin/hob3lop/*.d
all: \
out/bin/$(LIB_)hob3lop$(_LIB) \
out/bin/hob3lop-test.x
lib: $(LIB_A.hob3lop-test.x)
sweep: sweep-hob3lop
.PHONY: sweep-hob3lop
sweep-hob3lop:
rm -f src/hob3lop/*~
rm -f src/hob3lop/*.bak
rm -f include/*~
rm -f include/*.bak
rm -f include/hob3lop/*~
rm -f include/hob3lop/*.bak
out/bin/$(LIB_)hob3lop$(_LIB): $(MOD_O.libhob3lop.a)
$(AR) cr [email protected]$(_LIB) $+
$(RANLIB) [email protected]$(_LIB)
mv [email protected]$(_LIB) $@
out/bin/hob3lop-test.x: \
$(MOD_O.hob3lop-test.x) \
$(LIB_A.hob3lop-test.x)
$(CC) -o $@ $(MOD_O.hob3lop-test.x) \
-Lout/bin $(LIB_L.hob3lop-test.x) \
$(LIBS) -lm $(CFLAGS)
out/bin/hob3lop/hob3lop-test.o: CPPFLAGS += -Iout/src/hob3lop
unit-test: unit-test-hobl3op
.PHONY: test-hob3lop
test-hob3lop: unit-test-hobl3op
.PHONY: test-op
test-op: unit-test-hobl3op
.PHONY: unit-test-hobl3op
unit-test-hobl3op: out/bin/hob3lop-test.x
./out/bin/hob3lop-test.x
######################################################################
# installation, the usual ceremony.
installdirs-lib: installdirs-lib-hob3lop
installdirs-lib-hob3lop:
$(NORMAL_INSTALL)
$(MKINSTALLDIR) $(DESTDIR)$(libdir)
installdirs-include: installdirs-include-hob3lop
installdirs-include-hob3lop:
$(NORMAL_INSTALL)
$(MKINSTALLDIR) $(DESTDIR)$(includedir)/hob3lop
install-lib: install-lib-hob3lop
install-lib-hob3lop: installdirs-lib-hob3lop
$(NORMAL_INSTALL)
$(INSTALL_DATA) out/bin/$(LIB_)hob3lop$(_LIB) $(DESTDIR)$(libdir)/$(LIB_)hob3lop$(_LIB)
install-include: install-include-hob3lop
install-include-hob3lop: installdirs-include-hob3lop
$(NORMAL_INSTALL)
for H in $(H_hob3lop); do \
$(INSTALL_DATA) \
include/hob3lop/$$H \
$(DESTDIR)$(includedir)/hob3lop/$$H || exit 1; \
done
uninstall: uninstall-hob3lop
uninstall-hob3lop:
$(NORMAL_UNINSTALL)
$(UNINSTALL) $(DESTDIR)$(libdir)/$(LIB_)hob3lop$(_LIB)
for H in $(H_hob3lop); do \
$(UNINSTALL) $(DESTDIR)$(includedir)/hob3lop/$$H || exit 1; \
done
$(UNINSTALL_DIR) $(DESTDIR)$(includedir)/hob3lop