Make Dependencies & Sequences

Summary

  1. Using Dependencies on Make.
  2. Make: sequences

Session

Please @AirCrewMentor check this post to see if I got the process right. Any tuto for make that I could follow?

1. Using Dependencies on Make.

We created Dependencies so make can keep track of the files that are being modified and act only at the ones that have been modified.

In this example, when we run Make dist the order followed would be this:

  1. Go to dist/ and it would create the dir and it would copy from public/ all the files that were modified, this is what public dependencies specifies.
  2. dist/js/main.browserify it would be run only if on of the files on the Browserfy Dependencies has been modified.

BROWSERIFY_DEPENDENCIES = $(wildcard lib/*.js package.json node_modules/*/package.json)
PUBLIC_DEPENDENCIES = $(wildcard public/**)

dist: dist/js/main.browserify.js

dist/js/main.browserify.js: dist/ $(BROWSERIFY_DEPENDENCIES)
echo "Generating browserify file…"
browserify lib/index.js > dist/js/main.browserify.js
echo "Done!"
dist/: $(PUBLIC_DEPENDENCIES)
mkdir -p dist
cp -av public/* dist/

2. Make: sequences

Since the commands with slashes doesn’t appear on bash when tabbing with make written, we create a dist: dist/js/main.browserify.js that will concatenate all the commands with their dependencies.

At dist/js/main.browserify.js: dist/ $(BROWSERIFY_DEPENDENCIES) before running the proper commands it would run the dist/ command, later will check the BROWSERIFY_DEPENDENCIES and proceed with its commands.

Homework.

  • Back to the code.
  • Show some work
Thanks for everything @AirCrewMentor like always it is amazing learning something new every session.
Advertisements

2 thoughts on “Make Dependencies & Sequences

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s