Monday 25 June 2012

Make

1. 组成部分:
注释,依赖,命令,(循环依赖),宏定义,宏定义外置;
2. Example:
http://www.opussoftware.com/tutorial/TutMakefile.htm
# This makefile compiles the project listed in the PROJ macro
#
PROJ = project   # the name of the project
OBJS = main.obj io.obj  # list of object files 
# Configuration:
#
MODEL = s   # memory model
CC = bcc   # name of compiler 
# Compiler-dependent section
#
%if $(CC) == bcc  # if compiler is bcc
  CFLAGS = –m$(MODEL)  # $(CFLAGS) is –ms
  LDSTART = c0$(MODEL)  # the start-up object file
  LDLIBS = c$(MODEL)  # the library
  LDFLAGS = /Lf:\bc\lib  # f:\bc\lib is library directory
%elif $(CC) == cl  # else if compiler is cl
  CFLAGS = –A$(MODEL,UC) # $(CFLAGS) is –AS
  LDSTART =   # no special start-up
  LDLIBS =   # no special library
  LDFLAGS = /Lf:\c6\lib; # f:\c6\lib is library directory
%else    # else
% abort Unsupported CC==$(CC) # compiler is not supported
%endif    # endif 
# The project to be built
#
$(PROJ).exe : $(OBJS)
 tlink $(LDSTART) $(OBJS), $(.TARGET),, $(LDLIBS) $(LDFLAGS) 
$(OBJS) : incl.h 

No comments:

Post a Comment