From: chrubis@suse.cz
To: Stanislav Kholmanskikh <stanislav.kholmanskikh@oracle.com>
Cc: vasily.isaenko@oracle.com, ltp-list@lists.sourceforge.net
Subject: Re: [LTP] [PATCH] msgctl{08, 09, 10, 11}: cleanup
Date: Thu, 24 Oct 2013 16:31:58 +0200 [thread overview]
Message-ID: <20131024143158.GA11150@rei> (raw)
In-Reply-To: <52692C2F.3040903@oracle.com>
Hi!
> >> And I think that I found an another issue we should overcome - lib.mk
> >> defines MAKE_TARGETS:
> >>
> >> MAKE_TARGETS := $(LIB)
> >>
> >> generic_leaf_target.mk also does it.
> >>
> >> So It should not be trivial to include both files (lib.mk and
> >> generic_leaf_target.mk) into one Makefile.
> >> I suppose that in that case we have to implicitly define MAKE_TARGETS in
> >> our Makefile.
> > Now this one is more complicated, but solvable.
> >
> > First of all we need to change the part in lib.mk to
> >
> > MAKE_TARGETS += $(LIB)
> >
> > Then define MAKE_TARGETS explicitly in the Makefile (we need that anyway
> > for lib: tests dependency) and add LDFLAGS and LDLIBS. The full Makefile
> > looks like:
> >
> > top_srcdir ?= ../../../../..
> > include $(top_srcdir)/include/mk/testcases.mk
> >
> > LIBSRCS := libmsgctl.c
> > INTERNAL_LIB := libmsgctl.a
> > MAKE_TARGETS := $(patsubst %.c,%,$(wildcard msgctl??.c))
> >
> > $(MAKE_TARGETS): $(INTERNAL_LIB)
> >
> > LDFLAGS += -L$(abs_builddir)
> > LDLIBS += -lmsgctl
> >
> > include $(abs_srcdir)/../Makefile.inc
> > include $(top_srcdir)/include/mk/lib.mk
> > include $(top_srcdir)/include/mk/generic_leaf_target.mk
> >
> > See also attached patch with all the changes and check if that works for
> > you. If so I will commit change to the lib.mk as separate patch and ask
> > you to include changes in Makefile.inc in your patchset.
>
>
> Yes, It works.
>
> But the compilation is performed as follows:
>
> gcc -g -O2 -g -O2 -fno-strict-aliasing -pipe -Wall
> -I/home/stas/ltp/testcases/kernel/include
> -I/home/stas/ltp/testcases/kernel/syscalls/ipc/msgctl/../lib
> -I../../../../../include -I../../../../../include
> -I../../../../../include -I../../../../../include
> -L/home/stas/ltp/testcases/kernel/syscalls/ipc/msgctl
> -L/home/stas/ltp/testcases/kernel/syscalls/ipc/msgctl/../lib
> -L../../../../../lib -L../../../../../lib msgctl01.c libmsgctl.a -lltp
> -lmsgctl -lipc -o msgctl01
>
> So gcc 'links' msgctl01.c and libmsgctl.a at once (and additionally is
> passed -lmsgctl option).
Ah, this one. Let's fix this, the handling of static libraries is too
fragile and this may posibly break on some distribution (from my memory
Ubuntu was the most problematic one).
> How do you think, maybe introduce my favourite .INTERMEDIATE target into
> Makefile? :)
>
> Like this:
>
> MAKE_TARGET_OBJS := $(addsuffix .o,$(MAKE_TARGETS))
> .INTERMEDIATE: $(MAKE_TARGET_OBJS)
>
> $(MAKE_TARGET_OBJS): $(INTERNAL_LIB)
>
> #$(MAKE_TARGETS): $(INTERNAL_LIB)
>
> With this option the compilation is as follows:
>
> gcc -g -O2 -g -O2 -fno-strict-aliasing -pipe -Wall
> -I/home/stas/ltp/testcases/kernel/include
> -I/home/stas/ltp/testcases/kernel/syscalls/ipc/msgctl/../lib
> -I../../../../../include -I../../../../../include
> -I../../../../../include -I../../../../../include -c -o msgctl01.o
> msgctl01.c
> gcc -L/home/stas/ltp/testcases/kernel/syscalls/ipc/msgctl
> -L/home/stas/ltp/testcases/kernel/syscalls/ipc/msgctl/../lib
> -L../../../../../lib -L../../../../../lib msgctl01.o -lltp -lmsgctl
> -lipc -o msgctl01
>
> I can't find any reasonable arguments for this approach. Just feels that
> it's more 'correct'.
That looks a bit like a workaround, but let's go with this one for now.
I will take a closer look later and change it if I find a better way.
(I have a better build system documentation on my TODO)
--
Cyril Hrubis
chrubis@suse.cz
------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60135991&iu=/4140/ostg.clktrk
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
next prev parent reply other threads:[~2013-10-24 14:32 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <525F76B7.4050705@oracle.com>
2013-10-18 9:12 ` [LTP] [PATCH] msgctl{08, 09, 10, 11}: cleanup Stanislav Kholmanskikh
2013-10-21 12:57 ` chrubis
[not found] ` <5268FDE5.5010408@oracle.com>
2013-10-24 11:10 ` chrubis
2013-10-24 12:16 ` chrubis
[not found] ` <52692C2F.3040903@oracle.com>
2013-10-24 14:31 ` chrubis [this message]
[not found] ` <526A2990.2000107@oracle.com>
2013-10-31 10:55 ` chrubis
[not found] ` <527B58E9.6050705@oracle.com>
2013-11-07 10:54 ` chrubis
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20131024143158.GA11150@rei \
--to=chrubis@suse.cz \
--cc=ltp-list@lists.sourceforge.net \
--cc=stanislav.kholmanskikh@oracle.com \
--cc=vasily.isaenko@oracle.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox