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

你可能感兴趣的:(linux makefile)