Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from olin/add-structure
Add a basic project structure
- Loading branch information
Showing
3 changed files
with
424 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
## Project-Related | ||
*.out | ||
|
||
## C-Related | ||
*.o | ||
*.a | ||
*.lib |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
CC=gcc | ||
CFLAGS+=-Wall | ||
# global includes | ||
# LDFLAGS+= | ||
|
||
# add debug annotations, turn off optimizations, and #define DEBUG | ||
# use in bash with `DEBUG=1 make <foo>` | ||
# use in fish with `env DEBUG=1 make <foo>` | ||
ifdef DEBUG | ||
CFLAGS+=-g -O0 -DDEBUG | ||
endif | ||
|
||
# link ncurses library | ||
# foo: LDFLAGS+=-lncurses | ||
|
||
# **GNU Make only** run all test files (any file ending in _test.c) | ||
# turns each `foo_test.c` into `.run-foo_test.c` with "Text Functions" | ||
test: $(patsubst %.c, .run-%.c, $(wildcard *_test.c)) | ||
|
||
# run a single file | ||
# given `.run-foo.c`, requires `foo.c` and runs `./foo` | ||
.run-%.c: % | ||
./$< | ||
|
||
# add flags for minunit libraries, works with `make test_foo` too | ||
%_test: LDFLAGS+=-lrt -lm | ||
%_test: %_test.c minunit.h | ||
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ | ||
|
||
clean: | ||
-rm *.o *_test |
Oops, something went wrong.