File tree Expand file tree Collapse file tree 1 file changed +44
-0
lines changed Expand file tree Collapse file tree 1 file changed +44
-0
lines changed Original file line number Diff line number Diff line change 1+ # MAKE
2+
3+ > The hard work you don't see
4+
5+ You can find examples in the [ Make Folder] ( Make )
6+ Makefiles are recepies. Basically you just define:
7+ | type | |
8+ | --- | --- |
9+ | variables | short names for commands and files |
10+ | rules | how to do it, which input/output to use |
11+ | targets | recepy-name (all when not specified)|
12+
13+ ### Variables
14+ There are many conventions on naming them.
15+ As an example we would call TARGET the name of the final result, eg. executable\
16+ ` TARGET = progname `
17+
18+ You recall it by putting \& () around the name like\
19+ ` $(TARGET) `
20+
21+ If you define the compiler variable to be CC\
22+ you could do so to compile and build your program
23+ ```
24+ CC = gcc
25+ $(CC) <source.c> -o $(TARGET)
26+ ```
27+
28+ A simple Makefile cold just be:
29+ ```
30+ TARGET = testing_C
31+ CC = gcc
32+ all:
33+ < TAB-8 > $(CC) <source.c> -o $(TARGET)
34+ ```
35+ where < TAB-8 > is a real size 8 tab. ⚠️ not 8 spaces. this has to be set in your editor\
36+ ` :set noexpandtab ` ` :set softtabstop=8 ` and ` :set ts=8 ` in vim
37+
38+ You can make it permanent to your file:\
39+ On the first line of Makefile write the following _ vim_modeline_ :
40+
41+ ` vim: noexpandtab: ts=8: softtabstop=8 `
42+
43+ > At this point, when you type ` make ` \
44+ > You will get ` testing_C ` in the current folder.
You can’t perform that action at this time.
0 commit comments