2021-09-18

HW1 Clarifications.

This is Prof. Pollett's response to some of my questions that he asked me to post here.
1. When you say that test1, test2, and test3 depend on sub-targets, are you referring to preprocesstest1, compiletest1, assembletest1, and linktest1 as the sub-targets?
> Yes.
2. I think I understand that for preprocesstest1, we can input 'gcc -E test1.c' to get the result of just the preprocessor. However, how do we use this result with the -S flag to compile the result to assembly? When I ran 'gcc -S test1.c', I don't think anything happened.
> You should specify a filename for the output (-o) of gcc -E test1.c such as after_pre_test1.c. Then use this file for the next step, etc. If you look after the preprocessor step, the preprocessor instructions (#something) should be replaced.
3. What is the as command you refer to for assembletest1?
> Generally, in *nix (Unix, Linux, Macos, BSD), if you want to know about blah, type: man blah ‘as' is the command to assemble a file from assembly language to machine code.
4. What is 1d and how do we use that for linktest1?
> See above. 'ld' is the command to link together several object code file.
5. Is it intentional that you only want us to 'make compiletest1' and not, for example, 'make preprocesstest1' or 'make linktest1'?
> In making compiletest1, it should automatically make those other targets and goals.
(Edited: 2021-09-18)
This is Prof. Pollett's response to some of my questions that he asked me to post here. 1. When you say that test1, test2, and test3 depend on sub-targets, are you referring to preprocesstest1, compiletest1, assembletest1, and linktest1 as the sub-targets? > Yes. 2. I think I understand that for preprocesstest1, we can input 'gcc -E test1.c' to get the result of just the preprocessor. However, how do we use this result with the -S flag to compile the result to assembly? When I ran 'gcc -S test1.c', I don't think anything happened. > You should specify a filename for the output (-o) of gcc -E test1.c such as after_pre_test1.c. Then use this file for the next step, etc. If you look after the preprocessor step, the preprocessor instructions (#something) should be replaced. 3. What is the as command you refer to for assembletest1? > Generally, in *nix (Unix, Linux, Macos, BSD), if you want to know about blah, type: man blah ‘as' is the command to assemble a file from assembly language to machine code. 4. What is 1d and how do we use that for linktest1? > See above. 'ld' is the command to link together several object code file. 5. Is it intentional that you only want us to 'make compiletest1' and not, for example, 'make preprocesstest1' or 'make linktest1'? > In making compiletest1, it should automatically make those other targets and goals.
X