Some makefile modifications to:
>>disable the logic that detects and sets architecture (it screws up cross-compiling)
>>disable some secondary build functions like creating changelogs or report files for other tools
>>disable the install functionality as we take the files we need with OpenWrt build system
>>changes to all makefiles to respect the compile flags

--- a/Makefile	
+++ b/Makefile	
@@ -1,6 +1,6 @@
 TOPDIR		= $(CURDIR)
 SUBDIRS		= src
-TARGETS		= hwinfo hwinfo.pc changelog
+TARGETS		= hwinfo
 CLEANFILES	= hwinfo hwinfo.pc hwinfo.static hwscan hwscan.static hwscand hwscanqueue doc/libhd doc/*~
 LIBS		= -lhd
 SLIBS		= -lhd -luuid
@@ -18,11 +18,11 @@
 
 include Makefile.common
 
-ifeq "$(ARCH)" "x86_64"
-LIBDIR		?= /usr/lib64
-else
+#ifeq "$(ARCH)" "x86_64"
+#LIBDIR		?= /usr/lib64
+#else
 LIBDIR		?= /usr/lib
-endif
+#endif
 ULIBDIR		= $(LIBDIR)
 
 # this library has been removed from the code, disabling it here too
@@ -39,13 +39,13 @@
 
 .PHONY:	fullstatic static shared tiny doc diet tinydiet uc tinyuc
 
-ifdef HWINFO_VERSION
+#ifdef HWINFO_VERSION
 changelog:
 	@true
-else
-changelog: $(GITDEPS)
-	$(GIT2LOG) --changelog changelog
-endif
+#else
+#changelog: $(GITDEPS)
+#	$(GIT2LOG) --changelog changelog
+#endif
 
 hwscan: hwscan.o $(LIBHD)
 	$(CC) hwscan.o $(LDFLAGS) $(CFLAGS) $(LIBS) -o $@
@@ -99,28 +99,29 @@
 	@cd doc ; doxygen libhd.doxy
 
 install:
-	install -d -m 755 $(DESTDIR)/sbin $(DESTDIR)/usr/sbin $(DESTDIR)$(ULIBDIR) \
-		$(DESTDIR)$(ULIBDIR)/pkgconfig $(DESTDIR)/usr/include
-	install -m 755 hwinfo $(DESTDIR)/usr/sbin
-	install -m 755 src/ids/check_hd $(DESTDIR)/usr/sbin
-	install -m 755 src/ids/convert_hd $(DESTDIR)/usr/sbin
-	if [ -f $(LIBHD_SO) ] ; then \
-		install $(LIBHD_SO) $(DESTDIR)$(ULIBDIR) ; \
-		ln -snf $(LIBHD_NAME) $(DESTDIR)$(ULIBDIR)/$(LIBHD_SONAME) ; \
-		ln -snf $(LIBHD_SONAME) $(DESTDIR)$(ULIBDIR)/$(LIBHD_BASE).so ; \
-	else \
-		install -m 644 $(LIBHD) $(DESTDIR)$(ULIBDIR) ; \
-	fi
-	install -m 644 hwinfo.pc $(DESTDIR)$(ULIBDIR)/pkgconfig
-	install -m 644 src/hd/hd.h $(DESTDIR)/usr/include
-	perl -pi -e "s/define\s+HD_VERSION\b.*/define HD_VERSION\t\t$(LIBHD_MAJOR_VERSION)/" $(DESTDIR)/usr/include/hd.h
-	perl -pi -e "s/define\s+HD_MINOR_VERSION\b.*/define HD_MINOR_VERSION\t$(LIBHD_MINOR_VERSION)/" $(DESTDIR)/usr/include/hd.h
-	install -m 755 getsysinfo $(DESTDIR)/usr/sbin
-	install -m 755 src/isdn/cdb/mk_isdnhwdb $(DESTDIR)/usr/sbin
-	install -d -m 755 $(DESTDIR)/usr/share/hwinfo
-	install -d -m 755 $(DESTDIR)/var/lib/hardware/udi
-	install -m 644 src/isdn/cdb/ISDN.CDB.txt $(DESTDIR)/usr/share/hwinfo
-	install -m 644 src/isdn/cdb/ISDN.CDB.hwdb $(DESTDIR)/usr/share/hwinfo
+#	install -d -m 755 $(DESTDIR)/sbin $(DESTDIR)/usr/sbin $(DESTDIR)$(ULIBDIR) \
+#		$(DESTDIR)$(ULIBDIR)/pkgconfig $(DESTDIR)/usr/include
+#	install -m 755 hwinfo $(DESTDIR)/usr/sbin
+#	install -m 755 src/ids/check_hd $(DESTDIR)/usr/sbin
+#	install -m 755 src/ids/convert_hd $(DESTDIR)/usr/sbin
+#	if [ -f $(LIBHD_SO) ] ; then \
+#		install $(LIBHD_SO) $(DESTDIR)$(ULIBDIR) ; \
+#		ln -snf $(LIBHD_NAME) $(DESTDIR)$(ULIBDIR)/$(LIBHD_SONAME) ; \
+#		ln -snf $(LIBHD_SONAME) $(DESTDIR)$(ULIBDIR)/$(LIBHD_BASE).so ; \
+#	else \
+#		install -m 644 $(LIBHD) $(DESTDIR)$(ULIBDIR) ; \
+#	fi
+#	install -m 644 hwinfo.pc $(DESTDIR)$(ULIBDIR)/pkgconfig
+#	install -m 644 src/hd/hd.h $(DESTDIR)/usr/include
+#	perl -pi -e "s/define\s+HD_VERSION\b.*/define HD_VERSION\t\t$(LIBHD_MAJOR_VERSION)/" $(DESTDIR)/usr/include/hd.h
+#	perl -pi -e "s/define\s+HD_MINOR_VERSION\b.*/define HD_MINOR_VERSION\t$(LIBHD_MINOR_VERSION)/" $(DESTDIR)/usr/include/hd.h
+#	install -m 755 getsysinfo $(DESTDIR)/usr/sbin
+#	install -m 755 src/isdn/cdb/mk_isdnhwdb $(DESTDIR)/usr/sbin
+#	install -d -m 755 $(DESTDIR)/usr/share/hwinfo
+#	install -d -m 755 $(DESTDIR)/var/lib/hardware/udi
+#	install -m 644 src/isdn/cdb/ISDN.CDB.txt $(DESTDIR)/usr/share/hwinfo
+#	install -m 644 src/isdn/cdb/ISDN.CDB.hwdb $(DESTDIR)/usr/share/hwinfo
+	@true
 
 archive: changelog
 	@if [ ! -d .git ] ; then echo no git repo ; false ; fi

