vurhopper.blogg.se

Write simple makefile for c program
Write simple makefile for c program









write simple makefile for c program

  • Commit (with a reasonable commit message!).
  • And, we don't want the executable under version control, for reasons discussed in class.
  • No need to add the file here - hello.c is already under version control.
  • Get version control status (to see what files have been modified - hopefully only hello.c and the program executable).
  • Warning: Don't check in the compiled program or any of the intermediary object files This tells GCC to take the hello.c input file and preprocess+compile+assemble+link it into an executable file with the name hello_program.Ĭongrats, you're now an expert! Looks pretty easy, right?Īfter your program runs, you should commit your source code to your personal repository: (GCC stands for the "GNU Project C and C++ Compiler") unix> gcc hello.c -o hello_program Printf("Hallo, welt!\n") /* German for "hello, world" */Ĭompile it and run using GCC, an open-source compiler. Use gedit to edit the file hello.c: unix> gedit hello.c &Įnter the following "Hello World" program written in the C programming language, and save it when finished. Launch your favorite Linux text editor - gedit is the default for this class. Now, enter the subdirectory for lab03/part1: unix> cd lab03/part1 Push the new commit to the website unix> hg pushįirst, ensure you are in your personal repository. (Technically, part1/part2/part3 are directories, but Mercurial is smart enough to just add all the files in these directories with this command) unix> hg add part1 part2 part3Ĭommit the new files in your personal repository, so you can easily go back to the original starter code if necessary unix> hg commit -m "Starting Lab 3 with boilerplate code" Unix> cp -R ~/bitbucket/2015_fall_ecpe170_boilerplate/lab03/part3 ~/bitbucket/2015_fall_ecpe170/lab03Įnter your private repository now, specifically the lab03 folder: unix> cd ~/bitbucket/2015_fall_ecpe170/lab03Īdd the new files to version control in your private repository: (In this case, there are three folders you want) unix> cp -R ~/bitbucket/2015_fall_ecpe170_boilerplate/lab03/part1 ~/bitbucket/2015_fall_ecpe170/lab03 Pull the latest version of the repository, and update your local copy of it: unix> hg pullĬopy the files you want from the class repository to your private repository: Log onto Linux and open a command prompt.Įnter the class repository: unix> cd ~/bitbucket/2015_fall_ecpe170_boilerplate/ To begin this lab, start by obtaining the necessary boilerplate code. This lab will give you hands-on experience with the C programming language, the development toolchain (pre-processor, compiler, assembler, linker), and automating the compilation process using Makefiles.











    Write simple makefile for c program