Makefile

This is quite note for Makefile, explaining how to make a sample Makefile that could automate some of the repetitive actions that you carry throught your codes and projects.


# A sample Makefile look like this

target_name: <any optional dependencies that this target depends on>
    
    action_a
    action_b
    action_n

# This means that the <target_name> is to be carried and do not rely on other stuffs
.PHONY: target_name
target_name:
    action_a
    action_b
    action_n

NOTE: special notation requires when you need to access other variables through $ or evaluating bash expression like $()

And that is you need a second $ like or use the make’s built-in shell: - docker container rm $$(docker ps -aq) -f and NOT docker container rm $(docker ps -aq) -f + So you likely see this when you believe your command is correct but you see an error like: requires at least 1 argument.

And the second usage is to prepend the command at stake with Make’s shell builtin