Skip to content

Commit

Permalink
Create naive makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
mmorella-dev committed Sep 21, 2020
1 parent 963673a commit efd56f6
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 4 deletions.
17 changes: 13 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,20 @@ This repository contains solutions to school-assigned homework and lab assignmen

## Execution

These programs were written to be compiled individually within an interactive terminal. While most of them are simple enough to be cross-compatible, they have only been tested in version 10 of the GNU compiler, using the GNU++17 dialect.
These programs were originally written to be compiled individually through an interactive terminal, specifically using g++-10. However, for convenience, I have created an extremely naive makefile which compiles every module into a separate executable in the `out` directory.

```sh
module_1> gcc --version
gcc-10 (Homebrew GCC 10.2.0) 10.2.0
bash$ make
# ... make output ...
bash$ ls out/
# ... list of executables ...
bash$ ./out/1_2_pyramid
8 6 4 2 0
6 4 2 0
4 2 0
2 0
0

module_1> g++ -std=gnu++17 **.cpp && ./a.out
$ make clean
rm -r ./out/
```
18 changes: 18 additions & 0 deletions makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
CC = g++
CFLAGS = -Wall
OUTDIR = ./out/

# naively compile all of the modules into separate files in the out directory

all:
mkdir -p $(OUTDIR)
$(CC) $(CFLAGS) -o $(OUTDIR)1_1_about_me module_1/ex_01.cpp
$(CC) $(CFLAGS) -o $(OUTDIR)1_2_pyramid module_1/ex_02.cpp
$(CC) $(CFLAGS) -o $(OUTDIR)2_bank_account module_2/*.cpp
$(CC) $(CFLAGS) -o $(OUTDIR)3_sequence_test module_3/*.cpp
$(CC) $(CFLAGS) -o $(OUTDIR)4_polynomial_exam module_4/{poly0,polyexam0}.cpp
$(CC) $(CFLAGS) -o $(OUTDIR)4_polynomial_test module_4/{poly0,polytest0}.cpp
$(CC) $(CFLAGS) -o $(OUTDIR)5_linked_list_demo module_5/*.cpp

clean:
rm -r $(OUTDIR)

0 comments on commit efd56f6

Please sign in to comment.