User Tools

Site Tools


programming:make:custom_rules

Programming - Make - Custom Rules

Default rule

hello : hello.c
  gcc -g -O hello.c

% : %.c
  $(CC) $(CPPFLAGS) $(CFLAGS) $< -o $@

NOTE:

  • The % (percent signs) match anything.
  • The $< gets the name of the first (and in this case, only) prerequisite which is hello.c.
  • The $@ variable gives you the name of the target (hello, for this example).

There are many more variables available.


programming/make/custom_rules.txt · Last modified: 2021/02/04 14:49 by peter

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki