红联Linux门户
Linux帮助

求助:makefile看不明白,请帮忙

发布时间:2010-02-02 12:20:17来源:红联作者:lzj2010
[i=s] 本帖最后由 lzj2010 于 2010-2-2 16:29 编辑 [/i]

以下是一段有限元程序及其makefile和makefile.in文件的位置,看不懂makefile有些符号查不到,请高手给看一下,解释一下
[attach]29403[/attach]
ver22下的文件两个
一:makefile.in 如下:

# Which compilers to use
FF = gfortran
CC = gcc

# What optimization level to use
FFOPTFLAG = -O2
CCOPTFLAG = -O2

# Source Types
FSOURCE =
CSOURCE =

# Source Extender
FEXT = f
CEXT = c

# What options to be used by the compiler
FOPTIONS =
COPTIONS =

# What options to be used by the loader
LDOPTIONS = -L/usr/X11R6/lib -lX11 -lm

# Location of feap include files
FINCLUDE = /usr/example_sc/feappv22.zip_FILES/ver22/include

# What archiving to use
AR = ar rv

# Archive name
ARFEAP = /usr/example_sc/feappv22.zip_FILES/ver22/Feappv.a
二:makefile如下:

# N.B. It is necessary to modify 'makefile.in' before using make.

include ./makefile.in

CLEANDIRS = include elements plot program unix user windows main

feappv: archive
(cd main; make feappv)
@@echo "--> FEAPpv executable made <--"

archive:
(cd program; make archive)
(cd elements; make archive)
(cd plot; make archive)
(cd unix; make archive)
(cd user; make archive)
@@echo "--> FEAPpv Archive updated <--"

install: archive feappv

main中的文件:makefile如下:
include ../makefile.in

OBJECTS = feappv.o

SOURCES = $(FSOURCE)feappv.$(FEXT)

feappv: $(OBJECTS) $(SOURCES) $(ARFEAP)
ranlib $(ARFEAP)
$(FF) -o feappv $(OBJECTS) $(ARFEAP) \
$(LDOPTIONS)

.f.o:
$(FF) -c $(FFOPTFLAG) -I$(FINCLUDE) $*.f -o $*.o

.c.o:
$(CC) -c $(CCOPTFLAG) $*.c -o $*.o

windows中的makefile如下:
include ../makefile.in

SOURCES = $(FSOURCE)*.$(FEXT)

archive: $(SOURCES)
$(AR) $(ARFEAP) $%
@@echo "--->WINDOWS objects now up-to-date<---"
rm -f $% *.o

install: $(SOURCES)
@@echo "--->WINDOWS objects not installed in archive<---"

.f.o:
$(FF) -c -I$(FINCLUDE) $(FFOPTFLAG) *.f -o $*.o

.c.o:
$(CC) -c $(CCOPTFLAG) *.c -o $*.o

plot文件下没有,其余几个文件夹下是一样的makefile如下:
include ../makefile.in

SOURCES = $(wildcard $(FSOURCE)*.$(FEXT)) $(wildcard $(CSOURCE)*.$(CEXT))
OBJSF = $(SOURCES:.f=.o)
OBJS = $(OBJSF:.c=.o)
FL = built_objs

.SILENT:

archive:
@rm -f $(FL); \
$(MAKE) $(ARFEAP); \
MKRET=$$?; \
if [ -f $(FL) ]; then \
$(AR) $(ARFEAP) `cat $(FL)`; \
rm `cat $(FL)`; \
echo "--->`pwd` objects now up-to-date<---"; \
fi; \
if [ $$MKRET -ne 0 ]; then false; fi;

$(ARFEAP): $(ARFEAP)($(OBJS))

.f.a:
@if $(FF) -c -I$(FINCLUDE) $(FFOPTFLAG) $*.f -o $*.o; then echo $*.o >> $(FL); else false; fi;
@echo "Building $*.o"

.c.a:
if $(CC) -c $(CCOPTFLAG) $*.c -o $*.o; then echo $*.o >> $(FL); else false; fi;
其中的$$?,$$MKRET等等是些什么意思搞不明白,请高手给解释一下
文章评论

共有 8 条评论

  1. westcb 于 2010-06-12 11:06:43发表:

    这些和Makefile规则没有关系,看看正则表达式 sed语法一类的东西,也许会有答案

  2. lzj2010 于 2010-02-06 10:41:35发表:

    没人看的明白吗?

  3. zhangyinghao452 于 2010-02-03 20:36:31发表:

    似懂非懂,说实话,看不懂

  4. lzj2010 于 2010-02-03 10:34:49发表:

    高手们帮帮忙吧!

  5. flzy110 于 2010-02-02 20:27:15发表:

    顶下

  6. gunzelee 于 2010-02-02 18:54:26发表:

    看看,看不懂,要高手呢!

  7. paladin0 于 2010-02-02 16:12:48发表:

    呃,我也看不明白,晕了

  8. lzj2010 于 2010-02-02 15:19:31发表:

    怎么沉得这么快啊,我顶!