1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# This is the makefile for fill_array

# you are free to copy/adapt from this file

#<target>: <dependencies>
#   <command>
#   <command>

# compiles our executable test_fill_array using object files
# runs the linker step of compiling
test_fill_array: test_fill_array.o fill_array.o
    gcc test_fill_array.o fill_array.o -o test_fill_array

# compiles fill_array.c into an object file
# runs the preprocessor and the compiler steps of compiling
fill_array.o: fill_array.c
    gcc -c fill_array.c

# compiles test_fill_array.c into an object file
#fill_array.o: fill_array.c
#   gcc -c fill_array.c

# This rule compiles test_fill_array.o using assert testing
# Since miniunit code was not provided in lecture
# comment out this rule and uncomment the above if you want
# to compile with your makefile
test_fill_array.o: test_fill_array_assert_testing.c
    gcc -c test_fill_array_assert_testing.c -o test_fill_array.o

# compiles test_fill_array then runs it
run: test_fill_array
    ./test_fill_array

# removes all files produced by this makefile
clean:
    rm -f *.o
    rm -f test_fill_array

# prints out Hello
# because sometimes we need a computer to tell us hello
hello:
    echo "Hello"

.PHONY: clean hello run

© Copyright 2022 Alexander J. Quinn         This content is protected and may not be shared, uploaded, or distributed.