--- In [email protected], "Geert Vancompernolle"
<[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> I'm currently using the following makefile to build my test
> applications (initially taken from the Phrozen SDK, beta 1 makefile
> used to compile the I2C application example):
>
> AXIS_USABLE_LIBS = UCLIBC GLIBC
> include $(AXIS_TOP_DIR)/tools/build/Rules.axis
> #SHELL = /bin/sh
>
> PROGS = i2cexamplegvc
>
> OBJS = i2cexamplegvc.o
> OBJS +=
>
> INSTDIR = $(prefix)/usr/bin
>
>
> all: pre-build main-build post-build
>
> pre-build:
> @echo "Testing if .target-makefrag exists..."
> if [ ! -f .target-makefrag ] ; \
> then make cris-axis-linux-gnu ; \
> echo "Target created, now continue..." ; \
> else echo "File exists..." ; \
> fi
>
> main-build: $(PROGS)
>
> $(PROGS): $(OBJS)
> $(CC) $(LDFLAGS) $^ $(LDLIBS) -o $@
> # $(STRIP) $@
> @echo
> @echo "***********"
> @echo "Finished!!!"
> @echo "***********"
>
> post-build:
> @echo
> @echo "*********************************"
> @echo "Now sending result to FoxBoard..."
> @echo "*********************************"
> @echo
> foxy $(PROGS)
> @echo
> @echo "File sent via FTP to the FoxBoard..."
>
> install: $(PROGS)
> $(INSTALL) -p -o root -g root -m 0777 $(PROGS) $(INSTDIR)
>
> clean:
> rm -f $(PROGS) *.o core
>
> The changes I've done so far, are:
>
> 1. Added a pre- and post build target.
>
> * the pre-build target is there to see if the file .target-makefrag is
> already created or not. If not, then call 'make cris-axis-linux-gnu'
>
> * the post-build target is to FTP my generated executable to the
> FoxBoard via a script, called "foxy".
>
> 2. Added a main-build target.
>
> * this is simply what was there before in the Phrozen SDK
> distribution, so I didn't change the content of it.
>
> What I though, was that if .target-makefrag was not existing, the file
> is created and once this creation is done, the remainder of the
> launched make process could use the file .target-makefrag as input for
> the real build.
>
> But that is not true... Apparently, when the .target-makefrag file
> doesn't exist, then it's nicely created first, as explained above. So
> far, so good...
>
> But then, the make continues, NOT taking into account the content of
> the .target-makefrag file. I see this, because for instance the
> invoked compiler is 'gcc' and not 'gcc-cris', as it should be.
>
> How can I solve this problem? My intention is to create the
> .target-makefrag file first if it's not existing and then, once
> created, to continue with the "regular" makefile.
>
> Is there recursion needed here? How to solve?
>
> Any input appreciated.
>
> Best rgds,
>
> --Geert
>
Would like to come back on this one for another thing which is not
clear to me yet...
When you look to the makefile, at a certain moment there's the
following line:
$(CC) $(LDFLAGS) $^ $(LDLIBS) -o $@
This is, as far as I can see, the linking part. However, the
compilation part is just in front of this step, although it's not
explicitly written down in the makefile.
Who's responsible for that compilation step? Has it something to do
with "hidden" actions in the "Rules.axis" file?
Best rgds and a Happy New Year to everybody,
--Geert