--- a/Makefile.common
+++ b/Makefile.common
@@ -1,28 +1,26 @@
 # libhd/Makefile.common
 
-ARCH	:= $(shell uname -m)
-ifeq "$(ARCH)" "i486"
-ARCH	:= i386
-endif
-ifeq "$(ARCH)" "i586"
-ARCH	:= i386
-endif
-ifeq "$(ARCH)" "i686"
-ARCH	:= i386
-endif
-ifeq "$(ARCH)" "parisc"
-EXTRA_FLAGS := -fPIC $(EXTRA_FLAGS)
-endif
+#ARCH	:= $(shell uname -m)
+#ifeq "$(ARCH)" "i486"
+#ARCH	:= i386
+#endif
+#ifeq "$(ARCH)" "i586"
+#ARCH	:= i386
+#endif
+#ifeq "$(ARCH)" "i686"
+#ARCH	:= i386
+#endif
+#ifeq "$(ARCH)" "parisc"
+#EXTRA_FLAGS := -fPIC $(EXTRA_FLAGS)
+#endif
 
 LIBHD_VERSION		:= $(shell cat $(TOPDIR)/VERSION)
 LIBHD_MINOR_VERSION	:= $(shell cut -d . -f 2 $(TOPDIR)/VERSION)
 LIBHD_MAJOR_VERSION	:= $(shell cut -d . -f 1 $(TOPDIR)/VERSION)
 
-RPM_OPT_FLAGS	?= -O2
-
 CC	?= gcc
 LD	= ld
-CFLAGS += $(RPM_OPT_FLAGS) -Wall -Wno-pointer-sign -pipe -g $(SHARED_FLAGS) $(EXTRA_FLAGS) -I$(TOPDIR)/src/hd
+CFLAGS += -Wall -Wno-pointer-sign $(SHARED_FLAGS) $(EXTRA_FLAGS) -I$(TOPDIR)/src/hd
 SHARED_FLAGS	= -fPIC
 
 LDFLAGS	+= -Lsrc
@@ -36,7 +34,7 @@
 LIBHD_SO	= $(TOPDIR)/src/$(LIBHD_NAME)
 LIBHD_D		= $(TOPDIR)/src/.lib
 
-export CC TOPDIR CFLAGS LIBHD ARCH
+export CC TOPDIR CFLAGS LIBHD 
 
 .PHONY: all distclean clean install subdirs
 

--- a/src/Makefile
+++ b/src/Makefile
@@ -12,7 +12,7 @@
 #endif
 
 $(LIBHD): $(OBJS)
-	ar r $@ $?
+	$(AR) r $@ $?
 	@rm -f $(LIBHD_D)
 
 ifdef SHARED_FLAGS
--- a/src/hd/Makefile
+++ b/src/hd/Makefile
@@ -12,4 +12,4 @@
 	@perl -pi -e "s/define\s+HD_MINOR_VERSION\s+\d+/define HD_MINOR_VERSION\t$(LIBHD_MINOR_VERSION)/" $@
 
 $(LIBHD_D): $(OBJS)
-	ar r $(LIBHD) $?
+	$(AR) r $(LIBHD) $?
 
--- a/src/isdn/Makefile
+++ b/src/isdn/Makefile
@@ -5,5 +5,5 @@
 include $(TOPDIR)/Makefile.common
 
 $(LIBHD_D): $(OBJS)
-	ar r $(LIBHD) $?
+	$(AR) r $(LIBHD) $?
 
--- a/src/smp/Makefile
+++ b/src/smp/Makefile
@@ -4,4 +4,4 @@
 include $(TOPDIR)/Makefile.common
 
 $(LIBHD_D): $(OBJS)
-	ar r $(LIBHD) $?
+	$(AR) r $(LIBHD) $?