makefile 에서 g + + - o - c 매개 변수 설명

683 단어 makefile
CC = g++

SRCS = $(wildcard *.cpp)

OBJS = $(patsubst %cpp, %o, $(SRCS))

LDFLAGS :=-lsqlite3 -lTR3A

CFLAGS := -Wall -O2 -g -L/home/usr

INCLUDE = -I ./com/inc \
        -I ./com/lib/inc
CFLAGS += $(INCLUDE)

TARGET = TEST

all : $(TARGET)

$(TARGET):$(OBJS)
    $(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) 
%.o:%.c
    $(CC) $(CFLAGS) -o $@ -c $< $(LDFLAGS)


  (   ):
    $(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS)   
    (1)-o $@   $^      ,     -c,           ,    ,
-o   $@                ,   TARGET = main.o,  main.o 
        ,      .o      ,        .o  ,      
-o $@,          a.out      。
    $(CC) $(CFLAGS) -o $@ -c $< $(LDFLAGS)  
    (2)-o $@   -c $

좋은 웹페이지 즐겨찾기