This repository has been archived by the owner. It is now read-only.
Open in github.dev
Open in a new github.dev tab
Permalink
Cannot retrieve contributors at this time
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
39 lines (26 sloc)
891 Bytes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PROJECT_NAME = game_of_life | |
# NVCC is path to nvcc. Here it is assumed /usr/local/cuda is on one's PATH. | |
# CC is the compiler for C++ host code. | |
NVCC = nvcc | |
CC = clang | |
CUDAPATH = /usr/local/cuda | |
BUILD_DIR = build | |
# note that nvcc defaults to 32-bit architecture. thus, force C/LFLAGS to comply. | |
# you could also force nvcc to compile 64-bit with -m64 flag. (and remove -m32 instances) | |
CFLAGS = -c -m32 -I$(CUDAPATH)/include | |
NVCCFLAGS = -c -I$(CUDAPATH)/include | |
# this is mac only. only linux system, remove -Xlinker and add in -lGL -lGLUT? | |
LFLAGS = -m32 -L$(CUDAPATH)/lib -lcuda -lcudart -lm -Xlinker -framework,OpenGL,-framework,GLUT | |
all: build clean | |
build: build_dir gpu cpu | |
$(NVCC) $(LFLAGS) -o $(BUILD_DIR)/$(PROJECT_NAME) *.o | |
build_dir: | |
mkdir -p $(BUILD_DIR) | |
gpu: | |
$(NVCC) $(NVCCFLAGS) *.cu | |
cpu: | |
$(CC) $(CFLAGS) *.c | |
clean: | |
rm *.o | |
run: | |
./$(BUILD_DIR)/$(PROJECT_NAME) |