-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
69 lines (55 loc) · 1.54 KB
/
Makefile
File metadata and controls
69 lines (55 loc) · 1.54 KB
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
CC=cc
SILENCE = -Wno-unused-variable
INCLUDES =
LIBRARIES = -L. -lm
CFLAGS= -fPIC $(SILENCE) -Wall -Wextra -Wsign-conversion -g -O3
CFLAGS += $(INCLUDES)
LDFLAGS= -Wl,-rpath,.
# if we are compiling towards CUDA or Host, we alter our flags accordingly
ifeq ($(CC),nvcc)
# treat files as CU, treat files as device-code-relocatable (dc)
NVCCFLAGS += -x=cu -dc
CFLAGS := $(NVCCFLAGS) --compiler-options '$(CFLAGS) ' -g -O3 --use_fast_math
LDFLAGS := --compiler-options '-fPIC ' -Xcompiler \"$(LDFLAGS)\"
INCLUDES += -I/usr/local/cuda/include
else
CFLAGS += -std=gnu99 -pedantic
LDFLAGS += $(CFLAGS)
endif
all: unpack cuOrbit.x
# alternatively you can yourself just invoke: make CC=nvcc
gpu:
$(MAKE) all CC=nvcc
%.o: %.c *.h
$(CC) $(CFLAGS) $(INCLUDES) -c $< -o $@
## We don't currently need, but maybe one day if you add CUDA only optimizations
%.o: %.cu *.h
$(NVCC) -x cu -dc $(NVCCLDFLAGS) $(NVCCFLAGS) $(INCLUDES) -c $< -o $@
libcuorbit.so: inih/ini.o \
orbit_config.o \
orbit_deposition.o \
orbit_equilibrium.o \
orbit_main.o \
orbit_particles.o \
orbit_perturbation.o \
orbit_util.o \
cuda_helpers.o
$(CC) -shared $(LDFLAGS) $^ -o $@
cuOrbit.x: cuOrbit.o libcuorbit.so
$(CC) $(LDFLAGS) $< -o $@ -lcuorbit $(LIBRARIES)
GZREFERENCES = reference_test_case/displ_4_5.dat \
reference_test_case/spdata \
INPUT/spdata \
unpack: $(GZREFERENCES)
%: %.gz
gunzip -c $< > $@
clean:
-rm -f inih/*.o
-rm -f *.o
-rm -f libcuorbit.so
-rm -f cuOrbit.x
-rm -rf cuOrbit.x.dSYM
-rm -f $(GZREFERENCES)
.PHONY: all
.PHONY: clean
.PHONY: unpack