高级Makefile编写

Makefile to be written • In the project7 directory you must write a makefile, which must be in a file named Makefile (with an uppercase ‘M’), that will build three executable programs program1.x, main.x, and tester.x (so it must have these three targets) from the three files program1.c, main.c, and tester.c and the other source files.

c/c++代写,java代写,python代写,matlab代写,作业代写,留学生作业代写

Makefile to be written • In the project7 directory you must write a makefile, which must be in a file named Makefile (with an uppercase ‘M’), that will build three executable programs program1.x, main.x, and tester.x (so it must have these three targets) from the three files program1.c, main.c, and tester.c and the other source files. By looking at what functions the main programs are calling, you should be able to see what object files have to be linked together to form each executable. By looking at the source files, you should be able to see what files have to depend on what other files in your makefile. • Your Makefile must also have a target all, which will build all three executable programs program1.x, main.x, and tester.x. It should be the first target, so either running just make, or make all, will build all three programs. • Note that an example makefile from lecture illustrated the correct way an all target should be written. • Your Makefile must use the six gcc compilation options -ansi, -pedantic-errors, -Wall, -Werror, -fstack-protector, and lastly -Wshadow, which were mentioned in the first project, to build object files. (But it should not use these options to create executable files.) • When we say that these options must be used it does not mean that all six of them have to be explicitly repeated in every invocation of gcc in your makefile; it can be done via a makefile macro, as long as the options are added to every command that is compiling a source file. (The reason the compilation options must be explicitly used in a makefile, even though they are enforced when you compile code on Grace via running gcc by hand, is as follows. The way that the compilation options are enforced when compiling code manually is via an alias for gcc that is added as a result of the account setup steps you made early in the semester. However, a makefile does not recognize shell aliases.) 2 • Your makefile must use separate compilation– each source file (e.g., fill-array.c) needed to form each of the three executable programs must be separately compiled, then the independent object files linkedtogether, to form the executable. (So your Makefile must also have additional targets for all object files. Note that there are six source files, so six object files should be created by your makefile.) • Your Makefile should not explicitly compile header files. • Your Makefile must also have a target named clean that will delete all of the compiler–generated files(the object and executable files) that are created by the compilation commands in your makefile. There are ten public tests for this project (and no secret tests). The actual tests are written in languages most students don’t know so they would be confusing, and not at all necessary to understand, in order to be able to write your Makefile, so we haven’t given you the actual tests. Instead we just describe here what they are testing, and below we explain how to test (before submitting) whether your Makefile passes the tests. 1. The first test tests whether your Makefile correctly builds main.x. 2. The second test tests whether your Makefile correctly builds program1.x. 3. The third test tests whether your Makefile correctly builds tester.x. 4. The fourth test tests whether your Makefile’s all target works and is in the correct place in your Makefile. 5. The fifth test tests whether your Makefile is using separate compilation everywhere. 6. The sixth test tests whether your Makefile is explicitly compiling header files, which should not be done. 7. The seventh test tests whether your Makefile’s clean target removes all compilergenerated (executable and object) files. 8. The eighth test tests whether your Makefile has any missing dependencies. 9. The ninth test tests whether your Makefile has any extra unnecessary dependencies. 3 10. The tenth test tests whether your Makefile is using the required compilation options for creating all object files. Note that there are some “stylistic” properties that may be checked manually in later projects where you have to write makefiles that the tests do not test for, for example whether your makefile has extra unnecessary dependencies, or is missing dependencies that it should have. There are also no output files for the tests. You will know that your makefile is correct if you can run the three commands make program1.x, make main.x, and make tester.x, and the three executable programs with those names are created (and if your makefile is following the requirements discussed above and below).

留学生作业代写,cs作业代写,cs代写,作业代写,北美cs作业代写,澳洲cs作业代写,加拿大cs作业代写,cs作业代写价格,靠谱cs作业代写,程序代写
WeChat