Lesson 11

Dates: 4/5/2017
Application compilation and installation on Linux
Linux System Administration


  • Utility make is used for compilation and installation of a software with many source files.
  • make keeps track with the dependencies and file access times tamps. Compilation is done in the correct order to meet prerequisites and satisfy the dependencies. If one or several source codes have been updated, only these and the files that depend on them would be recompiled by command make.
  • Makefile syntax:
  • Makefile example:
    app.x: main.o libScalar_Product.a
            gcc -o app.x main.o -L. -lScalar_Product
    main.o: main.c Scalar_Product.h
            gcc -c main.c
    Scalar_Product.o: Scalar_Product.c
            gcc -c Scalar_Product.c
    libScalar_Product.a: Scalar_Product.o
            ar -cru libScalar_Product.a Scalar_Product.o
            ranlib libScalar_Product.a

  • Makefile or makefile would be processed by running command make:
    If the Makefile has different name, for example Makefile1, it can be processed as follows:
    make -f Makefile1

  • Take me to the Course Website