make on multiple platforms

K

Khookie

Hi

I'm sure not if this is the right newsgroup since this is (possibly) a
question about make, but hopefully someone here might know the best
way about this.

I've built a program that compiles well on my Ubuntu PC.

However, I also wanted to compile it on my Mac (which has MacPorts
installed & the necessary libraries installed).

Now with MacPorts, all the include/lib paths are different, hence the
makefile I have doesn't work too well unless I create another one
(which I've done for now).

Is there a way I can just have one makefile, which has both settings,
and can compile accordingly?

Cheers

Chris
 
U

user923005

Hi

I'm sure not if this is the right newsgroup since this is (possibly) a
question about make, but hopefully someone here might know the best
way about this.

I've built a program that compiles well on my Ubuntu PC.

However, I also wanted to compile it on my Mac (which has MacPorts
installed & the necessary libraries installed).

Now with MacPorts, all the include/lib paths are different, hence the
makefile I have doesn't work too well unless I create another one
(which I've done for now).

Is there a way I can just have one makefile, which has both settings,
and can compile accordingly?

Sure, try
man make
for more info.
 
C

CBFalconer

Khookie said:
I'm sure not if this is the right newsgroup since this is
(possibly) a question about make, but hopefully someone here
might know the best way about this.

I've built a program that compiles well on my Ubuntu PC.

However, I also wanted to compile it on my Mac (which has
MacPorts installed & the necessary libraries installed).

Now with MacPorts, all the include/lib paths are different, hence
the makefile I have doesn't work too well unless I create another
one (which I've done for now).

Is there a way I can just have one makefile, which has both
settings, and can compile accordingly?

Just configure your compiler correctly.
 
K

karthikbalaguru

Hi

I'm sure not if this is the right newsgroup since this is (possibly) a
question about make, but hopefully someone here might know the best
way about this.

I've built a program that compiles well on my Ubuntu PC.

However, I also wanted to compile it on my Mac (which has MacPorts
installed & the necessary libraries installed).

Now with MacPorts, all the include/lib paths are different, hence the
makefile I have doesn't work too well unless I create another one
(which I've done for now).

Is there a way I can just have one makefile, which has both settings,
and can compile accordingly?

Why do you try compiling applications of different environment
in irrelevant environments. Get the correct setup . That will
help you.

If you are trying to port from one environment into another
environment. Then , try correlating the Makefile syntax of
both the environment and incorporate the corresponding changes
into the new environment.
Take care of compiler dependency, linker dependency, calling
conventions, bitfields, byte alignment, datatypes and others
w.r.t porting.

If you need to make the makefile compatible with both the
environment, i doubt it is possible with a single makefile as the
Makefile syntax can vary from environment to environment. Maybe, you
can have different independnt makefiles for both the environments .

But there is a way in the Makefile to manage multiple environments.
In this solution, the makefile for each module is placed in the /
native directory, and GCC flags (<platform>.mk) are placed in the make/
platform directory for each platform. During building, the makefile of
each module automatically finds the <platform>.mk file at run time and
includes them to constitute an integral native build script. The
script also chooses platform-specific code in a particular directory.

Try the manpages of Makefile, it has got good information.

Karthik Balaguru
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,011
Latest member
AjaUqq1950

Latest Threads

Top