LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Makefile differnce between FreeBSD and Linux (https://www.linuxquestions.org/questions/programming-9/makefile-differnce-between-freebsd-and-linux-276844/)

koyi 01-12-2005 05:26 AM

Makefile differnce between FreeBSD and Linux
 
Hi, I am developing a simple compiler as an assignment in school. And this is the first time I try to use Makefile to handle the compilation process. I use FreeBSD in school and Debian at home. I have a Makefile which starts like this:

Code:

# For FreeBSD
#.if defined(TESTING)
#CFLAGS += -DTESTING
#.endif

#.if defined(PRINT_TREE)
#CFLAGS += -DPRINT_TREE
#.endif

#.if defined(DEBUG)
#CFLAGS += -g
#.endif

# For Linux
ifdef TESTING
CFLAGS += -DTESTING
endif

ifdef PRINT_TREE
CFLAGS += -DPRINT_TREE
endif

ifdef DEBUG
CFLAGS += -g
endif

As you can see, the codes I use to set the compilation options are different on FreeBSD and on Linux. I would like to ask whether there is a way to do this properly that work in both OSes?

Thanks.

kees-jan 01-12-2005 05:38 AM

If you are using gnu make on FreeBSD, as you are on debian, then this difference should not occur.

Which make are you using on FreeBSD?

Code:

$ make -v
GNU Make 3.80
Copyright (C) 2002  Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.


koyi 01-13-2005 08:09 AM

I think it is not GNU make since there is another command which is gmake which showed the above version information.

Why is the Make that comes with FreeBSD so much different with GNU Make???

kees-jan 01-13-2005 02:47 PM

In that case, I suggest you use gmake on FreeBSD to build your code.

Groetjes,

Kees-Jan

jeorj_euler 01-17-2005 10:05 PM

Quote:

Originally posted by koyi

Why is the Make that comes with FreeBSD so much different with GNU Make???

Hard to say, but Berkeley make is designed for sources written "for" operating systems of the BSD family. The question is whether a Berkeley version of a common UNIX utility, such as dd, can be compiled on Linux. One of these days, I will endeauvor to compare the sources.


All times are GMT -5. The time now is 02:54 AM.