]> zdv2.bktei.com Git - BK-2023-05.git/blob - README.org
feat(src:2023-07-10):Add hello world, make test
[BK-2023-05.git] / README.org
1 * Learning C
2 #+TITLE: Learning C
3 #+AUTHOR: Steven Baltakatei Sandoval
4 #+DATE: 2023-07-10
5 #+EMAIL: baltakatei@gmail.com
6
7 ** Summary
8 This repository contains practice code and examples as I learn how to
9 program in C.
10
11 ** Compiling Procedure
12 *** Compiling with ~gcc~
13 See [[https://www.linuxtopia.org/online_books/an_introduction_to_gcc/gccintro_9.html][ref]].
14
15 : $ gcc -Wall -o hello.c hello
16
17 *** Managing compiling with ~make~
18 Create ~Makefile~ to specify compile options.
19
20 #+begin_example
21 CC=gcc
22 CFLAGS=-Wall -Wextra -pedantic
23 OUTFILE=hello
24 SOURCE=hello.c
25
26 all: $(SOURCE)
27 $(CC) $(CFLAGS) -o $(OUTFILE) $(SOURCE)
28
29 clean:
30 rm -f $(OUTFILE)
31 #+end_example
32
33 Then, run the file named ~Makefile~ via ~make all~ or simply ~make~.