diff mbox series

libselinux: Add CPPFLAGS to Makefile

Message ID 20230606093957.2264516-1-chungsheng@google.com (mailing list archive)
State New, archived
Delegated to: Petr Lautrbach
Headers show
Series libselinux: Add CPPFLAGS to Makefile | expand

Commit Message

ChungSheng Wu June 6, 2023, 9:39 a.m. UTC
From: Chung-Sheng Wu <chungsheng@google.com>

Add CPPFLAGS to Makefile to allow users change the flags of
preprocessor.
We offen use CFLAGS for compiler flags and use CPPFLAGS for
preprocessor.

Signed-off-by: Chung-Sheng Wu <chungsheng@google.com>
---
 libselinux/src/Makefile | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

James Carter Aug. 2, 2023, 5 p.m. UTC | #1
On Tue, Jun 6, 2023 at 5:50 AM ChungSheng Wu <chungsheng@google.com> wrote:
>
> From: Chung-Sheng Wu <chungsheng@google.com>
>
> Add CPPFLAGS to Makefile to allow users change the flags of
> preprocessor.
> We offen use CFLAGS for compiler flags and use CPPFLAGS for
> preprocessor.
>
> Signed-off-by: Chung-Sheng Wu <chungsheng@google.com>
> ---
>  libselinux/src/Makefile | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/libselinux/src/Makefile b/libselinux/src/Makefile
> index f9a1e5f5..4e4640f0 100644
> --- a/libselinux/src/Makefile
> +++ b/libselinux/src/Makefile
> @@ -149,10 +149,10 @@ pywrap: all selinuxswig_python_exception.i
>  rubywrap: all $(SWIGRUBYSO)
>
>  $(SWIGRUBYLOBJ): $(SWIGRUBYCOUT)
> -       $(CC) $(CFLAGS) $(SWIG_CFLAGS) $(RUBYINC) -fPIC -DSHARED -c -o $@ $<
> +       $(CC) $(CPPFLAGS) $(CFLAGS) $(SWIG_CFLAGS) $(RUBYINC) -fPIC -DSHARED -c -o $@ $<
>
>  $(SWIGRUBYSO): $(SWIGRUBYLOBJ)
> -       $(CC) $(CFLAGS) $(LDFLAGS) -L. -shared -o $@ $^ -lselinux $(RUBYLIBS)
> +       $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -L. -shared -o $@ $^ -lselinux $(RUBYLIBS)
>
>  $(LIBA): $(OBJS)
>         $(AR) rcs $@ $^
> @@ -169,10 +169,10 @@ selinuxswig_python_exception.i: exception.sh ../include/selinux/selinux.h
>         bash -e exception.sh > $@ || (rm -f $@ ; false)
>
>  %.o:  %.c policy.h
> -       $(CC) $(CFLAGS) $(TLSFLAGS) -c -o $@ $<
> +       $(CC) $(CPPFLAGS) $(CFLAGS) $(TLSFLAGS) -c -o $@ $<
>
>  %.lo:  %.c policy.h
> -       $(CC) $(CFLAGS) -fPIC -DSHARED -c -o $@ $<
> +       $(CC) $(CPPFLAGS) $(CFLAGS) -fPIC -DSHARED -c -o $@ $<
>
>  $(SWIGRUBYCOUT): $(SWIGRUBYIF)
>         $(SWIGRUBY) $<
> --
> 2.41.0.rc0.172.g3f132b7071-goog
>

I am not opposed to this, but I would want it for all of the SELinux
userspace, not just libselinux.
Thanks,
Jim
diff mbox series

Patch

diff --git a/libselinux/src/Makefile b/libselinux/src/Makefile
index f9a1e5f5..4e4640f0 100644
--- a/libselinux/src/Makefile
+++ b/libselinux/src/Makefile
@@ -149,10 +149,10 @@  pywrap: all selinuxswig_python_exception.i
 rubywrap: all $(SWIGRUBYSO)
 
 $(SWIGRUBYLOBJ): $(SWIGRUBYCOUT)
-	$(CC) $(CFLAGS) $(SWIG_CFLAGS) $(RUBYINC) -fPIC -DSHARED -c -o $@ $<
+	$(CC) $(CPPFLAGS) $(CFLAGS) $(SWIG_CFLAGS) $(RUBYINC) -fPIC -DSHARED -c -o $@ $<
 
 $(SWIGRUBYSO): $(SWIGRUBYLOBJ)
-	$(CC) $(CFLAGS) $(LDFLAGS) -L. -shared -o $@ $^ -lselinux $(RUBYLIBS)
+	$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -L. -shared -o $@ $^ -lselinux $(RUBYLIBS)
 
 $(LIBA): $(OBJS)
 	$(AR) rcs $@ $^
@@ -169,10 +169,10 @@  selinuxswig_python_exception.i: exception.sh ../include/selinux/selinux.h
 	bash -e exception.sh > $@ || (rm -f $@ ; false)
 
 %.o:  %.c policy.h
-	$(CC) $(CFLAGS) $(TLSFLAGS) -c -o $@ $<
+	$(CC) $(CPPFLAGS) $(CFLAGS) $(TLSFLAGS) -c -o $@ $<
 
 %.lo:  %.c policy.h
-	$(CC) $(CFLAGS) -fPIC -DSHARED -c -o $@ $<
+	$(CC) $(CPPFLAGS) $(CFLAGS) -fPIC -DSHARED -c -o $@ $<
 
 $(SWIGRUBYCOUT): $(SWIGRUBYIF)
 	$(SWIGRUBY) $<