Git Product home page Git Product logo

Comments (8)

pali avatar pali commented on August 27, 2024

Even with ab7cd2f it does not work:

$ make Q= CPPFLAGS="-D_FORTIFY_SOURCE=2" CFLAGS="-O2"
echo "  CC llmnr.c" && gcc -O2 -o llmnr.o -c llmnr.c
...

-D_FORTIFY_SOURCE=2 is still not used.

from llmnrd.

tklauser avatar tklauser commented on August 27, 2024

The problem seems to be the equal sign in -D_FORTIFY_SOURCE=2, e.g.

$ make Q= CPPFLAGS="-D_FORTIFY_SOURCE"
echo "  CC llmnr.c" && gcc -W -Wall -O2 -D_FORTIFY_SOURCE -DVERSION_STRING=\"v0.2.1\" -DGIT_VERSION=\""(git id v0.2.1-6-gab7cd2fc9043)"\" -o llmnr.o -c llmnr.c

work fine. Try escaping the passed value accordingly.

from llmnrd.

pali avatar pali commented on August 27, 2024

Does not work

$ make Q= CPPFLAGS="-D_FORTIFY_SOURCE" CFLAGS="-O2"
echo "  CC llmnr.c" && gcc -O2 -o llmnr.o -c llmnr.c

Problems looks like that your Makefile pass CPPFLAGS into CFLAGS, so if CFLAGS are specified outside of Makefile then CPPFLAGS are not used.

Another example via passing as envs to make:

$ Q= CPPFLAGS="-D_FORTIFY_SOURCE" CFLAGS="-g" make
echo "  CC llmnr.c" && gcc -g -DVERSION_STRING=\"v0.2.1\" -DGIT_VERSION=\""(git id v0.2.1-6-gab7cd2f)"\" -o llmnr.o -c llmnr.c
  CC llmnr.c

from llmnrd.

tklauser avatar tklauser commented on August 27, 2024

This is intended behavior at the moment, since we override CFLAGS - not append to it. This way, CPPFLAGS can no longer be used.

Would you expect CFLAGS specified on the command line to be appended?

from llmnrd.

pali avatar pali commented on August 27, 2024

It is common behavior that build script exports CPPFLAGS, CFLAGS and LDFLAGS env variables and run make. Lot of distributions are building packages in this way.

from llmnrd.

tklauser avatar tklauser commented on August 27, 2024

Yes, I see that. But do they commonly assume CFLAGS/CPPFLAGS/LDFLAGS override or append behaviour?

from llmnrd.

pali avatar pali commented on August 27, 2024

All those variables are independent. CFLAGS are "compiler" flag (e.g. -O2 or -g or -W-some-gcc-specific-flag); CPPFLAGS contains only defines (e.g. -DSOMETHING) and LDFLAGS are linker specific flags (e.g. -lm or -Wl,-some-ld-specific-flag). So Makefile should use all variables (in append mode) and not override one by another.

from llmnrd.

tklauser avatar tklauser commented on August 27, 2024

Commit 6281d3c should now fix it to behave as you expect. Thanks!

from llmnrd.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.