Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Makefile: Initialise Makefile #11

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

WIP: Makefile: Initialise Makefile #11

wants to merge 4 commits into from

Conversation

iammarco11
Copy link
Contributor

fixes #1 and #7.

Making it WIP because I don't know if it is the perfect way to do things :P

Makefile Outdated Show resolved Hide resolved
Makefile Outdated Show resolved Hide resolved
Makefile Outdated Show resolved Hide resolved
@Aniketh01
Copy link
Member

Looks a good start. No worries if you don't know the proper way. We only learn by doing and most importantly, by making mistakes. That is totally acceptable. But there should be progress at the end of the day :)

This commit does
- Initialise makefile and uses targets to be made
- Separate variables for source files, directories and common compiler
This commit does:
- When make print-VARIABLE
- It returns the VARIABLE = the_value_of_the_variable
Makefile Outdated
Comment on lines 18 to 22
dir:
if [ ! -d "$(TARGET_DIR)" ]; then \
mkdir -p $(TARGET_DIR); \
fi

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently looks like a patchy work while redundantly using dir variable everywhere. Can we by default make dir the bin folder is created every time the make command is run no matter what binary we want to prepare?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not getting it, do you know how to? I read in stackoverflow, thats how I did the patchy work.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The check you do to see if that particular directory is there or not and to create the directory, can't it be written such a way that those particular set of code executes even if 'make dir' is not provided?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can't it be written such a way that those particular set of code executes even if 'make dir' is not provided?

Well the the dir is made even if we give make player and not make dir everytime because I put dir as a prerequisite to every other target file in all the rules. I agree it is patchy and redundant putting dir everywhere as a prerequisite, but I haven't come across a better solution. I will need to dig more on that then, but if you know please let me know :)

This commit does
- Adds a rule clean which will remove the output directory
@iammarco11 iammarco11 requested a review from Aniketh01 August 22, 2020 01:01
Comment on lines +14 to +18
$(shell mkdir -p $(TARGET_DIR))

.PHONY: all

all: player tcp_player tcp_server transcoder
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better than this would be to check if the target_dir is present or not in all. If it is not present create one and move forward. If it is present move forward.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well I quite didn't understand you, did you mean putting target_dir as a pre requisite for all and add the mkdir as a recipe for the all. If that's what you meant, make player won't create the directory.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Makefile: Refactor how the compilation takes place
2 participants