Lazy Way of making a Simple C++ Project

---
date: Apr 17, 2017
tags:
- C++
- Makefile
language: English
---
This post is more than 6 years old. If this is a technical post, the post will most likely not working, but feel free to try it and see if it works.

Sometimes, when I try to do a lab project, I have to copy the makefile from each previous project to make my life easier and more lazy. However, I think I should be more lazy-so what I do is modified my Makefile a little bit, so that it can be easier, that I don’t really need to modify the code any more, I just need to copy makefile and build my project ;)

Here is the code for my makefile, it is actually pretty simple:

1
2
3
4
5
6
7
TARGET=$(shell basename $(PWD))
create:
g++ -g -o $(TARGET) *.cpp *.h

clean:
/bin/rm -f $(TARGET)
clear

Comments

Navigation