Created
February 10, 2021 02:56
-
-
Save jayzhan211/cdfcf84465405d3316dfe0e72f53d769 to your computer and use it in GitHub Desktop.
Makefile for one cpp file
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
TARGET = main | |
CXXFLAGS = -g -std=c++17 -O2 | |
OBJS = ${TARGET}.o | |
main: ${OBJS} | |
${CXX} ${CXXFLAGS} $< -o $@ | |
%.o : %.cpp | |
${CXX} -c ${CXXFLAGS} $< -o $@ | |
.PHONY: clean | |
clean: | |
${RM} *.o *~ ${TARGET} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
prerequisite: cpp file name is main.cpp
make
to compilemake clean
to remove output files