Created
November 5, 2018 20:08
-
-
Save sshravan/cea33008f36892699fcb81500b15c358 to your computer and use it in GitHub Desktop.
My sample Makefile
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
CXX=g++ | |
CXXFLAGS=-g -std=c++11 -Wall -Wextra -Wcast-align -pedantic | |
LDFLAGS := | |
SRC_DIR := src | |
OBJ_DIR := bin | |
SRC_FILES := $(wildcard $(SRC_DIR)/*.cpp) | |
OBJ_FILES := $(patsubst $(SRC_DIR)/%.cpp,$(OBJ_DIR)/%.o,$(SRC_FILES)) | |
$(OBJ_DIR)/%.o: $(SRC_DIR)/%.cpp | |
$(CXX) $(CXXFLAGS) -c -o $@ $< | |
dsl: $(OBJ_FILES) | |
$(CXX) $(LDFLAGS) -o $@ $^ | |
all: dsl | |
default: dsl | |
run: dsl | |
./dsl | |
clean: | |
rm -f $(OBJ_DIR)/*.o | |
rm -f dsl | |
.PHONY: clean |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment