From: KIRAN on
Hi All,
below is my makefile to indent C source files.......

###############################################################
vpath %.c ../src

BLANKLINE_OPTS = -bad -bap -bbb -nsob
COMMENTS_OPTS = -fca
STATEMENTS_OPTS = -br -ce -cdw -cli2 -cbi2 -ss -npcs
DECLARATIONS_OPTS = -di26 -bfda -psl -brs
INDENTATION_OPTS = -ppi3
BREAKING_LONG_LINES = -bbo

INDENT = indent

ALL_OPTS = $(BLANKLINE_OPTS) $(COMMENTS_OPTS) $(STATEMENTS_OPTS) \
$(DECLARATIONS_OPTS) $(INDENTATION_OPTS) $(BREAKING_LONG_LINES)

ALL_OPTS_STR = "$(ALL_OPTS)"

#put all the source files here
SRCS = App_pactivity.c App_per.c AppCommands.c APP_DevSDK.c App_main.c
DEPS = $(patsubst %.c, %.d, $(SRCS))

include $(DEPS:.c=.d)


%.d : %.c
@printf "%s : %s\n\t %s %s -st %s > %s\n" $*.bak.c $< $(INDENT) $
(ALL_OPTS_STR) $< $*.bak.c > $@

..PHONY:clean

clean:
rm -f *.d *.bak.c
#######################################################################

dependency files are generated for all the c files..but make is
including only the first dependency file i.e App_pactivity.d
Any help for the above problem is appreciated.
Regards,
Kiran
From: Jens Thoms Toerring on
KIRAN <kiraank(a)gmail.com> wrote:
> below is my makefile to indent C source files.......

The 'include' is problematic since you try to include files
that don't exist (and 'include' isn't a target, so the files
aren't created). Try instead to call make with the newly
generated .d file as the makefiles in the rule for generating
..d files:

> ###############################################################
> vpath %.c ../src

> BLANKLINE_OPTS = -bad -bap -bbb -nsob
> COMMENTS_OPTS = -fca
> STATEMENTS_OPTS = -br -ce -cdw -cli2 -cbi2 -ss -npcs
> DECLARATIONS_OPTS = -di26 -bfda -psl -brs
> INDENTATION_OPTS = -ppi3
> BREAKING_LONG_LINES = -bbo

> INDENT = indent

> ALL_OPTS = $(BLANKLINE_OPTS) $(COMMENTS_OPTS) $(STATEMENTS_OPTS) \
> $(DECLARATIONS_OPTS) $(INDENTATION_OPTS) $(BREAKING_LONG_LINES)

> ALL_OPTS_STR = "$(ALL_OPTS)"

> #put all the source files here
> SRCS = App_pactivity.c App_per.c AppCommands.c APP_DevSDK.c App_main.c
> DEPS = $(patsubst %.c, %.d, $(SRCS))

all: $(DEPS)

> %.d: %.c
> @printf "%s : %s\n\t %s %s -st %s > %s\n" $*.bak.c $< $(INDENT) $
> (ALL_OPTS_STR) $< $*.bak.c > $@
make -f $@

> .PHONY:clean

> clean:
> rm -f *.d *.bak.c
> #######################################################################

As you see, the logic is now a bit backwards: the .d files are
treated as the files to be created and the .bak.c files are just
a "side-effect" of creating the .d files;-)

Regards, Jens
--
\ Jens Thoms Toerring ___ jt(a)toerring.de
\__________________________ http://toerring.de