2017-02-14 1 views
0

src 디렉토리에 cells.c과 같은 소스 파일이 있습니다. 컴파일을 수행 할 때, 컴파일러는 오브젝트 파일 앞에 패키지 이름을 붙입니다. 예를 들어 neoleo-cells.o이됩니다. 왜 이렇게하고, 어떻게 멈출 수 있습니까? 나는 그것이 표준 행동이라고 생각하지 않는다. 여기automake가 패키지 파일 이름 앞에 내 오브젝트 파일 접두어를 붙이는 이유는 무엇입니까?

Makefile.am입니다 :

neoleo_CFLAGS = $(GUI_DEFINES) -Dmain0=main 

당신이 타겟 종속 컴파일 플래그가있는 경우, Automake는이 결과 객체 파일을 다른 이름을 선택 :

#VPATH = $(srcdir) $(builddir) 

GUI_SRCS = 
GUI_LINK = 
#GUI_DEFINES = -DX_DISPLAY_MISSING 
GUI_DEFINES = -DHAVE_X 

# Order of linking of libraries for Motif seems to be important 
# I have decided to mandate the use of the Xbae library, rather than 
# have it optional. 

if UseMotif 
GUI_SRCS += io-motif.c appres.c fallback.c oleo_icon.xpm 
GUI_LINK += -lXm -lXt -lXbae 
GUI_DEFINES += -DHAVE_MOTIF 
endif 

GUI_SRCS += io-x11.c xrdb.c 
GUI_LINK += -lX11 

YFLAGS = -d 
EXTRA_DIST = $(srcdir)/neoleo.i 

bin_PROGRAMS = neoleo 


BUILT_SOURCES = getdate.c parse.c parse.h posixtm.c posixtm.h 
#BUILT_SOURCES += neoleo_wrap.c 
CLEANFILES = $(BUILT_SOURCES) 

#lib_LTLIBRARIES = libneoleo.la 
neoleo_CFLAGS = $(GUI_DEFINES) -Dmain0=main 
neoleo_LDADD = -lm -lncurses -lpthread $(GUI_LINK) 
#neoleo_LDFLAGS = -e main0 
#neoleo_la_LDFLAGS = -module -avoid-version -shared 
neoleo_SOURCES = afm.c args.c basic.c busi.c byte-compile.c cells.c cmd.c date.c decompile.c display.c \ 
       epson.c eval.c font.c format.c forminfo.c funcs.c graph.c gsl.c hash.c help.c \ 
       info.c init.c input.c \ 
       io-headless.c io-curses.c io-edit.c io-term.c io-utils.c \ 
       ir.c key.c legend.c line.c list.c lists.c mdi.c oleofile.c pcl.c plot.c \ 
       postscript.c print.c prtext.c ref.c regions.c sc.c sort.c string.c stub.c sylk.c utils.c \ 
       window.c \ 
       defuns.c \ 
       get_date.h getdate.y \ 
       parse.y \ 
       posixtm.y \ 
       neoleo_swig.c \ 
       mysql.c $(GUI_SRCS) 


noinst_HEADERS = afm.h appres.h args.h basic.h byte-compile.h cell.h \ 
       cmd.h decompile.h defun.h defuns.h display.h epson.h \ 
       errors.h eval.h font.h format.h forminfo.h funcdef.h \ 
       funcs.h global.h graph.h hash.h help.h info.h init.h \ 
       input.h io-abstract.h io-headless.h io-curses.h io-edit.h \ 
       io-generic.h io-motif.h io-term.h io-utils.h io-x11.h \ 
       ir.h key.h line.h list.h lists.h mdi.h mysql.h node.h \ 
       oleofile.h oleo_plot.h oleosql.h oleo_xb.h parse.h pcl.h \ 
       posixtm.h postscript.h print.h proto.h prtext.h ref.h \ 
       regions.h sc.h sciplot.h sciplotI.h sort.h stub.h stubs.h \ 
       sylk.h sysdef.h userpref.h utils.h window.h \ 
       neoleo_swig.h 

# exclude these for now: 
# plotter.c xbase.cpp 


ref.o : parse.h 

#neoleo_wrap.c : $(srcdir)/neoleo.i neoleo_swig.c neoleo_swig.h 
#  swig -tcl8 -o [email protected] $< 

답변

4

이 라인은 오브젝트 파일의 이름 바꾸기가 발생 . 이 방법은 동일한 소스이지만 플래그가 다른 여러 대상이있는 경우 충돌을 방지합니다.

이제 Automake는 이론적으로 이것이 일어나지 않고 오브젝트 파일의 이름을 바꾸지 않을 수 있음을 알았습니다. 그러나 실제로는 대부분의 사람들이 중간 파일을 호출하는 것에 신경을 쓰지 않으며 이러한 접근 방식은 구현을 단순화한다고 생각합니다.

귀하의 경우에는 신경 쓰이는 것처럼 들립니다. 따라서 해당 변수의 이름을 AM_CFLAGS으로 변경하면 모든 것이 예상대로 작동합니다.

+0

예를 들어 subdir-objects를 사용할 수없는 경우와 같이 번역 단위와 객체 파일간에 1 : 1 매핑을 기대하지 않는 것이 좋습니다. –

관련 문제