]> zdv2.bktei.com Git - BK-2023-05.git/blobdiff - README.org
feat(ref):Add example code
[BK-2023-05.git] / README.org
index 576ea411a4156174d53dd50f5161e10f7c325231..a79bb3b99f1815c9d379dce1795be35840962c7d 100644 (file)
@@ -1,9 +1,33 @@
 * Learning C
+#+TITLE: Learning C
+#+AUTHOR: Steven Baltakatei Sandoval
+#+DATE: 2023-07-10
+#+EMAIL: baltakatei@gmail.com
+
 ** Summary
 This repository contains practice code and examples as I learn how to
 program in C.
 
 ** Compiling Procedure
+*** Compiling with ~gcc~
 See [[https://www.linuxtopia.org/online_books/an_introduction_to_gcc/gccintro_9.html][ref]].
 
 : $ gcc -Wall -o hello.c hello
+
+*** Managing compiling with ~make~
+Create ~Makefile~ to specify compile options.
+
+#+begin_example
+CC=gcc
+CFLAGS=-Wall -Wextra -pedantic
+OUTFILE=hello
+SOURCE=hello.c
+
+all: $(SOURCE)
+  $(CC) $(CFLAGS) -o $(OUTFILE) $(SOURCE)
+
+clean:
+  rm -f $(OUTFILE)
+#+end_example
+
+Then, run the file named ~Makefile~ via ~make all~ or simply ~make~.