正确的makefile

DB2    = db2
CC     = cc
CFLAGS = -O

IP1   = /ZDZ_UAT/usr/sqllib/include
LP1   = /ZDZ_UAT/usr/sqllib/lib
LIB1  = db2

DATABASE = mydb
USER = 1111
PASSWD = 1111

EXE = myfirst

SQC = myfirst.sqc
CFILE = myfirst.c
BND = myfirst.bnd
OBJ = myfirst.o

all : $(EXE)

$(EXE) : $(OBJ)
        $(CC) $(CFLAGS) -L$(LP1) $(OBJ) -o $@ -l$(LIB1);

$(OBJ) : $(CFILE)
        $(CC) -g -c $(CFLAGS) -I$(IP1) $(CFILE)

$(CFILE) $(BND) : $(SQC)
        $(DB2) connect to $(DATABASE) user $(USER) using $(PASSWD) ;\
        $(DB2) prep $(SQC) bindfile ;\
        $(DB2) bind $(BND); \
        $(DB2) connect reset
clean :
        rm $(CFILE) $(BND) $(OBJ) $(EXE)

你可能感兴趣的:(正确的makefile)