help-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Why make's include directive does not work


From: shellux
Subject: Why make's include directive does not work
Date: 3 Apr 2007 03:08:34 -0700
User-agent: G2/1.0

Hi:
      I have a problem when I come to managing my c library using gnu
make(version  3.81). There is a rule named pyscript/init.py in my
makefile below(see my makefile below). This rule should is invoked
after make find include directive (include pyscript/init), but in
fact, in my computer(running fedora 5 linux), "pyscript/init" rule is
not actually invoked.
      Maybe, the most odd problem is that, when I remove "include $
(dependences)" , all problem go away!!! Can you tell me why? Thank you
very much.

 
liyehua

#$(call get-files,dirs,c)
get-files := foreach(d,$1,$(wildcard $(d)/*.$2))

ifdef COMSPEC
platform := __WIN32__
else
platform := __LINUX__
endif

do_replace_structs := singlelist lstack
unreplace_structs :=
unreplace_items := FUNCNAME
script := pyscript/lstack.sp
structs := $(do_replace_structs) $(unreplace_structs)
out     := out


dirs   := . $(out)
VPATH  := $(dirs) pyscript
source := test.c $(addprefix $(out)/,$(addsuffix .c,$(structs)))
header := $(addprefix .h,$(structs))
object := $(subst .c,.o,$(source))
dependences := $(subst .c,.d,$(source))
autogenfiles := $(addprefix $(out)/,$(addsuffix .c,$(structs)) $
(addsuffix .h,$(structs)))
lib_tem := $(foreach st,$(structs),$(shell ./mkdatastruct.py -s $(st)
--print-template))


pro-name := clib


CPPFLAGS = -g -Wall -O -pg -D $(platform)
LDLIBS = -lm -lc


.PHONY:test compile clean distclean

test: $(pro-name)

$(pro-name):$(object)
        $(LINK.c) $(CPPFLAGS) $(LDLIBS) $+ -o $@

compile:$(object)
        $(COMPILE.c) $^

clean:
        rm -f $(object) $(dependences)

distclean:clean
        rm -f $(pro-name)
        rm -rf $(out)

tags:
        ctags -R -V $(source) $(header) $(autogenfiles)

include $(dependences)

#############################################
########### Problem occur here ##################
#init program's deployment
include pyscript/init


#makefile assisting rules. Used to generate out subdirectory
pyscript/init:
        python pyscript/init.py $(out)
        touch $@

########### Problem occur above################
#############################################


#dependency generation
%.d:%.c
        $(CC) $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -M $< | \
        sed 's,\($(notdir $*)\.o\) *:,$(dir $@)\1 $@: ,' > $@

$(autogenfiles):$(script) $(lib_tem)
        ./mkdatastruct.py -f $< $(if $(findstring $(unreplace_structs),$@),--
unreplace='$(unreplace_items)')



reply via email to

[Prev in Thread] Current Thread [Next in Thread]