1

I'd like to create a makefile rule to run astyle on any writable source files. Currently, I have a rule like the following:

style:
  find . -perm -200 -regex ".*[.][CHch]p*" -exec astyle --suffix=none --style=ansi --convert-tabs "{}" \;

This rule basically works but doesn't seem to be the make way of doing things.

brianegge
  • 29,240
  • 13
  • 74
  • 99
  • I don't think you can do much better. To do a regex search you'd have to delegate to the shell and `sed` or something, which wouldn't be an improvement. – Beta Sep 06 '11 at 16:09

1 Answers1

1

Assuming you have a list of source files (or can create them with the shell function), something like:

style : $(SOURCES:.cpp=.astyle-check-stamp)
    astyle $(ASTYLEFLAGS) $< && touch $@

would be the make-style. It would re-check each changed source file with astyle and skipped already checked files.

thiton
  • 35,651
  • 4
  • 70
  • 100