1.In your ubuntu, open course website (https://github.com/syracuse-fullstacksecu
ID: 3807608 • Letter: 1
Question
1.In your ubuntu, open course website (https://github.com/syracuse-fullstacksecurity/cis342) (e.g. using Firefox) and hit the green "Clone or download" button to download all the files into a .zip file. Extract the zip file and use the following command to compile `h2.c` as a library: `gcc -c h2.c -o liby.a`. Edit the file named "makefile" and add a new rule about the command. You may use `compilelib` as its label. And then type "make compilelib" to compile `h2.c` as a library. Submit the screenshot.
Attach File
2.We can compile `h1.c` and link it to the library we just created using command `gcc -o a.out h1.c -L. -ly`. Add this command to the makefile with a new rule named `liblink`. What argument do you provide to "make" so that it can link the library liby. Provide a screenshot of making the program.
Explanation / Answer
SRCS = h1.c h2.c
OBJS = $(SRCS:.c=.o)
OBJS = h1.o h2.o
CC = gcc
all: link
./a.out
link: $(OBJS)
$(CC) $(OBJS)
liblink: compilelib
gcc -o a.out h1.c -L. -ly
compilelib:
gcc -c h2.c -o liby.a
clean:
rm *.o *.out *.a
make liblink
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.