Created
July 10, 2022 03:15
-
-
Save iPAS/786706e81d5ea50e4b5c415425616279 to your computer and use it in GitHub Desktop.
Makefile to compile .cpp to binary and assembly code.
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
# The build target | |
TARGET = assignment1 | |
# the compiler: gcc for C program, define as g++ for C++ | |
CC = clang++ | |
# compiler flags: | |
# -g - this flag adds debugging information to the executable file | |
# -Wall - this flag is used to turn on most compiler warnings | |
CFLAGS = -g -Wall | |
.PHONY: all run clean | |
$(TARGET): $(TARGET).cpp | |
$(CC) $(CFLAGS) -S -o $(TARGET).s $(TARGET).cpp | |
$(CC) $(CFLAGS) -o $(TARGET) $(TARGET).cpp | |
all: $(TARGET) | |
run: all | |
./$(TARGET) | |
clean: | |
rm -rf $(TARGET) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment