Re: Re: Build Under Linux
Home › Forums › Development › Build Under Linux › Re: Re: Build Under Linux
@puddles wrote:
@dynmosaic wrote:
For build under windows, the same Makefile won’t work, since there is no sudo -E command.
Yeah, I called the build steps dir1, dir2, dir3, etc. just to avoid the problem you discovered. I had thought of using d_pcre (for example) but thought it was too much typing.
If you’re interested in it building under windows also, better to just add some intelligence in the makefile itself, and use a single makefile.
Just have some conditional code like this in the Makefile:
ifeq ($(shell uname), Linux)
SUDO_CMD=sudo -E
else
SUDO_CMD=sudo
endif
all:
@echo sudo command is $(SUDO_CMD)
Thanks puddles. A cross platform Makefile would be the best. I will test this.
Update:
On my Win7 installed with Cygwin, my uname is MINGW32_NT-6.1, but since I am only building under Windows and Linux, so an else would suffice, but if this Makefile is going to be made cross platform, maybe some other platform name should be included.
ifeq ($(shell uname), Linux)
SUDO_CMD=sudo -E
else
SUDO_CMD=
endif
all:
@echo sudo command is $(SUDO_CMD)
I have included the new Makefile, tested working under both Win7 and Ubuntu 10.10. One more advantage, I no longer need to start a MingW windows, since my dos command line was setup with the correct path to my Cygwin installation. I think it’s because the change I made to your COMMAND3 with the addition of the –build for libmpg123. Anyway, here is my final Makefile.
ifeq ($(shell uname), Linux)
SUDO_CMD=sudo -E
else
SUDO_CMD=
endif
COMMAND1 = (make && $(SUDO_CMD) make install)
COMMAND2 = (CC=$(DEVKITPPC)/bin/powerpc-eabi-gcc CXX=$(DEVKITPPC)/bin/powerpc-eabi-g++ ./configure --host=powerpc-eabi --build=powerpc-eabi-gnu --prefix="${DEVKITPRO}/portlibs/ppc" --libdir="${DEVKITPRO}/portlibs/ppc/lib" --disable-shared &&
make && $(SUDO_CMD) make install)
COMMAND3 = (CC=$(DEVKITPPC)/bin/powerpc-eabi-gcc ./configure --host=powerpc-eabi --build=powerpc-eabi-gnu --prefix="${DEVKITPRO}/portlibs/ppc" --libdir="${DEVKITPRO}/portlibs/ppc/lib" --enable-shared=no --enable-static=yes --with-cpu=ppc_nofpu --with-optimization=3 &&
cd src/libmpg123 && make && $(SUDO_CMD) make install)
all: dir1 dir2 dir3 dir4 dir5 dir6
dir1:
cd libntfs && $(COMMAND1)
dir2:
cd fribidi && $(COMMAND2)
dir3:
cd libexif && $(COMMAND2)
dir4:
cd libiconv && $(COMMAND2)
dir5:
cd pcre && $(COMMAND2)
dir6:
cd libmpg123 && $(COMMAND3)
I have also included the Makefile.gz for completeness.
