I want to compress javascript in yui compressor, How to write Make file for compress javascript.
Because grammar is difficult and does not understand it, Could you give me a sample Makefile for me?
I want to compress javascript in yui compressor, How to write Make file for compress javascript.
Because grammar is difficult and does not understand it, Could you give me a sample Makefile for me?
Copyright © 2021 Jogjafile Inc.
Your makefile would look something like
Note that the second line is indented with a tab character, not just spaces. The make utility cares about this.
code.compressed.jsis the name that the file should be written to,code.jsis the file to compress, andcompressoris the program doing the compression.The
-oflag indicates the output file, following the convention of compilers and similar tools. Yours may differ; check its documentation.The variable
$@is Makefile shorthand for "this rule's target",code.compressed.jsin this case. Similarly,$<is an abbreviation for "this rule's first dependency". These variables are useful so that you needn't repeat yourself, nor make duplicate changes when files get renamed.If you have multiple files that will all be compressed into a single output file, you can put them all on the dependency line, and then use the special variable
$^in the build rule to specify all of them:Alternately, if you want them each compressed separately, you can write a pattern rule and use it for all of them:
Make defaults to building the first target that it sees, which is
allin this case. The list of files to compress to is given by the contents of theTARGETvariable. The%is a wildcard that make will substitute to generate rules for matching source and target file names.