dimanche 10 juin 2018

Where to put things (CFLAGS or CXXFLAGS) on Makefile?

First the Makefile here had

CFLAGS   = -g -Wall -lm

I was playing with C that time. Now I'm on C++ and I have to add -I eigen, quick google on it and found CXXFLAGS exist for the C++ world, while CFLAGS exist for the C world. So I updated Makefile to

CFLAGS   = -g -Wall -lm
CXXFLAGS = -I eigen

Then I found https://wiki.gentoo.org/wiki/GCC_optimization, and was inspired to updated it again

CFLAGS   = -g -Wall -lm
CXXFLAGS = ${CFLAGS} -I eigen

The complete thing:

CC       = g++
CFLAGS   = -g -Wall -lm
CXXFLAGS = ${CFLAGS} -I eigen
OBJS     = main.o multiply.o 
PROGRAM  = multitply
$(PROGRAM): $(OBJS)
    $(CC) $(OBJS) $(CFLAGS) -o $(PROGRAM)

Should I add -I eigen to CXXFLAGS or CFLAGS?

Aucun commentaire:

Enregistrer un commentaire