1. The document discusses building software on Linux systems using build systems like Make and version control systems like Git. It explains that build systems take source code and build dependencies to create executable files, while version control systems track changes to files over time.
2. Make is an original build system that uses Makefiles containing rules with targets, prerequisites, and commands. Configure scripts ensure required system components are available.
3. Git is a popular version control system (VCS) that tracks changes to files and allows recovering old versions. It uses a Git directory to store changes and a staging area between the working directory and repository.
2. Build?
• The software meaning of ‘building’ is pretty much the same as the
everyday meaning - to take raw materials and create something useful out
of them.
int c;
int d;
max();
Subl
Jmpl
Addl
Jmp
Popl
Addl
import
java.lang.*
Source files
(The Work Stuff)
int a;
int b;
sum();
import
java.util.*
BUILD PROCESS
Executable File
(The fun stuff)
3. Why use a Build System
• It makes your workflow reproducible.
• It makes life easier for end-users.
• It helps you document the full software
installation process.
4. Make
• Classic, original build system released in 1977 for
UNIX.
• Uses a formatted set of instructions, stored in a file
called a Makefile.
Source
Code
targetfile:
source
com
mand
abc.zip: curl
counties.zipMakefile
RESULT
5. Makefiles
• A makefile consists of sequential rules.
• A rule consists of a target, required components, and commands.
• If the prerequisites are satisfied, the command is performed when the
specific target is called..
target : prerequisites ; command(s)
6. An Example
CC = gcc
CFLAGS = -c -Wall
all: main
main: main.o randrange.o
$(CC) main.o randrange.o -o password-pronounce
main.o: src/main.c
$(CC) $(CFLAGS) src/main.c
randrange.o: src/randrange.c
$(CC) $(CFLAGS) src/randrange.c
clean:
rm -rf *o password-pronounce
install:
cp password-pronounce /usr/bin/
uninstall:
all is called first, and checks for the
dependency main.
Since main has not been built yet, the
system looks for a rule to build it.
Control flows recursively down the file, until
the first target is built. The rest of the build
then completes upwards
7. What’s Missing?
• System prerequisites, such as compilers,
linkers and assemblers.
• Even if these are installed, make may not
know the right place to look for them.
• That’s where configure comes in.
8. Configure
• Configure is an executable shell script that
matches components on the computer to
those required by the Makefile
• Automates system portability, by making
sure that everything is in the right place
9. Version Control
• Version control is a system that records changes to a file or set of files
over time so that you can recall specific versions later
• A VCS allows you to revert files back to a previous state, revert the entire
project back to a previous state, review changes made over time, see who
last modified something that might be causing a problem, who introduced
an issue and when, and more
• Using a VCS also means that if you screw things up or lose files, you can
generally recover easily
11. Git Basics
• Git uses a Git directory, a working directory, and a staging area.
• The Git directory is where everything is actually stored. It’s where Git
keeps your project’s database.
• The working directory is the directory you’re currently working in. It’s one
version of your project.
• The staging area is a file that Git uses to keep track of the changes you’ve
made in the working directory.
12. Git Basics
The git workflow is as follows:
• You modify files in your working directory.
• You stage the files, adding snapshots of them to your staging area.
• You do a commit, which takes the files as they are in the staging area and
stores that snapshot permanently to your Git directory.
Any given file in a git repository can be only be in one of those three states.
13. Try out what you learnt!
• We’ve prepared a (small) complete project that includes a configure script,
a makefile, and is stored as a git repository.
• To get it, type this in your git or bash terminal:
git clone https://github.com/puranjay/password-pronounce
• Use the readme file to get it up and running on a Linux machine.