gcc -o executable source-list
-o : 실행 파일 이름 명시, 디폴트 a.out
gcc -c reverse.c : object 모듈 작성
실행 파일 생성
gcc test.c module.c
mv a.out test
직접 실행파일명 지정
gcc -o test test.c module.c
단계별 컴파일1
gcc -c test.c module.c
-다중 모듈 프로그램의 부분 컴파일 : 컴파일 작업의 속도 개선
ex) bingo = bingo.o + hidden.o + check.o + bingo.h
전부 컴파일 및 링킹 : gcc -o bingo bingo.c ........... etc
* gcc -c => 오브젝트 파일 생성 .c (assembling) => gcc -o => 실행파일 생성 .o => makefile 작성
make : 수정된 파일들 따라 필요 작업만 하도록 처리.
다중 모듈 프로그램에서 수정된 부분에 따라 필요한 부분만 재컴파일.
makefile / Makefile 이름으로 파일 간의 의존 관계와 실행할 명령들의 룰 표현.
stud2222@com-B70EV-AP5VBGE:~/ProgTools$ cat makefile
bingo: bingo.o hidden.o check.o
gcc -o bingo bingo.o hidden.o check.o
bingo.o: bingo.c bingo.h
gcc -g -c bingo.c
hidden.o: hidden.c
gcc -c hidden.c
check.o: check.c bingo.h
gcc -c check.c
reverse: main.o reverse.o
gcc -o reverse main.o reverse.o
main.o: main.c reverse.h
gcc -c main.c
reverse.o: reverse.c reverse.h
gcc -c reverse.c
myprog = main.c + myprog.c 컴파일하여 생성
'Major > Linux(Ubuntu)' 카테고리의 다른 글
부팅과 종료 (0) | 2022.06.08 |
---|---|
사용자 정보 관리 (0) | 2022.06.07 |
Overwrite script (0) | 2022.06.06 |
프로세스 (0) | 2022.04.23 |
vi, 셸 (0) | 2022.04.20 |