linux makefile

http://www.cs.colby.edu/maxwell/courses/tutorials/maketutor/


IDIR =include
CC=gcc
CFLAGS=-I$(IDIR) -g

ODIR = obj
LDIR = lib

LIBS=-lm

_DEPS = vcardparser.h
DEPS = $(patsubst %, $(IDIR)/%, $(_DEPS))

_OBJ = vcardparser_main.o vcardparser.o
OBJ = $(patsubst %, $(ODIR)/%, $(_OBJ))

$(ODIR)/%.o: %.c $(DEPS)
    $(CC) -c -o $@ $< $(CFLAGS)

vcardparser: $(OBJ)
    $(CC) -o $@ $^ $(CFLAGS) $(LIBS)

.PHONY: clean

clean:
    rm -f $(ODIR)/*.o *~core $(INCDIR)/*~


gdb调试技巧:
http://linuxtools-rst.readthedocs.org/zh_CN/latest/tool/gdb.html

猜你喜欢

转载自huaxiamian.iteye.com/blog/2263395
今日推荐