lignin
Junior Member level 2
- Joined
- Apr 27, 2013
- Messages
- 22
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1,281
- Activity points
- 1,436
Hello;
I am trying to understand makefiles. So I can write a simple makefile code. I want to ask questions for better understanding.
so here is my code :
what does -o mean in this example ?
thank you.
I understand.
gcc [options] [source files] [object files] -o output file
and -o is gcc option flag and it write the build output to an output file.
$(CC) -O2 $(CFLAGS) $(FILE).c -o $(EXECUTABLE_FILE) is also work.
but why $(CC) -O2 $(CFLAGS) -o $(EXECUTABLE_FILE) $(FILE).c is work ?
I am trying to understand makefiles. So I can write a simple makefile code. I want to ask questions for better understanding.
so here is my code :
Code:
CC = gcc
CFLAGS = -g -Wall
FILE = main
EXECUTABLE_FILE = out_executable
all : $(FILE)
$(CC) -O2 $(CFLAGS) -o $(EXECUTABLE_FILE) $(FILE).c
clean :
$(RM) *~ $(FILE) *~ $(EXECUTABLE_FILE) *.o
what does -o mean in this example ?
thank you.
I understand.
gcc [options] [source files] [object files] -o output file
and -o is gcc option flag and it write the build output to an output file.
$(CC) -O2 $(CFLAGS) $(FILE).c -o $(EXECUTABLE_FILE) is also work.
but why $(CC) -O2 $(CFLAGS) -o $(EXECUTABLE_FILE) $(FILE).c is work ?
Last edited: