-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
43 lines (31 loc) · 892 Bytes
/
Copy pathMakefile
File metadata and controls
43 lines (31 loc) · 892 Bytes
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
# Compiler and flags
CC := gcc
NVCC := nvcc
INCDIR := src
CFLAGS := -Wall -Wextra -O2 -I./$(INCDIR)
NVCCFLAGS := -O2 -I./$(INCDIR) -Xcompiler "-Wall,-Wextra" -rdc=true
# Linker flags and libraries
LDFLAGS := -lm
# Target and sources
TARGET := fractaline
SRCDIR := src
SRCS := main.c $(filter-out $(SRCDIR)/fractal.c, $(wildcard $(SRCDIR)/*.c))
CU_SRCS := $(wildcard $(SRCDIR)/*.cu)
OBJS := $(SRCS:.c=.o)
CU_OBJS := $(CU_SRCS:.cu=.o)
AUTOGEN_COLORMAP := colormap_autogen.h
# Build rules
all: $(TARGET)
colormap: $(AUTOGEN_COLORMAP)
$(AUTOGEN_COLORMAP): gen_colormap.py
python3 gen_colormap.py $(AUTOGEN_COLORMAP)
main.o: main.c $(AUTOGEN_COLORMAP)
$(TARGET): $(OBJS) $(CU_OBJS)
$(NVCC) $(NVCCFLAGS) -o $@ $^ $(LDFLAGS)
%.o: %.c
$(CC) $(CFLAGS) -c $< -o $@
%.o: %.cu
$(NVCC) $(NVCCFLAGS) -c $< -o $@
clean:
rm -f $(OBJS) $(CU_OBJS) $(TARGET)
.PHONY: all clean