Creating a makefile

For the purpose of this tutorial, you were instructed to create a project which requires you to create a makefile.

To create a makefile:

  1. In the Project Explorer view, right-click the bitreverse project folder and select New > File.
  2. In the File name box, type makefile.
  3. Click Finish.
  4. Type the gnu make instructions below in the editor. Lines are indented with tab characters, not with spaces.
    all: bitreverse
    
    clean:
    	rm bitreverse.o bitreverse
    
    bitreverse: main.o
    	nvcc -o bitreverse $<
    
    main.o: main.cu
    	nvcc --compile -g -G -O0 -o main.o $<
  5. Click File > Save.

Your new makefile, along with your main.cu file are displayed in the Project Explorer view. Your project now contains main.cu and makefile. You can now build your bitreverse project.

Next icon Next: Building your project

Back icon Back: Creating your source file

Related concepts
Project
Code entry

Related tasks
Working with project files
Writing code

Related reference
Project Explorer view

IBM Copyright Statement