kokke / tiny-regex-c

Small portable regex in C
The Unlicense
1.24k stars 174 forks source link

improve Makefile #65

Open marler8997 opened 3 years ago

marler8997 commented 3 years ago

Here are a list of the improvements done to the Makefile.

  1. allow tests to be built and run individually from the command-line:

Examples of building individual tests:

make bin/test1
make bin/test2
...

Running individual tests:

make test1
make test2
make test_compile
make test_rand
make test_rand_neg

# note: you can still run all the tests with
make test
  1. Because building and running the tests are now in their own rules, the user can run them in parallel:

Build everything in parallel with 5 threads:

make -j5

Build and run everything with 5 threads:

make -j5 test
  1. Moved all outputs to the "bin" directory

This simplifies the code in the "clean" target to 1 command. It also simplifies the .gitignore file and makes it easy for developers to distinguish between output files and source files.

This also means we don't need an odd rule in .gitignore that means new files in test will be ignored by default, which means if a new file is added to test then the programmer must run git add -f test/file and git status also doesn't notify them if they forgot to do this.

  1. Added re.c as a dependency to all the tests

Now if the user modifies re.c, all the tests will see that they need to be rebuilt.