I am working with CUDA and I am currently using this makefile to automate my build process. However, there are multiple --compiler-options, basically one for each flag I want to pass to gcc.How can I avoid repeating it over and over?(Any suggestion about improving my makefile is also really welcome)CC=nvccLIBS=-lmCFLAGS=-Wno-deprecated-gpu-targets --compiler-options -Wextra --compiler-options -Wall --compiler-options -O3 --compiler-options -Wno-unused-result --compiler-options -Wno-unused-parameterall:    mainmain:   main.o    $(CC) $(CFLAGS) $(LIBS) main.o -o mainmain.o: main.cu    $(CC) $(CFLAGS) $(LIBS) -c main.cu -o main.oclean:    rm -f *.o main
Avoid --compiler-options in makefile using nvcc
makefile;cuda
As mentioned in the comments, define two macros:COMPILER_OPTIONS := -Wextra -Wall -O3 -Wno-unused-result -Wno-unused-parametersCUDA_COMPILER_OPTIONS := $(foreach option, $(COMPILER_OPTIONS), --compiler-option $(option))C in CFLAGS stands for compiler, and should contain only the compile phase options. Don't send CFLAGS to the linker, it is surely not interested in, say, -Wall. Conventionally the link phase options are passed in LDFLAGS.I am surprised that    $(CC) $(CFLAGS) $(LIBS) main.o -o maindid pick the math library. The linker processes the command line once and sequentially. As written, there is no undefined symbols lm could resolve by the time it is processed. The bulletproof way is to specify libraries after objects:    $(CC) $(CFLAGS) main.o -o main $(LIBS)Nitpick. CC is conventionally assumed to produce .o from .c. Since your source is .cu I recommend to alias nvcc to something else. NVCC perhaps.