Hi,
On 10/25/07 18:54, Uwe Hermann wrote:
On Thu, Oct 25, 2007 at 04:44:28PM +0200, Philip Schulz wrote:
[...]
Unfortunately, I have no idea how to detect FreeBSD from a Makefile or a Python script. But maybe someone on this list knows and wants enhance the patches so they can be included in the LinuxBIOS tree.
[...]
Most of your patch is just make -> gmake, so it should be easy to use $(MAKE) everywhere and set that to "gmake" on FreeBSD and "make" everywhere else.
It seems that on FreeBSD, ${MAKE} is set to the name of the binary you invoke (gnumake is a hard-link to gmake in this example):
[phs@thinkpad ~]$ cat Makefile all: echo ${MAKE}
[phs@thinkpad ~]$ make echo make make [phs@thinkpad ~]$ gmake echo gmake gmake [phs@thinkpad ~]$ gnumake echo gnumake gnumake
Anyways, attached is an updated version of the initial patch. It hopefully doesn't brake builds on Linux and makes LinuxBIOS (and ADLO) compile on FreeBSD. Also, this uses "domainname" instead of "dnsdomainname" on FreeBSD.
Signed-off-by: Philip Schulz phs@deadc0.de
I hope this is the correct way to post a patch.
Regards,
Philip
Index: src/config/Config.lb =================================================================== --- src/config/Config.lb (revision 2944) +++ src/config/Config.lb (working copy) @@ -5,7 +5,7 @@
makedefine CPP:= $(CC) -x assembler-with-cpp -DASSEMBLY -E makedefine LIBGCC_FILE_NAME := $(shell $(CC) -print-libgcc-file-name) -makedefine GCC_INC_DIR := $(shell $(CC) -print-search-dirs | sed -ne "s/install: (.*)/\1include/gp") +makedefine GCC_INC_DIR := $(shell if [ `uname` = "FreeBSD" ] ; then echo "/usr/include" ; else $(CC) -print-search-dirs | sed -ne "s/install: (.*)/\1include/gp" ; fi )
makedefine CPPFLAGS := -I$(TOP)/src/include -I$(TOP)/src/arch/$(ARCH)/include -I$(GCC_INC_DIR) $(CPUFLAGS) makedefine CFLAGS := $(CPU_OPT) $(CPPFLAGS) -Os -nostdinc -nostdlib -fno-builtin -Wall Index: src/config/Options.lb =================================================================== --- src/config/Options.lb (revision 2944) +++ src/config/Options.lb (working copy) @@ -134,7 +134,7 @@ end
define LINUXBIOS_COMPILE_DOMAIN - default "$(shell dnsdomainname)" + default "$(shell if [ `uname` = "FreeBSD" ] ; then domainname ; else dnsdomainname ; fi )" export always format ""%s"" comment "Build domain name" Index: util/ADLO/Makefile =================================================================== --- util/ADLO/Makefile (revision 2944) +++ util/ADLO/Makefile (working copy) @@ -40,7 +40,7 @@ #-------------------------------------------------
bios: - ( cd ${BOCHS_B} ; make ) + ( cd ${BOCHS_B} ; ${MAKE} ) sync
#------------------------------------------------- @@ -101,7 +101,7 @@
clean: rm -rf *.o ${PAYLOAD} - (cd ${BOCHS_B} ; make clean ) + (cd ${BOCHS_B} ; ${MAKE} clean )
distclean: clean rm -rf ${BOCHS_C} Index: util/newconfig/config.g =================================================================== --- util/newconfig/config.g (revision 2944) +++ util/newconfig/config.g (working copy) @@ -2158,7 +2158,7 @@ for i, o in romimages.items(): file.write("%s/linuxbios.rom:\n" % o.getname()) file.write("\tif (cd %s; \\n" % o.getname()) - file.write("\t\tmake linuxbios.rom)\\n") + file.write("\t\t${MAKE} linuxbios.rom)\\n") file.write("\tthen true; else exit 1; fi;\n\n") file.write("clean: ") for i in romimages.keys(): @@ -2166,7 +2166,7 @@ file.write("\n\n") for i, o in romimages.items(): file.write("%s-clean:\n" % o.getname()) - file.write("\t(cd %s; make clean)\n\n" % o.getname()) + file.write("\t(cd %s; ${MAKE} clean)\n\n" % o.getname())
for i in buildroms: file.write("%s:" % i.name)