-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
68 lines (47 loc) · 1.58 KB
/
Makefile
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
# SPDX-FileCopyrightText: 2024 René Hiemstra <[email protected]>
# SPDX-FileCopyrightText: 2024 Torsten Keßler <[email protected]>
#
# SPDX-License-Identifier: CC0-1.0
uname_s := $(shell uname -s)
ifeq ($(uname_s),Linux)
dyn := so
else ifeq ($(uname_s),Darwin)
dyn := dylib
else
$(error Unsupported build environment!)
endif
CFLAGS=-O2 -march=native -fPIC
all: libexport.$(dyn) libtinymt.$(dyn) libpcg.$(dyn) libhash.$(dyn)
libhash.$(dyn): hashmap.o
$(CC) -fPIC -shared $^ -o $@
hashmap.o: hashmap/hashmap.c hashmap/hashmap.h
$(CC) $(CFLAGS) $< -c -o $@
libexport.$(dyn): export.o
$(CC) -fPIC -shared $^ -o $@
export.o: export.t export_decl.t
terra export.t
libtinymt.$(dyn): tinymt32.o tinymt64.o
$(CC) -fPIC -shared $^ -o $@
tinymt32.o: tinymt/tinymt32.c
$(CC) $(CFLAGS) $^ -c -o $@
tinymt64.o: tinymt/tinymt64.c
$(CC) $(CFLAGS) $^ -c -o $@
FILE= pcg-advance-8.c pcg-advance-16.c pcg-advance-32.c pcg-advance-64.c \
pcg-advance-128.c pcg-output-8.c pcg-output-16.c pcg-output-32.c \
pcg-output-64.c pcg-output-128.c pcg-rngs-8.c pcg-rngs-16.c \
pcg-rngs-32.c pcg-rngs-64.c pcg-rngs-128.c \
pcg-global-32.c pcg-global-64.c
SRC=$(patsubst %.c, pcg/%.c, $(FILE))
OBJ=$(patsubst %.c, %.o, $(FILE))
libpcg.$(dyn): $(OBJ)
$(CC) -fPIC -shared $^ -o $@
$(OBJ): %.o: pcg/%.c
$(CC) $(CFLAGS) $^ -c -o $@
test: libexport.$(dyn) libtinymt.$(dyn) libpcg.$(dyn)
terra import.t
terra test_random.t
.PHONY: clean realclean
clean:
$(RM) export.o tinymt32.o tinymt64.o $(OBJ)
realclean: clean
$(RM) libexport.$(dyn) libtinymt.$(dyn) libpcg.$(dyn)