Re: [PATCH v4 04/15] checkpolicy: build: follow standard semantics for DESTDIR and PREFIX

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

 



On Wed, Jan 24, 2018 at 11:04:10PM +0100, Nicolas Iooss wrote:
> On Wed, Jan 24, 2018 at 10:27 AM, Marcus Folkesson
> <marcus.folkesson@xxxxxxxxx> wrote:
> > This patch solves the following issues:
> > - DESTDIR is needed during compile time to compute library
> >   and header paths which it should not.
> > - Installing with both DESTDIR and PREFIX set gives us odd paths
> > - Make usage of DESTDIR and PREFIX more standard
> >
> > Signed-off-by: Marcus Folkesson <marcus.folkesson@xxxxxxxxx>
> > ---
> >  checkpolicy/Makefile      | 19 +++++++++++++------
> >  checkpolicy/test/Makefile | 17 ++++++++++++-----
> >  2 files changed, 25 insertions(+), 11 deletions(-)
> >
> > diff --git a/checkpolicy/Makefile b/checkpolicy/Makefile
> > index 68e11f2a..9a55b968 100644
> > --- a/checkpolicy/Makefile
> > +++ b/checkpolicy/Makefile
> > @@ -1,12 +1,10 @@
> >  #
> >  # Makefile for building the checkpolicy program
> >  #
> > -PREFIX ?= $(DESTDIR)/usr
> > -BINDIR ?= $(PREFIX)/bin
> > -MANDIR ?= $(PREFIX)/share/man
> > -LIBDIR ?= $(PREFIX)/lib
> > -INCLUDEDIR ?= $(PREFIX)/include
> > -LIBSEPOLA ?= $(LIBDIR)/libsepol.a
> > +PREFIX ?= /usr
> > +BINDIR ?= $(DESTDIR)$(PREFIX)/bin
> > +MANDIR ?= $(DESTDIR)$(PREFIX)/share/man
> > +LIBDIR ?= $(DESTDIR)$(PREFIX)/lib
> >  TARGETS = checkpolicy checkmodule
> >
> >  LEX = flex
> > @@ -14,6 +12,13 @@ YACC = bison -y
> >
> >  CFLAGS ?= -g -Wall -Werror -Wshadow -O2 -pipe -fno-strict-aliasing
> >
> > +# If no specific libsepol.a is specified, fall back on LDFLAGS search path
> > +# Otherwise, as $(LIBSEPOLA) already appears in the dependencies, there
> > +# is no need to define a value for LDLIBS_LIBSEPOLA
> > +ifeq ($(LIBSEPOLA),)
> > +        LDLIBS_LIBSEPOLA := -l:libsepol.a
> > +endif
> > +
> >  override CFLAGS += -I.

I will remove this override as well.

> >
> >  CHECKOBJS = y.tab.o lex.yy.o queue.o module_compiler.o parse_util.o \
> > @@ -27,8 +32,10 @@ all:  $(TARGETS)
> >         $(MAKE) -C test
> >
> >  checkpolicy: $(CHECKPOLOBJS) $(LIBSEPOLA)
> > +       $(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) $(LDLIBS_LIBSEPOLA)
> >
> >  checkmodule: $(CHECKMODOBJS) $(LIBSEPOLA)
> > +       $(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) $(LDLIBS_LIBSEPOLA)
> 
> Please do not introduce $(CFLAGS) in linking rules (if I remember
> correctly, clang reports warnings when using some compile-time-only
> options at link time, which breaks the build when using -Werror). The
> rules for checkpolicy and checkmodule should be:
> $(CC) $(LDFLAGS) -o $@ $^ $(LDLIBS_LIBSEPOLA)

Will do, thanks

> 
> >  %.o: %.c
> >         $(CC) $(CFLAGS) -o $@ -c $<
> > diff --git a/checkpolicy/test/Makefile b/checkpolicy/test/Makefile
> > index 59fa4460..094e7ee2 100644
> > --- a/checkpolicy/test/Makefile
> > +++ b/checkpolicy/test/Makefile
> > @@ -1,19 +1,26 @@
> >  #
> >  # Makefile for building the dispol program
> >  #
> > -PREFIX ?= $(DESTDIR)/usr
> > -BINDIR ?= $(PREFIX)/bin
> > -LIBDIR ?= $(PREFIX)/lib
> > -INCLUDEDIR ?= $(PREFIX)/include
> > -LIBSEPOLA ?= $(LIBDIR)/libsepol.a
> > +PREFIX ?= /usr
> > +BINDIR ?= $(DESTDIR)$(PREFIX)/bin
> > +LIBDIR ?= $(DESTDIR)$(PREFIX)/lib
> >
> >  CFLAGS ?= -g -Wall -W -Werror -O2 -pipe
> >
> > +# If no specific libsepol.a is specified, fall back on LDFLAGS search path
> > +# Otherwise, as $(LIBSEPOLA) already appears in the dependencies, there
> > +# is no need to define a value for LDLIBS_LIBSEPOLA
> > +ifeq ($(LIBSEPOLA),)
> > +        LDLIBS_LIBSEPOLA := -l:libsepol.a
> > +endif
> > +
> >  all: dispol dismod
> >
> >  dispol: dispol.o $(LIBSEPOLA)
> > +       $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LDLIBS_LIBSEPOLA)
> >
> >  dismod: dismod.o $(LIBSEPOLA)
> > +       $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LDLIBS_LIBSEPOLA)
> 
> Same comment here. Please remove $(CFLAGS).

Will do, thanks

> 
> Best regards,
> Nicolas
> 
> >
> >  clean:
> >         -rm -f dispol dismod *.o
> > --
> > 2.15.1
> >


Best regards
Marcus

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Selinux Refpolicy]     [Linux SGX]     [Fedora Users]     [Fedora Desktop]     [Yosemite Photos]     [Yosemite Camping]     [Yosemite Campsites]     [KDE Users]     [Gnome Users]

  Powered by Linux