Write a Makefile for a C program
called flip which converts the line-ending characters on plain text
files from MS-DOS conventions (CR-LF pairs) to UNIX conventions (LF
only) and vice versa.
The following source files for flip are available in and ~perugini_cps356/share/compiling/make/flip/flip.tar and ~perugini_cps444/share/compiling/make/flip/flip.tar:
flip.1 flip.c flip.h getopt.cOnce you copy flip.tar to your account, you can untar it with the tar xvf flip.tar command line.
Your Makefile must include target directives for every derived file produced during the compilation process (i.e., each program, each object file, and any other intermediate files produced during compilation). Make sure that each directive also lists all files that the derived file depends on in its dependency list.
The steps in compiling flip are:
gcc -DBSD -DNDEBUG -O -c flip.c gcc -DBSD -DNDEBUG -O -c getopt.c gcc -s -o flip flip.o getopt.oYour Makefile must be written so that make flip carries out these commands, only if necessary. Each command above generates a separate derived file, and so must be placed in a separate directive. You'll need to individually examine each source file to build your dependency lists. In addition, your Makefile must be written so that make man carries out the following command, again, only if necessary:
nroff -man flip.1 > flip.manThe flip.1 file is the source file for the command's manpage. nroff is a program that formats the text of the manpage. The command shown above formats the manpage into a human-readable form and places the output in the file flip.man.
Your Makefile must be written so that when make is invoked with no target specified on the command line, it carries out both sets of commands listed above, only if necessary, bringing everything (both the program and its formatted manpage) up-to-date. Finally, your Makefile must have both an all and a clean directive to remove all generated files. Use variables where appropriate in your Makefile to improve its readability, and use descriptive comments to clarify your intentions wherever necessary. You may find it helpful to use the touch command and the -n option to make to help debug your Makefile.