写的一个Makefile

#=========================================================================
#
# MAKE FILE FOR ROCKY
#
#
#=========================================================================
SHELL = /usr/bin/sh
VERSION = 0.1
DATE = `date '+%Y-%m-%d'`
PACKAGE = ROCKY #---------------PATH INFO--------------------
LBIN = bin
LOBJ = obj
LSRC = src
LCLIENT = client
#-------------------------------------------- #----------- COMPILING INFOMATION-------------
CC = gcc
EXE = ROCKY
CLIENT = CLIENT_ROCKY
CDUBG =
CFLAGS = -Wall -g -o
# CFLAS = -Wall -Wextra -O2
LIBS = -lncurses -pthread ALLFILES= $(wildcard $(LSRC)/*.c)
CLIENT_FILES=$(wildcard $(LCLIENT)/*.c)
DAEMON = ROCKY_DAEMON
# OBJS
OBJS = $(ALLFILES:%.c=%.o)
CLIENT_OBJS = $(CLIENT_FILES:%.c=%.o) #---------------------------------------------- #PHONY
all: info dirs $(EXE) $(CLIENT) info:
-@echo $(EXE) $(VERSION) IS BUILDING... ${EXE}: $(OBJS)
$(CC) $(CFLAGS) $@ $(OBJS) $(LIBS) $(DAEMON):
$(CC) $(CFLAGS) $@ dirs:
-@mkdir -p $(LBIN) $(LOBJ) $(CLIENT):$(CLIENT_OBJS)
$(CC) $(CFLAGS) $@ $(CLIENT_OBJS) mv2dir:
-@mv $(EXE) $(LBIN)
-@mv $(CLIENT) $(LBIN)
clean:
-@rm $(PACKAGE)
-@rm -rf $(LBIN) $(LOBJ)
-@rm $(LSRC)/*.o
-@rm $(LCIENT)/*.o
-@rm $(CLIENT) #---objs--- $(OBJS):%.o:%.c
$(CC) -c $< -o $@ $(CLIENT_OBJS):%.o:%.c
$(CC) -c $< -o $@ .PHONY: clean
上一篇:linux学习 建立静态库,动态库,写简单的makefile


下一篇:webstorm javascript 分号提示如何自动补全或去掉?