makefile 示例

CP = /bin/cp -rf
RM = /bin/rm -rf

CC = gcc -m32
#CFLAGS = -g -Wall -D_REENTRANT -DHaveSNMPVersion -DLM_DEBUG
#CFLAGS = -g -Wall -D_REENTRANT -DHaveSNMPVersion -DIPZY -DLM_DEBUG -DEMV2
CFLAGS = -g -Wall -D_REENTRANT -DLM_DEBUG -DEMV2

LIBDIR = -L../lib
INCL = -I../include

LIBS = -lemvdbc -lemvconf -lzoom_crypt

OBJS = emvSetupGuide.o

PROGS = emvSetupGuide

all:${PROGS}
 
${PROGS}:${OBJS}
 ${CC} ${CFLAGS} ${INCL} ${LIBDIR} -o $@ ${OBJS} ${LIBS} 

install:
 $(CP) emvSetupGuide ${EMV}/bin/
  
.c.o:
 ${CC} ${CFLAGS} ${INCL} -c $<

.C.o:
 ${CC} ${CFLAGS} ${INCL} -c $<

clean:
 $(RM) *.o deal core core.* *.core emvSetupGuide

cleanobj:
 $(RM) *.o deal core core.* *.core

-------------------------------------------------------------------------------------------------------

RM = /bin/rm -rf
CP = /bin/cp -rf

############################################################

CC = gcc -m32
CFLAGS = -g -Wall -D_REENTRANT  \
 -I../include

LDFLAGS =
LIBS = -L../lib -llib1 -llib2......

SRCS = c1.c  c2.c......

OBJS = $(SRCS:.c=.o)

TARGET = PrgName

############################################################

all: $(TARGET)

$(TARGET): $(OBJS)
          $(CC) -o $@ $(OBJS) $(LIBS)

.PHONY: install clean cleanobj

install: $(TARGET) 
           $(CP) $(TARGET) ${HOME}/bin/
           $(CP) $(TARGET).conf ${HOME}/conf/

clean:
             $(RM) $(TARGET) $(OBJS)

cleanobj:
                $(RM) $(OBJS)

-------------------------------------------------------------------------------------------------------

你可能感兴趣的:(职场,makefile,休闲)