Browse Source

Merge branch 'master' of git+ssh://openadk.org/git/openadk

Waldemar Brodkorb 14 years ago
parent
commit
6c3f7bc559
100 changed files with 830 additions and 329 deletions
  1. 1 1
      Makefile
  2. 22 22
      config/Makefile
  3. 1 1
      mk/build.mk
  4. 2 8
      mk/kernel-vars.mk
  5. 12 48
      mk/package.mk
  6. 65 29
      mk/vars.mk
  7. 6 6
      package/aiccu/Makefile
  8. 4 2
      package/alix-switch/Makefile
  9. 4 4
      package/arpd/Makefile
  10. 4 5
      package/asterisk/Makefile
  11. 5 4
      package/atftp/Makefile
  12. 1 1
      package/aufs2-util/Makefile
  13. 4 4
      package/aufs2-util/patches/patch-Makefile
  14. 1 1
      package/avahi/Makefile
  15. 1 3
      package/axtls/Makefile
  16. 17 16
      package/bind/Makefile
  17. 1 1
      package/binutils/Makefile
  18. 1 1
      package/bitlbee/Makefile
  19. 1 2
      package/bzip2/Makefile
  20. 2 2
      package/cryptinit/Makefile
  21. 2 2
      package/cups/Makefile
  22. 4 2
      package/cutter/Makefile
  23. 5 5
      package/cxxtools/Makefile
  24. 1 1
      package/digitemp/Makefile
  25. 2 3
      package/dillo/Makefile
  26. 5 5
      package/e2fsprogs/Makefile
  27. 3 3
      package/eglibc/Makefile
  28. 1 1
      package/elinks/Makefile
  29. 4 2
      package/ether-wake/Makefile
  30. 1 6
      package/exmap/Makefile
  31. 1 1
      package/faad2/Makefile
  32. 4 2
      package/fakeidentd/Makefile
  33. 1 5
      package/ffmpeg/Makefile
  34. 7 3
      package/firefox/Makefile
  35. 2 2
      package/firefox/patches/patch-configure
  36. 15 0
      package/firefox/patches/patch-security_coreconf_Linux_mk
  37. 11 0
      package/firefox/patches/patch-security_coreconf_command_mk
  38. 2 2
      package/gatling/Makefile
  39. 5 2
      package/gcc/Makefile
  40. 4 2
      package/gdb/Makefile
  41. 1 1
      package/gpm/Makefile
  42. 4 4
      package/gpsd/Makefile
  43. 1 1
      package/haserl/Makefile
  44. 7 7
      package/heimdal/Makefile
  45. 1 1
      package/heimdal/patches/patch-lib_roken_Makefile_in
  46. 1 2
      package/httping/Makefile
  47. 3 1
      package/huawei/Makefile
  48. 1 1
      package/icecast/Makefile
  49. 3 3
      package/id3lib/Makefile
  50. 2 3
      package/igmpproxy/Makefile
  51. 3 3
      package/iperf/Makefile
  52. 2 2
      package/iproute2/Makefile
  53. 1 4
      package/ipset/Makefile
  54. 36 0
      package/ipset/patches/patch-Makefile
  55. 63 7
      package/iptraf/patches/patch-src_Makefile
  56. 5 4
      package/iptraf/patches/patch-support_Makefile
  57. 1 1
      package/iw/Makefile
  58. 0 1
      package/knock/Makefile
  59. 1 1
      package/krb5/Makefile
  60. 2 0
      package/libart/Makefile
  61. 1 2
      package/libevent/Makefile
  62. 4 2
      package/libhugetlbfs/Makefile
  63. 3 3
      package/libhugetlbfs/patches/patch-Makefile
  64. 11 0
      package/libhugetlbfs/patches/patch-morecore_c
  65. 5 0
      package/libhugetlbfs/patches/patch-version
  66. 1 1
      package/libiconv/Makefile
  67. 1 1
      package/libid3tag/Makefile
  68. 14 0
      package/libid3tag/patches/patch-configure
  69. 0 1
      package/libnet/Makefile
  70. 11 0
      package/libosip2/patches/patch-configure
  71. 1 1
      package/libowfat/Makefile
  72. 2 2
      package/libpcap/Makefile
  73. 1 1
      package/libpri/Makefile
  74. 32 2
      package/libpri/patches/patch-Makefile
  75. 1 1
      package/libupnp/Makefile
  76. 1 1
      package/libvirt/Makefile
  77. 1 1
      package/lighttpd/Makefile
  78. 1 1
      package/logrotate/Makefile
  79. 2 2
      package/lua/Makefile
  80. 2 5
      package/lynx/Makefile
  81. 1 1
      package/madplay/Makefile
  82. 14 0
      package/madplay/patches/patch-configure
  83. 3 4
      package/maradns/Makefile
  84. 13 5
      package/maradns/patches/cross-compile-fix.patch
  85. 11 11
      package/maradns/patches/patch-Makefile
  86. 4 4
      package/maradns/patches/patch-build_Makefile_linux
  87. 21 2
      package/maradns/patches/patch-dns_Makefile
  88. 21 0
      package/maradns/patches/patch-dns_Makefile_recursive
  89. 31 0
      package/maradns/patches/patch-libs_Makefile
  90. 80 0
      package/maradns/patches/patch-parse_Makefile
  91. 9 0
      package/maradns/patches/patch-qual_Makefile_threadsafe
  92. 2 2
      package/maradns/patches/patch-rng_rng-32bit-tables_h
  93. 32 8
      package/maradns/patches/patch-server_Makefile
  94. 37 0
      package/maradns/patches/patch-server_Makefile_recursive
  95. 17 2
      package/maradns/patches/patch-tcp_Makefile
  96. 17 0
      package/maradns/patches/patch-tcp_Makefile_recursive
  97. 25 0
      package/maradns/patches/patch-tools_Makefile_recursive
  98. 20 2
      package/mgetty/patches/patch-Makefile
  99. 3 3
      package/miax/Makefile
  100. 1 1
      package/microperl/Makefile

+ 1 - 1
Makefile

@@ -215,7 +215,7 @@ NO_ERROR=0
 	@echo "_PATH:=$$PATH" >>prereq.mk
 	@echo "PATH:=\$${TOPDIR}/scripts:/usr/sbin:$$PATH" >>prereq.mk
 	@echo "SHELL:=$$(which bash)" >>prereq.mk
-	@echo "HOST_LIBIDL_CONFIG:=$$(which libIDL-config-2 2>/dev/null)" >>prereq.mk
+	@echo "BUILD_LIBIDL_CONFIG:=$$(which libIDL-config-2 2>/dev/null)" >>prereq.mk
 	@echo "PKG_HOSTLIB_DIR=$$(eval pkg-config --variable pc_path pkg-config 2>/dev/null)" >/dev/null
 	@echo "PKG_HOSTLIB_DIR:=$${PKG_HOSTLIB_DIR:-/usr/lib/pkgconfig}" >>prereq.mk
 	@env NO_ERROR=${NO_ERROR} BASH="$$(which bash)" \

+ 22 - 22
config/Makefile

@@ -6,31 +6,31 @@ include ${TOPDIR}/rules.mk
 endif
 
 CP=cp -fpR
-HOSTCFLAGS+=-DKBUILD_NO_NLS
+CFLAGS_FOR_BUILD+=-DKBUILD_NO_NLS
 
 all: ncurses conf mconf
 
 LIBS=		-lncurses
 ifeq (/usr/include/ncurses/ncurses.h, $(wildcard /usr/include/ncurses/ncurses.h))
-HOSTNCURSES+=	-I/usr/include/ncurses -DCURSES_LOC="<ncurses.h>"
+CFLAGS_FOR_BUILD+=	-I/usr/include/ncurses -DCURSES_LOC="<ncurses.h>"
 else
 ifeq (/usr/include/ncurses/curses.h, $(wildcard /usr/include/ncurses/curses.h))
-HOSTNCURSES+=	-I/usr/include/ncurses -DCURSES_LOC="<ncurses/curses.h>"
+CFLAGS_FOR_BUILD+=	-I/usr/include/ncurses -DCURSES_LOC="<ncurses/curses.h>"
 else
 ifeq (/usr/local/include/ncurses/ncurses.h, $(wildcard /usr/local/include/ncurses/ncurses.h))
-HOSTCFLAGS+=	-I/usr/local/include/ncurses -DCURSES_LOC="<ncurses.h>"
+CFLAGS_FOR_BUILD+=	-I/usr/local/include/ncurses -DCURSES_LOC="<ncurses.h>"
 else
 ifeq (/usr/local/include/ncurses/curses.h, $(wildcard /usr/local/include/ncurses/curses.h))
-HOSTCFLAGS+=	-I/usr/local/include/ncurses -DCURSES_LOC="<ncurses/curses.h>"
+CFLAGS_FOR_BUILD+=	-I/usr/local/include/ncurses -DCURSES_LOC="<ncurses/curses.h>"
 else
 ifeq (/usr/pkg/include/ncurses.h, $(wildcard /usr/pkg/include/ncurses.h))
-HOSTCFLAGS+=	-I/usr/pkg/include -DCURSES_LOC="<ncurses.h>"
+CFLAGS_FOR_BUILD+=	-I/usr/pkg/include -DCURSES_LOC="<ncurses.h>"
 LIBS+=		-L/usr/pkg/lib -Wl,-rpath -Wl,/usr/pkg/lib
 else
 ifeq (/usr/include/ncurses.h, $(wildcard /usr/include/ncurses.h))
-HOSTNCURSES+=	-DCURSES_LOC="<ncurses.h>"
+CFLAGS_FOR_BUILD+=	-DCURSES_LOC="<ncurses.h>"
 else
-HOSTNCURSES+=	-DCURSES_LOC="<curses.h>"
+CFLAGS_FOR_BUILD+=	-DCURSES_LOC="<curses.h>"
 LIBS=		-lcurses
 endif
 endif
@@ -39,8 +39,8 @@ endif
 endif
 endif
 
-HOSTGTKLIBS = `pkg-config --libs gtk+-2.0 gmodule-2.0 libglade-2.0`
-HOSTGTKCFLAGS = `pkg-config --cflags gtk+-2.0 gmodule-2.0 libglade-2.0`
+GTKLIBS = `pkg-config --libs gtk+-2.0 gmodule-2.0 libglade-2.0`
+GTKCFLAGS = `pkg-config --cflags gtk+-2.0 gmodule-2.0 libglade-2.0`
 
 CONF_SRC  =conf.c
 MCONF_SRC =mconf.c $(wildcard lxdialog/*.c)
@@ -53,25 +53,25 @@ GCONF_OBJS=$(patsubst %.c,%.o, $(GCONF_SRC))
 SHARED_OBJS=$(patsubst %.c,%.o, $(SHARED_SRC))
 
 conf: $(CONF_OBJS) $(SHARED_OBJS)
-	@$(HOSTCC) $(HOSTCFLAGS) $(NATIVE_LDFLAGS) $^ -o $@
+	@$(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(NATIVE_LDFLAGS) $^ -o $@
 
 mconf: $(MCONF_OBJS) $(SHARED_OBJS)
-	@$(HOSTCC) $(HOSTCFLAGS) $(NATIVE_LDFLAGS) $^ -o $@ $(LIBS)
+	@$(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(NATIVE_LDFLAGS) $^ -o $@ $(LIBS)
 
 gconf: $(GCONF_OBJS) $(SHARED_OBJS)
-	@$(HOSTCC) $(HOSTCFLAGS) $(NATIVE_LDFLAGS) $^ -o $@ $(HOSTGTKLIBS)
+	@$(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(NATIVE_LDFLAGS) $^ -o $@ $(GTKLIBS)
 
 $(CONF_OBJS): %.o : %.c $(SHARED_DEPS)
-	@$(HOSTCC) $(HOSTCFLAGS) -I. -c $< -o $@
+	@$(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) -I. -c $< -o $@
 
 $(MCONF_OBJS): %.o : %.c $(SHARED_DEPS)
-	@$(HOSTCC) $(HOSTCFLAGS) $(HOSTNCURSES) -I. -c $< -o $@
+	@$(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(HOSTNCURSES) -I. -c $< -o $@
 
 $(GCONF_OBJS): %.o : %.c $(SHARED_DEPS)
-	@$(HOSTCC) $(HOSTCFLAGS) $(HOSTGTKCFLAGS) -DLKC_DIRECT_LINK -I. -c $< -o $@
+	@$(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(GTKCFLAGS) -DLKC_DIRECT_LINK -I. -c $< -o $@
 
 glob.o: glob.c $(SHARED_DEPS)
-	@$(HOSTCC) $(HOSTCFLAGS) -I. -c glob.c -o $@
+	@$(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) -I. -c glob.c -o $@
 
 lkc_defs.h: lkc_proto.h
 	@sed < $< > $@ 's/P(\([^,]*\),.*/#define \1 (\*\1_p)/'
@@ -94,15 +94,15 @@ lex.%.c: %.l
 	flex -P$(notdir $*) -o$@ $<
 
 lex.zconf.o: lex.zconf.c $(SHARED_DEPS)
-	$(HOSTCC) $(HOSTCFLAGS) -I. -c $< -o $@
+	$(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) -I. -c $< -o $@
 
 zconf.tab.o: zconf.tab.c zconf.hash.c lex.zconf.c confdata.c expr.c symbol.c menu.c $(SHARED_DEPS)
-	$(HOSTCC) $(HOSTCFLAGS) -I. -c $< -o $@
+	$(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) -I. -c $< -o $@
 
 else
 
 lex.zconf.o: lex.zconf.c $(SHARED_DEPS)
-	$(HOSTCC) $(HOSTCFLAGS) -I. -c $< -o $@
+	$(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) -I. -c $< -o $@
 
 lex.zconf.c: lex.zconf.c_shipped
 	@$(CP) lex.zconf.c_shipped lex.zconf.c
@@ -111,7 +111,7 @@ zconf.hash.c: zconf.hash.c_shipped
 	@$(CP) zconf.hash.c_shipped zconf.hash.c
 
 zconf.tab.o: zconf.tab.c zconf.hash.c lex.zconf.c confdata.c expr.c symbol.c menu.c $(SHARED_DEPS)
-	@$(HOSTCC) $(HOSTCFLAGS) -I. -c $< -o $@
+	@$(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) -I. -c $< -o $@
 
 zconf.tab.c: zconf.tab.c_shipped
 	@$(CP) zconf.tab.c_shipped zconf.tab.c
@@ -124,7 +124,7 @@ endif
 
 ncurses:
 	@echo "int main(void) { return -1; }" > lxtemp.c
-	@if $(HOSTCC) $(HOSTCFLAGS) lxtemp.c $(LIBS) ; then \
+	@if $(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) lxtemp.c $(LIBS) ; then \
 		rm -f lxtemp.c a.out; \
 	else \
 		rm -f lxtemp.c; \

+ 1 - 1
mk/build.mk

@@ -252,7 +252,7 @@ ifeq ($(filter-out distclean,${MAKECMDGOALS}),)
 include ${TOPDIR}/mk/vars.mk
 else
 include $(TOPDIR)/prereq.mk
-export BASH HOSTCC HOSTCFLAGS HOSTCXX HOSTCXXFLAGS MAKE LANGUAGE LC_ALL OStype PATH
+export BASH MAKE LANGUAGE LC_ALL OStype PATH CC_FOR_BUILD
 endif
 
 all: menuconfig

+ 2 - 8
mk/kernel-vars.mk

@@ -4,12 +4,6 @@
 KERNEL_MAKE_OPTS:=	-C "${LINUX_DIR}" V=1
 ifneq ($(ADK_NATIVE),y)
 KERNEL_MAKE_OPTS+=	CROSS_COMPILE="$(TARGET_CROSS)" ARCH=$(ARCH) \
-			CC="$(TARGET_CC)" HOSTCC="${HOSTCC}" \
-			HOSTCFLAGS='${HOSTCFLAGS}'
+			CC="$(TARGET_CC)" HOSTCC="${CC_FOR_BUILD}" \
+			HOSTCFLAGS='${CFLAGS_FOR_BUILD}'
 endif
-
-ifeq (${ADK_TARGET_SYSTEM_LINKSYS_WRT54G},y)
-ADK_KCPPFLAGS+=		-DBCM47XX_OVERRIDE_FLASHSIZE=0x400000
-endif
-
-KERNEL_MAKE_ENV+=	KCPPFLAGS='${ADK_KCPPFLAGS}'

+ 12 - 48
mk/package.mk

@@ -7,32 +7,6 @@ ifeq ($(ADK_HOST_CYGWIN),y)
 EXEEXT:=		.exe
 endif
 
-TCFLAGS:=		${TARGET_CFLAGS}
-TCXXFLAGS:=		${TARGET_CFLAGS}
-TCPPFLAGS:=		${TARGET_CPPFLAGS}
-TLDFLAGS:=		${TARGET_LDFLAGS} -Wl,-rpath -Wl,/usr/lib \
-			-Wl,-rpath-link -Wl,${STAGING_TARGET_DIR}/usr/lib \
-			-L${STAGING_TARGET_DIR}/lib -L${STAGING_TARGET_DIR}/usr/lib
-ifeq ($(ADK_STATIC),y)
-TCFLAGS:=		${TARGET_CFLAGS} -static
-TCXXFLAGS:=		${TARGET_CFLAGS} -static
-TCPPFLAGS:=		${TARGET_CPPFLAGS} -static
-TLDFLAGS:=		${TARGET_LDFLAGS} -Wl,-rpath -Wl,/usr/lib \
-			-Wl,-rpath-link -Wl,${STAGING_TARGET_DIR}/usr/lib \
-			-L${STAGING_TARGET_DIR}/lib -L${STAGING_TARGET_DIR}/usr/lib \
-			-static
-endif
-ifeq ($(ADK_NATIVE),y)
-TCFLAGS:=		$(TARGET_CFLAGS_ARCH) $(TARGET_DEBUGGING) -fwrapv
-TCXXFLAGS:=		
-TCPPFLAGS:=
-TLDFLAGS:=
-endif
-
-ifeq ($(ADK_DEBUG),)
-TCPPFLAGS+=		-DNDEBUG
-endif
-
 # does not change CONFIGURE_ARGS in minimal mode
 ifeq ($(filter minimal,${CONFIG_STYLE}),)
 ifneq ($(ADK_DEBUG),)
@@ -42,10 +16,10 @@ endif
 
 CONFIGURE_ENV+=		GCC_HONOUR_COPTS=s \
 			CONFIG_SHELL='$(strip ${SHELL})' \
-			CFLAGS='$(strip ${TCFLAGS})' \
-			CXXFLAGS='$(strip ${TCXXFLAGS})' \
-			CPPFLAGS='$(strip ${TCPPFLAGS})' \
-			LDFLAGS='$(strip ${TLDFLAGS})' \
+			CFLAGS='$(strip ${TARGET_CFLAGS})' \
+			CXXFLAGS='$(strip ${TARGET_CXXFLAGS})' \
+			CPPFLAGS='$(strip ${TARGET_CPPFLAGS})' \
+			LDFLAGS='$(strip ${TARGET_LDFLAGS})' \
 			PKG_CONFIG_LIBDIR='${STAGING_TARGET_DIR}/usr/lib/pkgconfig'
 ifeq ($(ADK_NATIVE),)
 CONFIGURE_ENV+=		${TARGET_CONFIGURE_OPTS} \
@@ -67,26 +41,16 @@ FAKE_FLAGS?=
 ALL_TARGET?=		all
 INSTALL_TARGET?=	install
 
-MAKE_ENV+=		WRKDIR='${WRKDIR}' WRKDIST='${WRKDIST}' \
+MAKE_ENV+=		GCC_HONOUR_COPTS=2 \
+			WRKDIR='${WRKDIR}' WRKDIST='${WRKDIST}' \
 			WRKSRC='${WRKSRC}' WRKBUILD='${WRKBUILD}' \
-			CFLAGS='$(strip ${TCFLAGS})' \
-			CXXFLAGS='$(strip ${TCXXFLAGS})' \
-			CPPFLAGS='$(strip ${TCPPFLAGS})' \
-			LDFLAGS='$(strip ${TLDFLAGS})'
-MAKE_ENV+=		PKG_CONFIG_LIBDIR='${STAGING_TARGET_DIR}/usr/lib/pkgconfig'
+			CFLAGS='$(strip ${TARGET_CFLAGS})' \
+			CXXFLAGS='$(strip ${TARGET_CXXFLAGS})' \
+			CPPFLAGS='$(strip ${TARGET_CPPFLAGS})' \
+			LDFLAGS='$(strip ${TARGET_LDFLAGS})' \
+			PKG_CONFIG_LIBDIR='${STAGING_TARGET_DIR}/usr/lib/pkgconfig'
 ifeq ($(ADK_NATIVE),)
-MAKE_ENV+=		PATH='${TARGET_PATH}' \
-			${HOST_CONFIGURE_OPTS} \
-			CC='${TARGET_CC}' \
-			CXX='${TARGET_CXX}' \
-			LD='${TARGET_LD}' \
-			AR='${TARGET_CROSS}ar' \
-			RANLIB='${TARGET_CROSS}ranlib' \
-			NM='${TARGET_CROSS}nm' \
-			OBJCOPY='${TARGET_CROSS}objcopy' \
-			RANLIB='${TARGET_CROSS}ranlib' \
-			STRIP='${TARGET_CROSS}strip' \
-			CROSS="$(TARGET_CROSS)"
+MAKE_ENV+=		${TARGET_CONFIGURE_OPTS} ${HOST_CONFIGURE_OPTS}
 endif
 
 MAKE_FLAGS+=		${XAKE_FLAGS} V=1

+ 65 - 29
mk/vars.mk

@@ -10,24 +10,6 @@ MAKEFLAGS=		$(EXTRA_MAKEFLAGS)
 BUILD_USER=		$(shell id -un)
 BUILD_GROUP=		$(shell id -gn)
 
-# target compiler settings
-TARGET_CPPFLAGS+=	-I${STAGING_TARGET_DIR}/usr/include
-TARGET_LDFLAGS+=	-Wl,-O2
-ifneq ($(ADK_DEBUG),)
-TARGET_DEBUGGING:=	-g3 -fno-omit-frame-pointer
-else
-TARGET_DEBUGGING:=	$(TARGET_OPTIMIZATION) -fomit-frame-pointer
-endif
-TARGET_CFLAGS:=		$(TARGET_CFLAGS_ARCH) $(TARGET_DEBUGGING) -fwrapv
-ifneq ($(ADK_TOOLCHAIN_GCC_USE_SSP),)
-TARGET_CFLAGS+=		-fstack-protector
-TARGET_CXXFLAGS+=	-fstack-protector
-TARGET_LDFLAGS+=	-fstack-protector
-endif
-ifneq ($(ADK_TOOLCHAIN_GCC_USE_LTO),)
-TARGET_CFLAGS+=		-flto
-TARGET_LDFLAGS+=	-flto
-endif
 
 BASE_DIR:=		$(TOPDIR)
 DISTDIR?=		${BASE_DIR}/dl
@@ -56,35 +38,89 @@ TARGET_PATH=		${SCRIPT_DIR}:${TOOLS_DIR}:${STAGING_HOST_DIR}/bin:${STAGING_HOST_
 REAL_GNU_TARGET_NAME=	$(CPU_ARCH)-$(ADK_VENDOR)-linux-$(ADK_TARGET_SUFFIX)
 GNU_TARGET_NAME=	$(CPU_ARCH)-$(ADK_VENDOR)-linux
 ifeq ($(ADK_NATIVE),y) 
-TARGET_CROSS:=		
+TARGET_CROSS:=
 TARGET_COMPILER_PREFIX?=
 else
 TARGET_CROSS:=		$(STAGING_HOST_DIR)/bin/$(REAL_GNU_TARGET_NAME)-
 TARGET_COMPILER_PREFIX?=${TARGET_CROSS}
 endif
+
+# target compiler flags
 TARGET_CC:=		${TARGET_COMPILER_PREFIX}gcc
 TARGET_CXX:=		${TARGET_COMPILER_PREFIX}g++
 TARGET_LD:=		${TARGET_COMPILER_PREFIX}ld
+
+TARGET_CPPFLAGS:=	-I${STAGING_TARGET_DIR}/usr/include
+TARGET_CFLAGS:=		$(TARGET_CFLAGS_ARCH) -fwrapv -fno-ident -fhonour-copts
+TARGET_CXXFLAGS:=
+TARGET_LDFLAGS:=	-Wl,-O2 -Wl,-rpath -Wl,/usr/lib \
+			-Wl,-rpath-link -Wl,${STAGING_TARGET_DIR}/usr/lib \
+			-L${STAGING_TARGET_DIR}/lib -L${STAGING_TARGET_DIR}/usr/lib
+
+ifneq ($(ADK_STATIC),)
+TARGET_CFLAGS+=		-static
+TARGET_CXXFLAGS+=	-static
+TARGET_LDFLAGS+=	-static
+endif
+
+ifneq ($(ADK_TOOLCHAIN_GCC_USE_SSP),)
+TARGET_CFLAGS+=		-fstack-protector
+TARGET_CXXFLAGS+=	-fstack-protector
+TARGET_LDFLAGS+=	-fstack-protector
+endif
+
+ifneq ($(ADK_TOOLCHAIN_GCC_USE_LTO),)
+TARGET_CFLAGS+=		-flto
+TARGET_LDFLAGS+=	-flto
+endif
+
+ifneq ($(ADK_DEBUG),)
+TARGET_CPPFLAGS+=	-DNDEBUG
+TARGET_CFLAGS+=		-g3 -fno-omit-frame-pointer
+else
+TARGET_CFLAGS+=		-fomit-frame-pointer $(TARGET_OPTIMIZATION)
+endif
+
+ifneq ($(ADK_NATIVE),)
+TARGET_CPPFLAGS:=
+TARGET_CFLAGS:=		$(TARGET_OPTIMIZATION) $(TARGET_CFLAGS_ARCH) -fwrapv -fno-ident -fhonour-copts
+TARGET_LDFLAGS:=
+endif
+
+# host compiler flags
+CPPFLAGS_FOR_BUILD?=
+CFLAGS_FOR_BUILD?=      -O2 -Wall
+CXXFLAGS_FOR_BUILD?=    -O2 -Wall
+LDFLAGS_FOR_BUILD?=
+FLAGS_FOR_BUILD:=       ${CPPFLAGS_FOR_BUILD} ${CFLAGS_FOR_BUILD} ${LDFLAGS_FOR_BUILD}
+
 PATCH=			${BASH} $(SCRIPT_DIR)/patch.sh
 SED:=			sed -i -e
 LINUX_DIR:=		$(BUILD_DIR)/linux
 LINUX_HEADER_DIR:=	$(STAGING_TARGET_DIR)/linux-header
+KERNEL_MODULE_FLAGS:=	ARCH=${ARCH} KERNELVERSION="2.6" \
+			KERNEL_PATH=${LINUX_DIR} KERNELDIR=${LINUX_DIR} KERNEL_DIR=${LINUX_DIR} \
+			PREFIX=/usr CROSS_COMPILE="${TARGET_CROSS}" \
+			CFLAGS_MODULE="-fhonour-copts" V=1
+
 
 TARGET_CONFIGURE_OPTS=	PATH='${TARGET_PATH}' \
-			AR=$(TARGET_CROSS)ar \
-			AS=$(TARGET_CROSS)as \
-			LD=$(TARGET_CROSS)ld \
-			NM=$(TARGET_CROSS)nm \
-			RANLIB=$(TARGET_CROSS)ranlib \
+			AR='$(TARGET_CROSS)ar' \
+			AS='$(TARGET_CROSS)as' \
+			LD='$(TARGET_CROSS)ld' \
+			NM='$(TARGET_CROSS)nm' \
+			RANLIB='$(TARGET_CROSS)ranlib' \
+			STRIP='${TARGET_CROSS}strip' \
+			OBJCOPY='${TARGET_CROSS}objcopy' \
 			CC='$(TARGET_CC)' \
 			GCC='$(TARGET_CC)' \
 			CXX='$(TARGET_CXX)' \
 			CROSS='$(TARGET_CROSS)'
-HOST_CONFIGURE_OPTS=	CC_FOR_BUILD='${HOSTCC}' \
-			BUILD_CC='${HOSTCC}' \
-			CFLAGS_FOR_BUILD='${HOSTCFLAGS}' \
-			CPPFLAGS_FOR_BUILD='${HOSTCPPFLAGS}' \
-			LDFLAGS_FOR_BUILD='${HOSTLDFLAGS}'
+
+HOST_CONFIGURE_OPTS=	CC_FOR_BUILD='${CC_FOR_BUILD}' \
+			CPPFLAGS_FOR_BUILD='${CPPFLAGS_FOR_BUILD}' \
+			CFLAGS_FOR_BUILD='${CFLAGS_FOR_BUILD}' \
+			LDFLAGS_FOR_BUILD='${LDFLAGS_FOR_BUILD}'
 
 PKG_SUFFIX:=		$(strip $(subst ",, $(ADK_PACKAGE_SUFFIX)))
 

+ 6 - 6
package/aiccu/Makefile

@@ -20,13 +20,13 @@ include $(TOPDIR)/mk/package.mk
 
 $(eval $(call PKG_template,AICCU,${PKG_NAME},$(PKG_VERSION)-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION}))
 
-CONFIG_STYLE:=	manual
-INSTALL_STYLE:=	manual
+CONFIG_STYLE:=		manual
+INSTALL_STYLE:=		manual
 
-TCFLAGS+=	-D_REENTRANT -D_GNU_SOURCE -DAICCU_CONSOLE \
-		-D_LINUX -DHAS_IFHEAD -DAICCU_TYPE=\"linux\"
-TLDFLAGS+=	-pthread -lresolv
-MAKE_FLAGS+=	CC='${TARGET_CC}' CFLAGS='${TCFLAGS}' LDFLAGS='${TLDFLAGS}'
+TARGET_CPPFLAGS+=	-D_REENTRANT -D_GNU_SOURCE -DAICCU_CONSOLE \
+		 	-D_LINUX -DHAS_IFHEAD -DAICCU_TYPE=\"linux\"
+TARGET_LDFLAGS+=	-pthread -lresolv
+MAKE_FLAGS+=		CC='${TARGET_CC}' CFLAGS='${TARGET_CFLAGS}' LDFLAGS='${TARGET_LDFLAGS}'
 
 do-install:
 	$(INSTALL_DIR) $(IDIR_AICCU)/usr/sbin $(IDIR_AICCU)/etc

+ 4 - 2
package/alix-switch/Makefile

@@ -5,7 +5,7 @@ include ${TOPDIR}/rules.mk
 
 PKG_NAME:=		alix-switch
 PKG_VERSION:=		1.0
-PKG_RELEASE:=		3
+PKG_RELEASE:=		4
 PKG_DESCR:=		daemon listening on button events
 PKG_SECTION:=		base
 PKG_URL:=		http://openadk.org/
@@ -20,8 +20,10 @@ CONFIG_STYLE:=		manual
 BUILD_STYLE:=		manual
 INSTALL_STYLE:=		manual
 
+TARGET_CFLAGS+=		-Wall
+
 do-build:
-	${TARGET_CC} -Wall ${TCPPFLAGS} ${TCFLAGS} \
+	${TARGET_CC} ${TARGET_CPPFLAGS} ${TARGET_CFLAGS} ${TARGET_LDFLAGS} \
 		-o ${WRKBUILD}/alix-switchd ${WRKBUILD}/alix-switchd.c
 
 do-install:

+ 4 - 4
package/arpd/Makefile

@@ -5,7 +5,7 @@ include ${TOPDIR}/rules.mk
 
 PKG_NAME:=		arpd
 PKG_VERSION:=		0.2
-PKG_RELEASE:=		1
+PKG_RELEASE:=		2
 PKG_MD5SUM:=		e2911fa9de1b92ef50deda1489ae944d
 PKG_DESCR:=		Generates ARP responses for IP address ranges
 PKG_SECTION:=		route
@@ -23,9 +23,9 @@ $(eval $(call PKG_template,ARPD,${PKG_NAME},${PKG_VERSION}-${PKG_RELEASE},${PKG_
 CONFIGURE_ARGS+=	--with-libdnet=${STAGING_TARGET_DIR}/usr \
 			--with-libevent=${STAGING_TARGET_DIR}/usr \
 			--with-libpcap=${STAGING_TARGET_DIR}/usr
-MAKE_FLAGS+=		CFLAGS="${TCFLAGS}" \
-			INCLS="-I. -I${STAGING_TARGET_DIR}/usr/include" \
-			LIBS="-L${STAGING_TARGET_DIR}/usr/lib -lpcap -ldnet -levent"
+MAKE_FLAGS+=		CFLAGS="${TARGET_CFLAGS}" \
+			INCLS="-I. ${TARGET_CPPFLAGS}" \
+			LIBS="-lpcap -ldnet -levent"
 
 post-install:
 	${INSTALL_DIR} ${IDIR_ARPD}/usr/sbin

+ 4 - 5
package/asterisk/Makefile

@@ -84,7 +84,7 @@ endif
 ifneq (${ADK_PACKAGE_ASTERISK_FORMAT_VORBIS},)
 CONFIGURE_ARGS+=	--with-ogg=${STAGING_TARGET_DIR}/usr \
 			--with-vorbis=${STAGING_TARGET_DIR}/usr
-TLDFLAGS+=		-logg
+TARGET_LDFLAGS+=	-logg
 endif
 ifneq (${ADK_PACKAGE_ASTERISK_CURL},)
 CONFIGURE_ARGS+=	--with-libcurl=${STAGING_TARGET_DIR}/usr
@@ -99,12 +99,11 @@ endif
 
 INSTALL_STYLE:=		manual
 
-TLDFLAGS+=		-lm
-MAKE_ENV=		ASTCFLAGS="${TCPPFLAGS} -DHAVE_STRTOQ" \
-			ASTLDFLAGS="${TLDFLAGS}"
+TARGET_LDFLAGS+=	-lm
+MAKE_ENV=		ASTCFLAGS="${TARGET_CPPFLAGS} -DHAVE_STRTOQ" \
+			ASTLDFLAGS="${TARGET_LDFLAGS}"
 MAKE_FLAGS+=		DESTDIR="$(WRKINST)" \
 			OPTIMIZE="${TARGET_OPTIMIZATION}" \
-			STRIP="${TARGET_CROSS}strip" \
 			NOISY_BUILD=1
 ALL_TARGET:=		all install samples
 

+ 5 - 4
package/atftp/Makefile

@@ -16,19 +16,20 @@ PKG_SITES:=		ftp://ftp.mamalinux.com/pub/atftp/
 
 PKG_SUBPKGS:=		ATFTP ATFTPD
 PKGSD_ATFTPD:=		TFTP server
+PKGSS_ATFTPD:=		libreadline libncurses
 
 include $(TOPDIR)/mk/package.mk
 
 $(eval $(call PKG_template,ATFTP,atftp,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION}))
 $(eval $(call PKG_template,ATFTPD,atftpd,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKGSD_ATFTPD},${PKG_SECTION}))
 
-MAKE_FLAGS+=		CFLAGS="${TCFLAGS} -Wall -D_REENTRANT -fno-inline"
+MAKE_FLAGS+=		CFLAGS="${TARGET_CFLAGS} -Wall -D_REENTRANT -fno-inline"
 
-post-install:
-	# atftp client
+atftp-install:
 	$(INSTALL_DIR) $(IDIR_ATFTP)/usr/bin
 	$(INSTALL_BIN) $(WRKBUILD)/atftp $(IDIR_ATFTP)/usr/bin
-	# atftp server
+
+atftpd-install:
 	$(INSTALL_DIR) $(IDIR_ATFTPD)/usr/sbin
 	$(INSTALL_BIN) $(WRKBUILD)/atftpd $(IDIR_ATFTPD)/usr/sbin
 

+ 1 - 1
package/aufs2-util/Makefile

@@ -29,7 +29,7 @@ $(eval $(call PKG_template,AUFS2_UTIL,${PKG_NAME},${PKG_VERSION}-${PKG_RELEASE},
 $(eval $(call PKG_template,LIBAU,libau,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKGSD_LIBAU},${PKG_SECTION}))
 
 CONFIG_STYLE:=		manual
-XAKE_FLAGS+=		Install=install HOSTCPPFLAGS="-I${LINUX_HEADER_DIR}/include"
+XAKE_FLAGS+=		Install=install CPPFLAGS_FOR_BUILD="-I${LINUX_HEADER_DIR}/include"
 
 post-install:
 	$(INSTALL_DIR) $(IDIR_AUFS2_UTIL)/sbin

+ 4 - 4
package/aufs2-util/patches/patch-Makefile

@@ -4,10 +4,10 @@
  # along with this program; if not, write to the Free Software
  # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301	 USA
  
-+c2sh c2tmac: CC = ${HOSTCC}
-+c2sh c2tmac: CFLAGS= ${HOSTCFLAGS}
-+c2sh c2tmac: LDFLAGS= ${HOSTLDFLAGS}
-+c2sh c2tmac: CPPFLAGS= ${HOSTCPPFLAGS} -I./libau -I${LINUX_HEADER_DIR}/include
++c2sh c2tmac: CC = ${CC_FOR_BUILD}
++c2sh c2tmac: CFLAGS= ${CFLAGS_FOR_BUILD}
++c2sh c2tmac: LDFLAGS= ${LDFLAGS_FOR_BUILD}
++c2sh c2tmac: CPPFLAGS= ${CPPFLAGS_FOR_BUILD} -I./libau -I${LINUX_HEADER_DIR}/include
 +
  CFLAGS += -I./libau
  CFLAGS += -O -Wall

+ 1 - 1
package/avahi/Makefile

@@ -26,7 +26,7 @@ $(eval $(call PKG_template,AVAHI_DAEMON,avahi-daemon,${PKG_VERSION}-${PKG_RELEAS
 $(eval $(call PKG_template,AVAHI_DNSCONFD,avahi-dnsconfd,${PKG_VERSION}-${PKG_RELEASE},${PKGSS_AVAHI_DNSCONFD},${PKGSD_AVAHI_DNSCONFD},${PKG_SECTION}))
 $(eval $(call PKG_template,LIBAVAHI,libavahi,${PKG_VERSION}-${PKG_RELEASE},,${PKGSD_LIBAVAHI},${PKGSC_LIBAVAHI}))
 
-TLDFLAGS+=		-lintl
+TARGET_LDFLAGS+=	-lintl
 CONFIGURE_ARGS+=	--enable-glib \
 			--disable-qt3 \
 			--disable-qt4 \

+ 1 - 3
package/axtls/Makefile

@@ -29,9 +29,7 @@ CONFIG_STYLE:=		manual
 INSTALL_STYLE:=		manual
 
 XAKE_FLAGS+=		STRIP='' \
-			CC='${TARGET_CC}' \
-			OPT_CFLAGS='${TARGET_CFLAGS} -fPIC' \
-			OPT_LDFLAGS=""
+			CC='${TARGET_CC}'
 
 do-configure:
 	${CP} ./files/config ${WRKBUILD}/config/.config

+ 17 - 16
package/bind/Makefile

@@ -51,45 +51,46 @@ else
 CONFIGURE_ARGS+=	--disable-ipv6
 endif
 
-pre-build:
-	${MAKE} -C ${WRKBUILD}/lib/dns \
-		BUILD_CC="${HOSTCC}" \
-		CC="${HOSTCC}" \
-		CFLAGS='${HOSTCFLAGS}' \
-		gen
-
-post-install:
-	# bind server
+CONFIGURE_ENV+=		BUILD_CC="${CC_FOR_BUILD}" BUILD_CFLAGS='${CFLAGS_FOR_BUILD}'
+
+bind-server-install:
 	${INSTALL_DIR} ${IDIR_BIND_SERVER}/usr/sbin ${IDIR_BIND_SERVER}/etc
 	${INSTALL_BIN} ${WRKINST}/usr/sbin/named ${IDIR_BIND_SERVER}/usr/sbin/
 	${CP} ./files/bind ${IDIR_BIND_SERVER}/etc
-	# nsupdate
+
+bind-client-install:
 	${INSTALL_DIR} ${IDIR_BIND_CLIENT}/usr/bin
 	${INSTALL_BIN} ${WRKINST}/usr/bin/nsupdate ${IDIR_BIND_CLIENT}/usr/bin/
-	# rndc
+
+bind-rndc-install:
 	${INSTALL_DIR} ${IDIR_BIND_RNDC}/usr/sbin
 	${INSTALL_BIN} ${WRKINST}/usr/sbin/rndc ${IDIR_BIND_RNDC}/usr/sbin/
 	${INSTALL_BIN} ${WRKINST}/usr/sbin/rndc-confgen \
 		${IDIR_BIND_RNDC}/usr/sbin/
-	# bind check
+
+bind-check-install:
 	${INSTALL_DIR} ${IDIR_BIND_CHECK}/usr/sbin
 	${INSTALL_BIN} ${WRKINST}/usr/sbin/named-checkconf \
 		${IDIR_BIND_CHECK}/usr/sbin/
 	${INSTALL_BIN} ${WRKINST}/usr/sbin/named-checkzone \
 		${IDIR_BIND_CHECK}/usr/sbin/
-	# dnsec tools
+
+bind-dnssec-install:
 	${INSTALL_DIR} ${IDIR_BIND_DNSSEC}/usr/sbin
 	${INSTALL_BIN} ${WRKINST}/usr/sbin/dnssec-keygen \
 		${IDIR_BIND_DNSSEC}/usr/sbin/
 	${INSTALL_BIN} ${WRKINST}/usr/sbin/dnssec-signzone \
 		${IDIR_BIND_DNSSEC}/usr/sbin/
-	# host
+
+bind-host-install:
 	${INSTALL_DIR} ${IDIR_BIND_HOST}/usr/bin
 	${INSTALL_BIN} ${WRKINST}/usr/bin/host ${IDIR_BIND_HOST}/usr/bin/
-	# dig
+
+bind-dig-install:
 	${INSTALL_DIR} ${IDIR_BIND_DIG}/usr/bin
 	${INSTALL_BIN} ${WRKINST}/usr/bin/dig ${IDIR_BIND_DIG}/usr/bin/
-	# bind lib
+
+libbind-install:
 	${INSTALL_DIR} ${IDIR_LIBBIND}/usr/lib
 	${CP} ${WRKINST}/usr/lib/libbind9.so.* ${IDIR_LIBBIND}/usr/lib/
 	${CP} ${WRKINST}/usr/lib/libdns.so.* ${IDIR_LIBBIND}/usr/lib/

+ 1 - 1
package/binutils/Makefile

@@ -19,7 +19,7 @@ include ${TOPDIR}/mk/package.mk
 $(eval $(call PKG_template,BINUTILS,${PKG_NAME},${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION}))
 $(eval $(call PKG_template,LIBBFD,libbfd,${PKG_VERSION}-${PKG_RELEASE},,${PKGSD_LIBBFD},${PKGSC_LIBBFD}))
 
-TCFLAGS+=		-fPIC
+TARGET_CFLAGS+=		-fPIC
 CONFIGURE_ARGS+=	--disable-werror \
 			--host=$(REAL_GNU_TARGET_NAME) \
 			--target=$(REAL_GNU_TARGET_NAME)

+ 1 - 1
package/bitlbee/Makefile

@@ -19,7 +19,7 @@ include ${TOPDIR}/mk/package.mk
 $(eval $(call PKG_template,BITLBEE,${PKG_NAME},${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION}))
 
 CONFIG_STYLE:=		minimal
-TCFLAGS+=		-fPIC
+TARGET_CFLAGS+=		-fPIC
 CONFIGURE_ARGS:=	--target=${REAL_GNU_TARGET_NAME} \
 			--prefix=/usr/ \
 			--bindir=/usr/sbin/ \

+ 1 - 2
package/bzip2/Makefile

@@ -17,8 +17,7 @@ include ${TOPDIR}/mk/package.mk
 $(eval $(call PKG_template,BZIP2,${PKG_NAME},${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION}))
 
 CONFIG_STYLE:=		manual
-
-TCFLAGS+=		-fPIC
+TARGET_CFLAGS+=		-fPIC
 XAKE_FLAGS+=		PREFIX=${WRKINST}/usr
 
 post-install:

+ 2 - 2
package/cryptinit/Makefile

@@ -24,8 +24,8 @@ BUILD_STYLE:=		manual
 INSTALL_STYLE:=		manual
 
 do-build:
-	${TARGET_CC} ${TCPPFLAGS} ${TCFLAGS} -c -o ${WRKBUILD}/cryptinit.o \
-		${WRKBUILD}/cryptinit.c
+	${TARGET_CC} ${TARGET_CPPFLAGS} ${TARGET_CFLAGS} -c \
+		-o ${WRKBUILD}/cryptinit.o ${WRKBUILD}/cryptinit.c
 	( cd ${WRKBUILD}; \
 	${TARGET_CC} -static -o cryptinit cryptinit.o \
 		 ${STAGING_TARGET_DIR}/usr/lib/libcryptsetup.a \

+ 2 - 2
package/cups/Makefile

@@ -21,7 +21,7 @@ include ${TOPDIR}/mk/package.mk
 $(eval $(call PKG_template,CUPS,${PKG_NAME},${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION}))
 
 CONFIGURE_ENV+=		ac_cv_func_sigset=no \
-			OPTIM='-fPIC $(TARGET_CFLAGS)'
+			OPTIM='-fPIC'
 
 CONFIGURE_ARGS+=	--with-cups-user=cups \
 			--with-cups-group=cups \
@@ -42,7 +42,7 @@ CONFIGURE_ARGS+=	--with-cups-user=cups \
 			--disable-ssl
 
 FAKE_FLAGS+=		DSTROOT="${WRKINST}" STRIP="/bin/true"
-XAKE_FLAGS+=		OPTIM='-fPIC $(TARGET_CFLAGS)'
+XAKE_FLAGS+=		OPTIM='-fPIC'
 
 post-install:
 	${INSTALL_DIR} ${IDIR_CUPS}/usr/bin

+ 4 - 2
package/cutter/Makefile

@@ -22,9 +22,11 @@ CONFIG_STYLE:=		manual
 BUILD_STYLE:=		manual
 INSTALL_STYLE:=		manual
 
+TARGET_CFLAGS+=		-Wall
+
 do-build:
-	${TARGET_CC} -Wall ${TCPPFLAGS} ${TCFLAGS} ${WRKBUILD}/cutter.c \
-		-o ${WRKBUILD}/cutter
+	${TARGET_CC} ${TARGET_CPPFLAGS} ${TARGET_CFLAGS} ${TARGET_LDFLAGS} \
+		${WRKBUILD}/cutter.c -o ${WRKBUILD}/cutter
 
 do-install:
 	${INSTALL_DIR} ${IDIR_CUTTER}/usr/sbin

+ 5 - 5
package/cxxtools/Makefile

@@ -19,15 +19,15 @@ include ${TOPDIR}/mk/package.mk
 $(eval $(call PKG_template,CXXTOOLS,${PKG_NAME},${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION}))
 
 ifeq (${ADK_COMPILE_CXXTOOLS_WITH_UCLIBCXX},y)
-TCXXFLAGS+=		-fno-builtin -nostdinc++ \
+TARGET_CXXFLAGS+=	-fno-builtin -nostdinc++ \
 			-I${STAGING_TARGET_DIR}/usr/include/uClibc++ -Wl,-E
-TLDFLAGS+=		-luClibc++ -liconv -lm -nodefaultlibs -shared
+TARGET_LDFLAGS+=	-luClibc++ -liconv -lm -nodefaultlibs -shared
 else
-TLDFLAGS+=		-liconv -shared
+TARGET_LDFLAGS+=	-liconv -shared
 endif
 
-TCFLAGS+=		-fPIC
-TCXXFLAGS+=		-fPIC
+TARGET_CFLAGS+=		-fPIC
+TARGET_CXXFLAGS+=	-fPIC
 CONFIGURE_ARGS+=	--with-libiconv-prefix='${STAGING_TARGET_DIR}/usr'
 
 post-install:

+ 1 - 1
package/digitemp/Makefile

@@ -21,7 +21,7 @@ $(eval $(call PKG_template,DIGITEMP,${PKG_NAME},${PKG_VERSION}-${PKG_RELEASE},${
 CONFIG_STYLE:=		manual
 INSTALL_STYLE:=		manual
 
-TCFLAGS+=		-I./src -I./userial
+TARGET_CPPFLAGS+=	-I./src -I./userial
 ALL_TARGET=		ds2490
 
 do-install:

+ 2 - 3
package/dillo/Makefile

@@ -24,11 +24,10 @@ include $(TOPDIR)/mk/package.mk
 
 $(eval $(call PKG_template,DILLO,$(PKG_NAME),$(PKG_VERSION)-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION}))
 
-TLDFLAGS+=		-liconv
+TARGET_LDLFAGS+=	-liconv
 
 post-install:
 	$(INSTALL_DIR) $(IDIR_DILLO)/usr/bin
-	$(INSTALL_BIN) $(WRKINST)/usr/bin/dillo \
-		$(IDIR_DILLO)/usr/bin
+	$(INSTALL_BIN) $(WRKINST)/usr/bin/dillo $(IDIR_DILLO)/usr/bin
 
 include ${TOPDIR}/mk/pkg-bottom.mk

+ 5 - 5
package/e2fsprogs/Makefile

@@ -38,14 +38,14 @@ $(eval $(call PKG_template,E2FSCK_STATIC,e2fsck-static,${PKG_VERSION}-${PKG_RELE
 
 CONFIGURE_ARGS+=	--enable-elf-shlibs --disable-rpath
 INSTALL_TARGET+=	install-libs
-TLDFLAGS+=		-lpthread
+TARGET_LDFLAGS+=	-lpthread
 
 pre-build:
 	${MAKE} -C ${WRKBUILD}/util \
-		BUILDCC="${HOSTCC}" \
-		CFLAGS="" \
-		LDFLAGS="" \
-		CPPFLAGS="" \
+		BUILDCC="${CC_FOR_BUILD}" \
+		CFLAGS="${CFLAGS_FOR_BUILD}" \
+		LDFLAGS="${LDFLAGS_FOR_BUILD}" \
+		CPPFLAGS="${CPPFLAGS_FOR_BUILD}" \
 		subst
 
 post-build:

+ 3 - 3
package/eglibc/Makefile

@@ -34,7 +34,8 @@ EGLIBC_CONFOPTS:=	--build=$(GNU_HOST_NAME) \
 			--enable-add-ons
 
 EGLIBC_ENV:=		PATH='${TARGET_PATH}' \
-			BUILD_CC=${HOSTCC} \
+			GCC_HONOUR_COPTS=s \
+			BUILD_CC=${CC_FOR_BUILD} \
 			CFLAGS="$(TARGET_CFLAGS)" \
 			CC=${REAL_GNU_TARGET_NAME}-gcc \
 			CXX=${REAL_GNU_TARGET_NAME}-g++ \
@@ -100,8 +101,7 @@ eglibc-dev-install:
 			--with-headers=$(IDIR_EGLIBC_DEV)/usr/include \
 			${EGLIBC_CONFOPTS} \
 	);
-	PATH='${TARGET_PATH}' \
-	$(MAKE) -C $(WRKBUILD) \
+	PATH='${TARGET_PATH}' $(MAKE) -C $(WRKBUILD) \
 		install-headers install-bootstrap-headers=yes
 	@touch $(IDIR_EGLIBC_DEV)/usr/include/gnu/stubs.h
 	@find $(IDIR_EGLIBC_DEV) -name .install -exec rm {} \;

+ 1 - 1
package/elinks/Makefile

@@ -23,7 +23,7 @@ include ${TOPDIR}/mk/package.mk
 $(eval $(call PKG_template,ELINKS,${PKG_NAME},${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION}))
 
 INSTALL_STYLE:=		manual
-TCFLAGS+=		-fPIC
+TARGET_CFLAGS+=		-fPIC
 CONFIGURE_ENV+=		$(shell echo ac_cv_file_./features.conf | tr [:blank:]-/. _)=yes
 CONFIGURE_ENV+=		$(shell echo ac_cv_file_${WRKBUILD}/features.conf | tr [:blank:]-/. _)=yes
 CONFIGURE_ARGS+=	--enable-small \

+ 4 - 2
package/ether-wake/Makefile

@@ -19,9 +19,11 @@ CONFIG_STYLE:=		manual
 BUILD_STYLE:=		manual
 INSTALL_STYLE:=		manual
 
+TARGET_CFLAGS+=		-Wall
+
 do-build:
-	${TARGET_CC} -Wall ${TCPPFLAGS} ${TCFLAGS} -o \
-		${WRKBUILD}/ether-wake ${WRKBUILD}/ether-wake.c
+	${TARGET_CC} ${TARGET_CPPFLAGS} ${TARGET_CFLAGS} ${TARGET_LDFLAGS} \
+		-o ${WRKBUILD}/ether-wake ${WRKBUILD}/ether-wake.c
 
 do-install:
 	${INSTALL_DIR} ${IDIR_ETHER_WAKE}/usr/sbin

+ 1 - 6
package/exmap/Makefile

@@ -33,12 +33,7 @@ CONFIGURE_ARGS+=	--disable-doc
 CONFIGURE_ENV+=		LIBS="-lncurses"
 
 pre-build:
-	GCC_HONOUR_COPTS=s \
-	KERNEL_PATH=${LINUX_DIR} \
-	CROSS_COMPILE="${TARGET_CROSS}" \
-	V=1 ARCH="${ARCH}" KERNELVERSION="2.6" \
-	LDFLAGS="" \
-	$(MAKE) -C ${WRKBUILD}/kernel
+	$(MAKE) -C ${WRKBUILD}/kernel $(KERNEL_MODULE_FLAGS)
 
 post-install:
 	${INSTALL_DIR} ${IDIR_EXMAP_KMOD}/etc/modules.d/

+ 1 - 1
package/faad2/Makefile

@@ -22,7 +22,7 @@ $(eval $(call PKG_template,LIBFAAD2,libfaad2,${PKG_VERSION}-${PKG_RELEASE},${PKG
 CONFIGURE_ENV+=		ac_cv_c99_lrintf=yes
 CONFIGURE_ARGS+=	--without-mpeg4ip \
 			--without-xmms
-TLDFLAGS+=		-lm
+TARGET_LDFLAGS+=	-lm
 
 post-install:
 	${INSTALL_DIR} ${IDIR_LIBFAAD2}/usr/lib

+ 4 - 2
package/fakeidentd/Makefile

@@ -22,9 +22,11 @@ CONFIG_STYLE:=		manual
 BUILD_STYLE:=		manual
 INSTALL_STYLE:=		manual
 
+TARGET_CFLAGS+=		-Wall
+
 do-build:
-	${TARGET_CC} -Wall ${TCPPFLAGS} ${TCFLAGS} -o \
-		${WRKBUILD}/fakeidentd ${WRKBUILD}/identd.c
+	${TARGET_CC} ${TARGET_CPPFLAGS} ${TARGET_CFLAGS} ${TARGET_LDFLAGS} \
+		-o ${WRKBUILD}/fakeidentd ${WRKBUILD}/identd.c
 
 do-install:
 	${INSTALL_DIR} ${IDIR_FAKEIDENTD}/usr/sbin

+ 1 - 5
package/ffmpeg/Makefile

@@ -43,11 +43,7 @@ else
 CONFIGURE_CPU_OPTS:=    --disable-sse 
 endif
 
-# gcc 4.5 produces internal compiler error with -Os
-#TCFLAGS:=$(subst Os,O2,$(TCFLAGS))
-
 CONFIG_STYLE:=		minimal
-
 CONFIGURE_ARGS:=	--prefix=/usr \
 			--target-os=linux \
 			--arch=${CPU_ARCH} \
@@ -56,7 +52,7 @@ CONFIGURE_ARGS:=	--prefix=/usr \
 			--source-path=${WRKSRC} \
 			--cross-prefix=${TARGET_CROSS} \
 			--cc=$(TARGET_CC) \
-			--host-cc=$(HOSTCC) \
+			--host-cc=$(CC_FOR_BUILD) \
 			--disable-doc \
 			--disable-debug \
 			--disable-optimizations \

+ 7 - 3
package/firefox/Makefile

@@ -35,9 +35,12 @@ else
 CONFIGURE_ARGS+=	--enable-ipc
 endif
 
-CONFIGURE_ENV+=		CROSS_COMPILE=1 HOST_CC="${HOSTCC}" HOST_CFLAGS="${HOSTCFLAGS}" \
-			HOST_CXX="${HOSTCXX}" HOST_CXXFLAGS="${HOSTCXXFLAGS}" \
-			HOST_LIBIDL_CONFIG="${HOST_LIBIDL_CONFIG}" \
+CONFIGURE_ENV+=		CROSS_COMPILE=1 \
+			HOST_CC="${CC_FOR_BUILD}" \
+			HOST_CFLAGS="${CFLAGS_FOR_BUILD}" \
+			HOST_CXX="${CXX_FOR_BUILD}" \
+			HOST_CXXFLAGS="${CXXFLAGS_FOR_BUILD}" \
+			BUILD_LIBIDL_CONFIG="${BUILD_LIBIDL_CONFIG}" \
 			PKG_HOSTLIB_DIR="${PKG_HOSTLIB_DIR}" \
 			HOST_RANLIB="ranlib" HOST_AR="ar" \
 			CPPFLAGS="-I${STAGING_TARGET_DIR}/usr/include/freetype2" \
@@ -67,6 +70,7 @@ CONFIGURE_ARGS+=	--enable-application=browser \
 			--disable-crashreporter
 
 XAKE_FLAGS+=		OS_RELEASE="2.6"
+XAKE_FLAGS+=            ARCHFLAG="${TARGET_CFLAGS} ${TARGET_CPPFLAGS} ${TARGET_LDFLAGS}"
 
 post-install:
 	$(INSTALL_DIR) $(IDIR_FIREFOX)/usr/bin

+ 2 - 2
package/firefox/patches/patch-configure

@@ -42,8 +42,8 @@
 -        HOST_LIBIDL_LIBS="$LIBIDL_LIBS"
 -    fi
 -fi
-+HOST_LIBIDL_CFLAGS=`env PKG_CONFIG_LIBDIR=${PKG_HOSTLIB_DIR} ${HOST_LIBIDL_CONFIG} --cflags`
-+HOST_LIBIDL_LIBS=`env PKG_CONFIG_LIBDIR=${PKG_HOSTLIB_DIR} ${HOST_LIBIDL_CONFIG} --libs`
++HOST_LIBIDL_CFLAGS=`env PKG_CONFIG_LIBDIR=${PKG_HOSTLIB_DIR} ${BUILD_LIBIDL_CONFIG} --cflags`
++HOST_LIBIDL_LIBS=`env PKG_CONFIG_LIBDIR=${PKG_HOSTLIB_DIR} ${BUILD_LIBIDL_CONFIG} --libs`
 +
 +echo "host libidl cflags: ${HOST_LIBIDL_CFLAGS}"
 +echo "host libidl libs: ${HOST_LIBIDL_LIBS}"

+ 15 - 0
package/firefox/patches/patch-security_coreconf_Linux_mk

@@ -0,0 +1,15 @@
+--- mozilla-1.9.2.orig/security/coreconf/Linux.mk	2010-12-03 16:48:49.000000000 +0100
++++ mozilla-1.9.2/security/coreconf/Linux.mk	2011-01-20 20:18:26.904905227 +0100
+@@ -46,9 +46,9 @@ ifeq ($(USE_PTHREADS),1)
+ 	IMPL_STRATEGY = _PTH
+ endif
+ 
+-CC			= gcc
+-CCC			= g++
+-RANLIB			= ranlib
++CC			?= gcc
++CCC			?= g++
++RANLIB			?= ranlib
+ 
+ DEFAULT_COMPILER = gcc
+ 

+ 11 - 0
package/firefox/patches/patch-security_coreconf_command_mk

@@ -0,0 +1,11 @@
+--- mozilla-1.9.2.orig/security/coreconf/command.mk	2010-12-03 16:48:49.000000000 +0100
++++ mozilla-1.9.2/security/coreconf/command.mk	2011-01-20 20:18:56.214904993 +0100
+@@ -48,7 +48,7 @@ LINK_EXE      = $(LINK) $(OS_LFLAGS) $(L
+ CFLAGS        = $(OPTIMIZER) $(OS_CFLAGS) $(XP_DEFINE) $(DEFINES) $(INCLUDES) \
+ 		$(XCFLAGS)
+ PERL          = perl
+-RANLIB        = echo
++RANLIB        = ranlib
+ TAR           = /bin/tar
+ #
+ # For purify

+ 2 - 2
package/gatling/Makefile

@@ -25,9 +25,9 @@ INSTALL_STYLE:=		manual
 
 MAKE_FILE:=		GNUmakefile
 ALL_TARGET:=		gatling
-TCPPFLAGS+=		-I${STAGING_TARGET_DIR}/usr/include/owfat
+TARGET_CPPFLAGS+=	-I${STAGING_TARGET_DIR}/usr/include/owfat
 XAKE_FLAGS+=		CC='${TARGET_CC}' \
-			CFLAGS='${TCPPFLAGS} ${TCFLAGS}' \
+			CFLAGS='${TARGET_CPPFLAGS} ${TARGET_CFLAGS}' \
 			ZLIB=0 DIET= prefix='${WRKINST}/usr'
 
 do-install:

+ 5 - 2
package/gcc/Makefile

@@ -16,8 +16,8 @@ include ${TOPDIR}/mk/package.mk
 
 $(eval $(call PKG_template,GCC,${PKG_NAME},${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION},${PKG_OPTS}))
 
-TCFLAGS:=		''
-TCPPFLAGS:=		''
+TARGET_CFLAGS:=		''
+TARGET_CPPFLAGS:=	''
 
 ifeq ($(ADK_LINUX_64),y)
 CONFIGURE_ARGS+=       --with-abi=64
@@ -39,6 +39,9 @@ CONFIGURE_ARGS+=	--enable-languages=c,c++ \
 			--disable-libstdcxx-pch \
 			--enable-cxx-flags="${TARGET_LDFLAGS}"
 
+# disable honour cflags stuff
+XAKE_FLAGS+=		GCC_HONOUR_COPTS:=s
+
 post-install:
 	${INSTALL_DIR} ${IDIR_GCC}/usr/lib/gcc ${IDIR_GCC}/usr/bin
 	${INSTALL_DIR} ${IDIR_GCC}/lib ${IDIR_GCC}/usr/include/c++

+ 4 - 2
package/gdb/Makefile

@@ -16,13 +16,15 @@ include ${TOPDIR}/mk/package.mk
 
 $(eval $(call PKG_template,GDB,gdb,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION}))
 
-TCFLAGS+=		${TCPPFLAGS} -fPIC
+TARGET_CFLAGS+=		${TARGET_CPPFLAGS} -fPIC
 CONFIGURE_ARGS+=	--without-uiout --enable-gdbmi \
 			--disable-tui --disable-gdbtk --without-x \
 			--without-included-gettext --disable-sim \
 			--enable-threads --with-curses --disable-werror \
 			--enable-static --without-python
-XAKE_FLAGS+=		LDFLAGS='${TLDFLAGS}'
+XAKE_FLAGS+=		LDFLAGS='${TARGET_LDFLAGS}'
+# disable honour cflags stuff
+XAKE_FLAGS+=		GCC_HONOUR_COPTS:=s
 
 post-install:
 	${INSTALL_DIR} ${IDIR_GDB}/usr/bin

+ 1 - 1
package/gpm/Makefile

@@ -16,7 +16,7 @@ include ${TOPDIR}/mk/package.mk
 
 $(eval $(call PKG_template,GPM,${PKG_NAME},${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION}))
 
-TCFLAGS+=		-I${WRKSRC}/src/headers
+TARGET_CPPFLAGS+=	-I${WRKSRC}/src/headers
 
 post-install:
 	${INSTALL_DIR} ${IDIR_GPM}/usr/sbin ${IDIR_GPM}/usr/lib

+ 4 - 4
package/gpsd/Makefile

@@ -30,7 +30,7 @@ CONFIGURE_ENV+=		EGREP="grep -E" \
 			ac_cv_func_strlcat=no \
 			ac_cv_lib_nsl_gethostbyname=no
 CONFIGURE_ARGS+=	--disable-dbus
-TCFLAGS+=		-fPIC
+TARGET_CFLAGS+=		-fPIC
 
 LIBRARIES:=-nodefaultlibs -luClibc++
 ifeq ($(ADK_TOOLCHAIN_GCC_USE_SSP),y)
@@ -38,11 +38,11 @@ LIBRARIES+=-lssp -lssp_nonshared
 endif
 
 ifeq ($(ADK_COMPILE_GPSD_WITH_UCLIBCXX),y)
-TCXXFLAGS+=		-fno-rtti -nostdinc++ \
+TARGET_CXXFLAGS+=	-fno-rtti -nostdinc++ \
 			-I${STAGING_TARGET_DIR}/usr/include/uClibc++
-TLDFLAGS+=		$(LIBRARIES)
+TARGET_LDFLAGS+=	$(LIBRARIES)
 else
-TLDFLAGS+=		-shared -pthread
+TARGET_LDFLAGS+=	-shared -pthread
 endif
 
 ifeq (${ADK_COMPILE_GPSD_WITH_UCLIBCXX},y)

+ 1 - 1
package/haserl/Makefile

@@ -16,7 +16,7 @@ include ${TOPDIR}/mk/package.mk
 
 $(eval $(call PKG_template,HASERL,${PKG_NAME},${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION}))
 
-TCFLAGS+=		-DMAX_UPLOAD_KB=8192
+TARGET_CPPFLAGS+=	-DMAX_UPLOAD_KB=8192
 
 post-install:
 	${INSTALL_DIR} ${IDIR_HASERL}/usr/bin

+ 7 - 7
package/heimdal/Makefile

@@ -69,7 +69,7 @@ CONFIGURE_OPTS+=	--disable-pk-init \
 			--disable-kx509
 endif
 
-TCFLAGS+=		-I${STAGING_TARGET_DIR}/usr/include/et -pthread
+TARGET_CFLAGS+=		-I${STAGING_TARGET_DIR}/usr/include/et -pthread
 
 CONFIGURE_ARGS+=	${CONFIGURE_OPTS} --with-cross-tools=${STAGING_HOST_DIR}/bin
 CONFIGURE_ENV+=		cross_compiling=yes \
@@ -87,12 +87,12 @@ post-extract:
 	${MAKE} -C ${WRKBUILD}/lib/roken
 	${MAKE} -C ${WRKBUILD}/lib/vers
 	${MAKE} -C ${WRKBUILD}/lib/editline
-	env CFLAGS="-static" LDFLAGS="-static" ${MAKE} -C ${WRKBUILD}/lib/com_err compile_et$(EXEEXT)
-	env CFLAGS="-static" LDFLAGS="-static" ${MAKE} -C ${WRKBUILD}/lib/asn1 asn1_compile$(EXEEXT)
-	env CFLAGS="-static" LDFLAGS="-static" ${MAKE} -C ${WRKBUILD}/lib/sl slc$(EXEEXT)
-	${MAKE} -C ${WRKBUILD}/lib/roken install
-	${MAKE} -C ${WRKBUILD}/lib/asn1 install
-	${MAKE} -C ${WRKBUILD}/lib/sl install
+	${MAKE} -C ${WRKBUILD}/lib/com_err compile_et$(EXEEXT) LDFLAGS="-all-static"
+	${MAKE} -C ${WRKBUILD}/lib/asn1 asn1_compile$(EXEEXT) LDFLAGS="-all-static"
+	${MAKE} -C ${WRKBUILD}/lib/sl slc$(EXEEXT) LDFLAGS="-all-static"
+	${MAKE} -C ${WRKBUILD}/lib/roken install LDFLAGS="-all-static"
+	${MAKE} -C ${WRKBUILD}/lib/asn1 install LDFLAGS="-all-static"
+	${MAKE} -C ${WRKBUILD}/lib/sl install LDFLAGS="-all-static"
 	$(CP) $(STAGING_HOST_DIR)/libexec/heimdal/{slc,asn1_compile} \
 		$(STAGING_HOST_DIR)/bin
 	${MAKE} -C ${WRKBUILD}/lib/sl clean

+ 1 - 1
package/heimdal/patches/patch-lib_roken_Makefile_in

@@ -29,7 +29,7 @@
 +	$(AWK) -f $(srcdir)/roken.awk $(srcdir)/roken.h.in > make-roken.c
 +
 +make-roken$(EXEEXT): make-roken.c
-+	$(HOSTCC) $(HOSTCFLAGS) -I$(top_builddir)/include -DHAVE_CONFIG_H \
++	$(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) -I$(top_builddir)/include -DHAVE_CONFIG_H \
 +		-o $@ $<
  
 -@CROSS_COMPILE_TRUE@roken.h: $(top_srcdir)/cf/roken-h-process.pl roken.h.in

+ 1 - 2
package/httping/Makefile

@@ -19,9 +19,8 @@ include ${TOPDIR}/mk/package.mk
 
 $(eval $(call PKG_template,HTTPING,${PKG_NAME},${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION}))
 
-TCFLAGS+=		-D_GNU_SOURCE
-
 CONFIG_STYLE:=		manual
+TARGET_CFLAGS+=		-D_GNU_SOURCE
 
 post-install:
 	${INSTALL_DIR} ${IDIR_HTTPING}/usr/bin

+ 3 - 1
package/huawei/Makefile

@@ -21,8 +21,10 @@ CONFIG_STYLE:=		manual
 BUILD_STYLE:=		manual
 INSTALL_STYLE:=		manual
 
+TARGET_CFLAGS+=		-Wall
+
 do-build:
-	${TARGET_CC} -Wall ${TCPPFLAGS} ${TCFLAGS} \
+	${TARGET_CC} ${TARGET_CPPFLAGS} ${TARGET_CFLAGS} ${TARGET_LDFLAGS} \
 		-o ${WRKBUILD}/huawei ${WRKBUILD}/huawei.c -lusb
 
 do-install:

+ 1 - 1
package/icecast/Makefile

@@ -18,7 +18,7 @@ include ${TOPDIR}/mk/package.mk
 
 $(eval $(call PKG_template,ICECAST,${PKG_NAME},${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION}))
 
-TCPPFLAGS+=		-I${STAGING_TARGET_DIR}/usr/include/libxml2
+TARGET_CPPFLAGS+=	-I${STAGING_TARGET_DIR}/usr/include/libxml2
 CONFIGURE_ARGS+=	--disable-yp \
 			--with-curl="yes" \
 			--with-curl-config="${STAGING_TARGET_DIR}/usr/bin/curl-config" \

+ 3 - 3
package/id3lib/Makefile

@@ -20,7 +20,7 @@ include ${TOPDIR}/mk/package.mk
 
 $(eval $(call PKG_template,ID3LIB,id3lib,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION}))
 
-TCFLAGS+=		-fPIC
+TARGET_CFLAGS+=		-fPIC
 CONFIGURE_ARGS+=	--enable-cxx-warnings=no
 
 LIBRARIES:=-nodefaultlibs -luClibc++ -lz -lm -lc
@@ -29,11 +29,11 @@ LIBRARIES+=-lssp -fstack-protector
 endif
 
 ifeq ($(ADK_COMPILE_ID3LIB_WITH_UCLIBCXX),y)
-TCXXFLAGS+=		-fno-builtin -fno-rtti -nostdinc++ \
+TARGET_CXXFLAGS+=	-fno-builtin -fno-rtti -nostdinc++ \
 			-I${STAGING_TARGET_DIR}/usr/include/uClibc++
 CONFIGURE_ENV+=		LIBS="${LIBRARIES}"
 else
-TLDFLAGS+=		-shared
+TARGET_LDFLAGS+=	-shared
 endif
 
 post-install:

+ 2 - 3
package/igmpproxy/Makefile

@@ -19,12 +19,11 @@ include ${TOPDIR}/mk/package.mk
 
 $(eval $(call PKG_template,IGMPPROXY,${PKG_NAME},${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION}))
 
-TCFLAGS+=		-std=gnu99
+TARGET_CFLAGS+=		-std=gnu99
 
 post-install:
 	${INSTALL_DIR} ${IDIR_IGMPPROXY}/usr/sbin ${IDIR_IGMPPROXY}/etc
-	${INSTALL_BIN} ${WRKINST}/usr/sbin/igmpproxy \
-		 ${IDIR_IGMPPROXY}/usr/sbin/
+	${INSTALL_BIN} ${WRKINST}/usr/sbin/igmpproxy ${IDIR_IGMPPROXY}/usr/sbin
 	${INSTALL_DATA} ${WRKINST}/etc/igmpproxy.conf ${IDIR_IGMPPROXY}/etc
 
 include ${TOPDIR}/mk/pkg-bottom.mk

+ 3 - 3
package/iperf/Makefile

@@ -20,12 +20,12 @@ include ${TOPDIR}/mk/package.mk
 $(eval $(call PKG_template,IPERF,${PKG_NAME},${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION}))
 
 ifeq ($(ADK_TOOLCHAIN_GCC_USE_SSP),y)
-TLDFLAGS+=		-lssp
+TARGET_LDFLAGS+=	-lssp
 endif
 
 ifeq ($(ADK_COMPILE_IPERF_WITH_UCLIBCXX),y)
-TCXXFLAGS+=		-fno-builtin -fno-rtti -nostdinc++
-TLDFLAGS+=		-nodefaultlibs
+TARGET_CXXFLAGS+=	-fno-builtin -fno-rtti -nostdinc++
+TARGET_LDFLAGS+=	-nodefaultlibs
 CONFIGURE_ENV+=		LIBS="-luClibc++ -lc -lm -lgcc_s -lpthread"
 else
 CONFIGURE_ENV+=		LIBS="-lc -lm -lgcc_s -lpthread"

+ 2 - 2
package/iproute2/Makefile

@@ -42,8 +42,8 @@ $(eval $(call PKG_template,ROUTEL,routel,${PKG_VERSION}-${PKG_RELEASE},,${PKGSD_
 $(eval $(call PKG_template,RTMON,rtmon,${PKG_VERSION}-${PKG_RELEASE},,${PKGSD_RTMON},${PKG_SECTION}))
 $(eval $(call PKG_template,SS,ss,${PKG_VERSION}-${PKG_RELEASE},,${PKGSD_SS},${PKG_SECTION}))
 
-TCFLAGS+=		-D_GNU_SOURCE
-XAKE_FLAGS+=		CCOPTS="${TCFLAGS}" MFLAGS="CC=${TARGET_CC}" \
+TARGET_CFLAGS+=		-D_GNU_SOURCE
+XAKE_FLAGS+=		CCOPTS="${TARGET_CFLAGS}" MFLAGS="CC=${TARGET_CC}" \
 			HOSTCFLAGS="-I${LINUX_HEADER_DIR}/include"
 CONFIGURE_ENV+=		IPTC="${TARGET_CFLAGS}" IPTL="${TARGET_LDFLAGS}"
 

+ 1 - 4
package/ipset/Makefile

@@ -29,10 +29,7 @@ ALL_TARGET:=		binaries
 INSTALL_TARGET:=	binaries_install
 
 pre-build:
-	V=1 ARCH=${ARCH} KERNEL_DIR=${LINUX_DIR} \
-	PREFIX=/usr CROSS_COMPILE="${TARGET_CROSS}" \
-	LD=$(TARGET_CROSS)gcc LDFLAGS="" \
-	$(MAKE) -C ${WRKBUILD} modules
+	$(MAKE) -C ${WRKBUILD} $(KERNEL_MODULE_FLAGS) modules
 
 post-install:
 	${INSTALL_DIR} ${IDIR_IPSET}/usr/sbin ${IDIR_IPSET}/usr/lib/ipset

+ 36 - 0
package/ipset/patches/patch-Makefile

@@ -0,0 +1,36 @@
+--- ipset-4.1.orig/Makefile	2009-11-11 20:22:42.000000000 +0100
++++ ipset-4.1/Makefile	2011-01-21 13:30:47.148658311 +0100
+@@ -64,9 +64,13 @@ ifndef NO_EXTRA_WARN_FLAGS
+ endif
+ 
+ ABI_FLAGS:=
+-CFLAGS:=$(ABI_FLAGS) $(COPT_FLAGS) $(WARN_FLAGS) -Ikernel/include -I. # -g -DIPSET_DEBUG
++CPPFLAGS?=
++CPPFLAGS+=-Ikernel/include -I.
++CFLAGS?=$(ABI_FLAGS) $(COPT_FLAGS) $(WARN_FLAGS)
+ SH_CFLAGS:=$(CFLAGS) -fPIC
+-LDFLAGS:=$(ABI_FLAGS)
++LDFLAGS?=$(ABI_FLAGS)
++LIBS?=
++LIBS+=-ldl
+ SETTYPES:=ipmap portmap macipmap
+ SETTYPES+=iptree iptreemap
+ SETTYPES+=iphash nethash ipporthash ipportiphash ipportnethash
+@@ -114,14 +118,14 @@ release: clean
+ 
+ #The ipset(8) self
+ ipset.o: ipset.c ipset.h
+-	$(CC) $(CFLAGS) -DIPSET_VERSION=\"$(IPSET_VERSION)\" -DIPSET_LIB_DIR=\"$(IPSET_LIB_DIR)\" -c -o $@ $<
++	$(CC) $(CPPFLAGS) $(CFLAGS) -DIPSET_VERSION=\"$(IPSET_VERSION)\" -DIPSET_LIB_DIR=\"$(IPSET_LIB_DIR)\" -c -o $@ $<
+ 
+ ipset: ipset.o
+-	$(CC) $(CFLAGS) $(LDFLAGS) -rdynamic -o $@ $^ -ldl
++	$(CC) $(LDFLAGS) -o $@ $^ $(LIBS)
+ 
+ #Pooltypes
+ ipset_%.o: ipset_%.c ipset.h
+-	$(CC) $(SH_CFLAGS) -o $@ -c $<
++	$(CC) $(CPPFLAGS) $(SH_CFLAGS) -o $@ -c $<
+ 
+ libipset_%.so: ipset_%.o
+ 	$(CC) -shared $(LDFLAGS) -o $@ $<

+ 63 - 7
package/iptraf/patches/patch-src_Makefile

@@ -1,23 +1,70 @@
 $Id$
 --- iptraf-3.0.0.orig/src/Makefile	2005-09-13 11:11:17.000000000 +0200
-+++ iptraf-3.0.0/src/Makefile	2010-10-05 10:07:10.000000000 +0200
-@@ -107,13 +107,13 @@ BINS = iptraf rvnamed rawtime
++++ iptraf-3.0.0/src/Makefile	2011-01-21 13:46:03.628658655 +0100
+@@ -18,7 +18,8 @@ VERSION 	= -DVERSION=\"$(VERNUMBER)\"
+ BINDIR		= ../../iptraf-$(VERNUMBER).bin.$(ARCH)
+ 
+ CC		= gcc
+-LIBS		= -L../support -ltextbox -lpanel -lncurses   # in this order!
++LIBS		?=
++LIBS		+= -ltextbox -lpanel -lncurses   # in this order!
+ 
+ # comment this one out to omit debug code when done.
+ 
+@@ -31,15 +32,17 @@ PROF		= #-pg
+ # options to be passed to the compiler.  I don't believe they need to be
+ # modified (except for -m486 on non-Intel x86 platforms).
+ 
+-CFLAGS		= -Wall #-O2 #-m486
++CFLAGS		?= -Wall #-O2 #-m486
+ DIRS		= -DWORKDIR=\"$(WORKDIR)\" \
+ 		  -DLOGDIR=\"$(LOGDIR)\" -DEXECDIR=\"$(TARGET)\"
+-LDOPTS		= #-static
++LDFLAGS ?=
++LDFLAGS += 	-L../support
+ 
+ # you may want to change this to point to your ncurses include directory
+ # if the ncurses include files are not in the default location.
+ 
+-INCLUDEDIR	= -I/usr/include/ncurses -I../support
++CPPFLAGS ?=
++CPPFLAGS +=	-I../support
+ 
+ # You can uncomment this one to disable the backspace key in input fields.
+ # This means you must use the Del key or Ctrl+H combination to erase the
+@@ -106,33 +109,31 @@ error.o log.o mode.o getpath.o bar.o par
+ BINS = iptraf rvnamed rawtime
  
  all: $(BINS)
- 	@echo
+-	@echo
 -	@size $(BINS)
-+	#@size $(BINS)
  
  iptraf: $(OBJS) textlib
- 	$(CC) $(LDOPTS) $(PROF) -o iptraf $(OBJS) $(LIBS)
+-	$(CC) $(LDOPTS) $(PROF) -o iptraf $(OBJS) $(LIBS)
++	$(CC) $(LDFLAGS) -o iptraf $(OBJS) $(LIBS)
  
  textlib:
 -	make -C ../support
 +	$(MAKE) -C ../support
  
  %.o: %.c *.h version
- 	$(CC) $(CFLAGS) $(DIRS) $(INCLUDEDIR) $(VERSION) $(PLATFORM) $(PROF) $(DEBUG) $(EXECPERM) $(BSSETTING) -c -o $*.o $<
-@@ -132,7 +132,7 @@ rawtime: rawtime.c
+-	$(CC) $(CFLAGS) $(DIRS) $(INCLUDEDIR) $(VERSION) $(PLATFORM) $(PROF) $(DEBUG) $(EXECPERM) $(BSSETTING) -c -o $*.o $<
++	$(CC) $(CPPFLAGS) $(CFLAGS) $(DIRS) $(VERSION) $(PLATFORM) $(EXECPERM) $(BSSETTING) -c -o $*.o $<
+ 
+ rvnamed: rvnamed.o getpath.o
+-	$(CC) $(LDOPTS) $(PROF) -o rvnamed rvnamed.o getpath.o
++	$(CC) $(LDFLAGS) -o $@ $^
+ 
+ rvnamed.o: rvnamed.c rvnamed.h
+-	$(CC) $(CFLAGS) $(PROF) $(DEBUG) -c -o rvnamed.o rvnamed.c
++	$(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ rvnamed.c
+ 
+ rawtime: rawtime.c
+-	$(CC) $(CFLAGS) $(LDOPTS) $(PROF) $(DEBUG) -o rawtime rawtime.c
++	$(CC) $(CFLAGS) $(LDFLAGS) -o rawtime rawtime.c
+ 
+ 
+ # rule to clear out all object files and the executables (pow!)
  
  clean:
  	rm -f *.o *~ core $(BINS)
@@ -26,3 +73,12 @@ $Id$
  
  # I just included this rule to clear out the .o files, leaving the
  # executables, stripped and ready for packing.
+@@ -162,7 +163,7 @@ install:
+ # and the compiled programs for release as a ready-to-run distribution.
+ 
+ dist-bin: all
+-	$(CC) $(LDOPTS) $(PROF) -o iptraf $(OBJS) -L../support -ltextbox /usr/lib/libpanel.a /usr/lib/libncurses.a
++	$(CC) $(LDFLAGS) -o iptraf $(OBJS) -L../support -ltextbox -lpanel -lncurses
+ 	rm -rf $(BINDIR)
+ 	mkdir $(BINDIR)
+ 	/bin/cp -p ../CHANGES ../LICENSE ../FAQ ../INSTALL ../README* \

+ 5 - 4
package/iptraf/patches/patch-support_Makefile

@@ -1,7 +1,9 @@
 $Id: update-patches 24 2008-08-31 14:56:13Z wbx $
 --- iptraf-3.0.0.orig/support/Makefile	2002-07-19 18:31:48.000000000 +0200
-+++ iptraf-3.0.0/support/Makefile	2008-10-09 17:34:11.000000000 +0200
-@@ -3,16 +3,14 @@ INCLUDEDIR		= -I/usr/include/ncurses
++++ iptraf-3.0.0/support/Makefile	2011-01-21 13:47:38.508658394 +0100
+@@ -1,18 +1,13 @@
+-INCLUDEDIR		= -I/usr/include/ncurses
+-
  OBJS			= input.o menurt.o listbox.o winops.o labels.o \
  				msgboxes.o txbox.o
  
@@ -14,11 +16,10 @@ $Id: update-patches 24 2008-08-31 14:56:13Z wbx $
 -#	gcc -shared -o libtextbox.so $(OBJS)
 +	$(AR) cq libtextbox.a $(OBJS)
 +	$(RANLIB) libtextbox.a
-+#	$(CC) -shared -o libtextbox.so $(OBJS)
  
  %.o: %.c *.h
 -	gcc -O2 -g -Wall -fPIC $(INCLUDEDIR) -c -o $*.o $<
-+	$(CC) -O2 -g -Wall -fPIC $(INCLUDEDIR) -c -o $*.o $<
++	$(CC) $(CPPFLAGS) $(CFLAGS) -fPIC -c -o $*.o $<
  
  clean:
  	rm -rf *.o *~ libtextbox.a libtextbox.so

+ 1 - 1
package/iw/Makefile

@@ -22,7 +22,7 @@ include ${TOPDIR}/mk/package.mk
 $(eval $(call PKG_template,IW,${PKG_NAME},${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION}))
 
 CONFIG_STYLE:=		manual
-TCFLAGS+=		$(TCPPFLAGS)
+TARGET_CFLAGS+=		$(TARGET_CPPFLAGS)
 
 post-install:
 	${INSTALL_DIR} ${IDIR_IW}/usr/sbin

+ 0 - 1
package/knock/Makefile

@@ -22,7 +22,6 @@ include ${TOPDIR}/mk/package.mk
 $(eval $(call PKG_template,KNOCK,knock,${PKG_VERSION}-${PKG_RELEASE},,${PKG_DESCR},${PKG_SECTION}))
 $(eval $(call PKG_template,KNOCKD,knockd,${PKG_VERSION}-${PKG_RELEASE},${PKGSS_KNOCKD},${PKGSD_KNOCKD},${PKG_SECTION}))
 
-TCXXFLAGS+=		${TCPPFLAGS} ${TCFLAGS}
 CONFIGURE_ENV+=		ac_cv_lib_pcap_pcap_open_live=yes
 
 post-install:

+ 1 - 1
package/krb5/Makefile

@@ -27,7 +27,7 @@ include $(TOPDIR)/mk/package.mk
 $(eval $(call PKG_template,KRB5_SERVER,krb5-server,$(PKG_VERSION)-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION}))
 $(eval $(call PKG_template,LIBKRB5,libkrb5,$(PKG_VERSION)-${PKG_RELEASE},,${PKGSD_LIBKRB5},${PKGSC_LIBKRB5}))
 
-TCFLAGS+=		-I${STAGING_TARGET_DIR}/usr/include/et
+TARGET_CPPFLAGS+=	-I${STAGING_TARGET_DIR}/usr/include/et
 CONFIGURE_ARGS+=	--disable-static \
 			--disable-profiled \
 			--with-system-ss \

+ 2 - 0
package/libart/Makefile

@@ -18,6 +18,8 @@ include ${TOPDIR}/mk/package.mk
 
 $(eval $(call PKG_template,LIBART,libart,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION}))
 
+MAKE_ENV+=		HOSTCC=$(CC_FOR_BUILD)
+
 post-install:
 	${INSTALL_DIR} ${IDIR_LIBART}/usr/lib
 	${CP} ${WRKINST}/usr/lib/libart_lgpl_2.so* ${IDIR_LIBART}/usr/lib/

+ 1 - 2
package/libevent/Makefile

@@ -23,8 +23,7 @@ $(eval $(call PKG_template,LIBEVENT_DEV,libevent-dev,$(PKG_VERSION)-${PKG_RELEAS
 
 post-install:
 	$(INSTALL_DIR) $(IDIR_LIBEVENT)/usr/lib
-	$(CP) $(WRKINST)/usr/lib/libevent*.so* \
-		$(IDIR_LIBEVENT)/usr/lib/
+	$(CP) $(WRKINST)/usr/lib/libevent*.so* $(IDIR_LIBEVENT)/usr/lib
 
 libevent-dev-install:
 	${INSTALL_DIR} ${IDIR_LIBEVENT_DEV}/usr/include

+ 4 - 2
package/libhugetlbfs/Makefile

@@ -4,14 +4,16 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=		libhugetlbfs
-PKG_VERSION:=		2.6
+PKG_VERSION:=		2.11
 PKG_RELEASE:=		1
-PKG_MD5SUM:=		cda489010e5bb89eb59994f689f8693e
+PKG_MD5SUM:=		35e68f16b704f2e339622a8ca07fdee0
 PKG_DESCR:=		easy hugepage access
 PKG_SECTION:=		libs
 PKG_URL:=		http://libhugetlbfs.ozlabs.org/
 PKG_SITES:=		${MASTER_SITE_SOURCEFORGE:=libhugetlbfs/}
 
+PKG_CFLINE_LIBHUGETLBFS:=	depends on ADK_TARGET_LIB_GLIBC || ADK_TARGET_LIB_EGLIBC
+
 include $(TOPDIR)/mk/package.mk
 
 $(eval $(call PKG_template,LIBHUGETLBFS,$(PKG_NAME),$(PKG_VERSION)-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION}))

+ 3 - 3
package/libhugetlbfs/patches/patch-Makefile

@@ -1,8 +1,8 @@
 	- do not call uname -m, use passed ${ADK_ARCH} variable
 	- use ${CC} instead of hard-coded gcc
---- libhugetlbfs-2.6.orig/Makefile	2009-08-24 14:56:07.000000000 +0200
-+++ libhugetlbfs-2.6/Makefile	2011-01-17 15:17:03.942093253 +0100
-@@ -30,51 +30,51 @@ CFLAGS ?= -O2 -g
+--- libhugetlbfs-2.11.orig/Makefile	2010-12-16 18:38:22.000000000 +0100
++++ libhugetlbfs-2.11/Makefile	2011-01-22 21:09:48.008659615 +0100
+@@ -31,51 +31,51 @@ CFLAGS ?= -O2 -g
  CFLAGS += -Wall -fPIC
  CPPFLAGS += -D__LIBHUGETLBFS__
  

+ 11 - 0
package/libhugetlbfs/patches/patch-morecore_c

@@ -0,0 +1,11 @@
+--- libhugetlbfs-2.11.orig/morecore.c	2010-12-16 18:38:22.000000000 +0100
++++ libhugetlbfs-2.11/morecore.c	2011-01-22 21:18:44.018658436 +0100
+@@ -268,7 +268,7 @@ void hugetlbfs_setup_morecore(void)
+ 	INFO("setup_morecore(): heapaddr = 0x%lx\n", heapaddr);
+ 
+ 	heaptop = heapbase = (void *)heapaddr;
+-	__morecore = &hugetlbfs_morecore;
++	morecore = &hugetlbfs_morecore;
+ 
+ 	/* Set some allocator options more appropriate for hugepages */
+ 

+ 5 - 0
package/libhugetlbfs/patches/patch-version

@@ -0,0 +1,5 @@
+--- libhugetlbfs-2.11.orig/version	2010-12-16 19:14:12.000000000 +0100
++++ libhugetlbfs-2.11/version	2011-01-22 21:09:48.624905626 +0100
+@@ -1 +1 @@
+-2.11
++commit<f475340970f58d3643bdd7e3cec809dc1fa3e908>

+ 1 - 1
package/libiconv/Makefile

@@ -20,7 +20,7 @@ include ${TOPDIR}/mk/package.mk
 
 $(eval $(call PKG_template,LIBICONV,${PKG_NAME},${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION},${PKG_OPTS}))
 
-TCFLAGS+=		-fPIC
+TARGET_CFLAGS+=		-fPIC
 FAKE_FLAGS+=		libdir="${WRKINST}/usr/lib" \
 			includedir="${WRKINST}/usr/include" \
 INSTALL_TARGET=		install-lib

+ 1 - 1
package/libid3tag/Makefile

@@ -26,6 +26,6 @@ pre-install:
 
 post-install:
 	${INSTALL_DIR} ${IDIR_LIBID3TAG}/usr/lib
-	${CP} ${WRKINST}/usr/lib/libid3tag.so.* ${IDIR_LIBID3TAG}/usr/lib/
+	${CP} ${WRKINST}/usr/lib/libid3tag.so* ${IDIR_LIBID3TAG}/usr/lib/
 
 include ${TOPDIR}/mk/pkg-bottom.mk

+ 14 - 0
package/libid3tag/patches/patch-configure

@@ -0,0 +1,14 @@
+--- libid3tag-0.15.1b.orig/configure	2004-02-05 10:35:25.000000000 +0100
++++ libid3tag-0.15.1b/configure	2011-01-21 14:17:04.434906188 +0100
+@@ -19038,10 +19038,7 @@ do
+ 	    arch="$arch $1"
+ 	    shift
+ 	    ;;
+-	-fomit-frame-pointer)
+-	    shift
+-	    ;;
+-	-O*|-f*)
++	-O*)
+ 	    optimize="$1"
+ 	    shift
+ 	    ;;

+ 0 - 1
package/libnet/Makefile

@@ -31,7 +31,6 @@ $(eval $(call PKG_template,LIBNET,${PKG_NAME},${PKG_VERSION}-${PKG_RELEASE},${PK
 
 CONFIGURE_ENV+=		ac_cv_libnet_endianess=${ENDIAN} \
 			ac_cv_lbl_unaligned_fail=no
-#CONFIGURE_ARGS+=	--with-pf_packet=yes
 
 post-install:
 	${INSTALL_DIR} ${IDIR_LIBNET}/usr/lib

+ 11 - 0
package/libosip2/patches/patch-configure

@@ -0,0 +1,11 @@
+--- libosip2-3.3.0.orig/configure	2009-03-04 12:18:53.000000000 +0100
++++ libosip2-3.3.0/configure	2011-01-21 14:27:29.384906610 +0100
+@@ -22308,7 +22308,7 @@ if test "x$Wpointer_arith_flag" = xyes; 
+   CPPFLAGS="$CPPFLAGS -Wpointer-arith"
+ fi
+ 
+-SIP_CFLAGS="$SIP_CFLAGS $CFLAGS"
++SIP_CFLAGS="$SIP_CFLAGS"
+ 
+ 
+ 

+ 1 - 1
package/libowfat/Makefile

@@ -17,7 +17,7 @@ include ${TOPDIR}/mk/package.mk
 
 CONFIG_STYLE:=		manual
 
-TCFLAGS+=		${TCPPFLAGS}
+TARGET_CFLAGS+=		${TARGET_CPPFLAGS}
 MAKE_FILE=		GNUmakefile
 MAKE_FLAGS+=		DIET= CC='${TARGET_CC}' CROSS=${TARGET_CROSS} \
 			LDFLAGS='${TARGET_LDFLAGS}'

+ 2 - 2
package/libpcap/Makefile

@@ -21,9 +21,9 @@ $(eval $(call PKG_template,LIBPCAP,${PKG_NAME},$(PKG_VERSION)-${PKG_RELEASE},${P
 
 CONFIGURE_ENV+=		ac_cv_linux_vers=26
 CONFIGURE_ARGS+=	--disable-yydebug \
-			--with-build-cc=$(HOSTCC) \
+			--with-build-cc=$(CC_FOR_BUILD) \
 			--with-pcap=linux
-TCFLAGS+=		${TCPPFLAGS}
+TARGET_CFLAGS+=		${TARGET_CPPFLAGS}
 INSTALL_TARGET=		install install-shared
 MAKE_FLAGS+=		STAGING_TARGET_DIR=$(STAGING_TARGET_DIR)
 

+ 1 - 1
package/libpri/Makefile

@@ -18,7 +18,7 @@ $(eval $(call PKG_template,LIBPRI,${PKG_NAME},${PKG_VERSION}-${PKG_RELEASE},${PK
 
 CONFIG_STYLE:=		manual
 
-MAKE_FLAGS+=		CC='${TARGET_CC}' LDCONFIG=''
+MAKE_FLAGS+=		CC='${TARGET_CC}' LDCONFIG='' ARCH=$(ARCH)
 FAKE_FLAGS+=		INSTALL_BASE=/usr
 
 post-install:

+ 32 - 2
package/libpri/patches/patch-Makefile

@@ -1,6 +1,36 @@
 --- libpri-1.4.10.2.orig/Makefile	2008-08-06 20:20:51.000000000 +0200
-+++ libpri-1.4.10.2/Makefile	2010-05-29 09:55:08.750000000 +0200
-@@ -146,7 +146,6 @@ $(STATIC_LIBRARY): $(STATIC_OBJS)
++++ libpri-1.4.10.2/Makefile	2011-01-21 14:32:08.278658337 +0100
+@@ -31,8 +31,8 @@ CC=gcc
+ GREP=grep
+ AWK=awk
+ 
+-OSARCH=$(shell uname -s)
+-PROC?=$(shell uname -m)
++OSARCH=Linux
++PROC?=$(ARCH)
+ 
+ # SONAME version; should be changed on every ABI change
+ # please don't change it needlessly; it's perfectly fine to have a SONAME
+@@ -43,7 +43,8 @@ STATIC_LIBRARY=libpri.a
+ DYNAMIC_LIBRARY:=libpri.so.$(SONAME)
+ STATIC_OBJS=copy_string.o pri.o q921.o prisched.o q931.o pri_facility.o version.o
+ DYNAMIC_OBJS=copy_string.lo pri.lo q921.lo prisched.lo q931.lo pri_facility.lo version.lo
+-CFLAGS=-Wall -Werror -Wstrict-prototypes -Wmissing-prototypes -g -fPIC $(ALERTING) $(LIBPRI_COUNTERS)
++CFLAGS?=
++CFLAGS+=-Wall -Werror -Wstrict-prototypes -Wmissing-prototypes -fPIC $(ALERTING) $(LIBPRI_COUNTERS)
+ INSTALL_PREFIX=$(DESTDIR)
+ INSTALL_BASE=/usr
+ libdir?=$(INSTALL_BASE)/lib
+@@ -135,7 +136,7 @@ pridump: pridump.o
+ MAKE_DEPS= -MD -MT $@ -MF .$(subst /,_,$@).d -MP
+ 
+ %.o: %.c
+-	$(CC) $(CFLAGS) $(MAKE_DEPS) -c -o $@ $<
++	$(CC) $(CPPFLAGS) $(CFLAGS) $(MAKE_DEPS) -c -o $@ $<
+ 
+ %.lo: %.c
+ 	$(CC) $(CFLAGS) $(MAKE_DEPS) -c -o $@ $<
+@@ -146,7 +147,6 @@ $(STATIC_LIBRARY): $(STATIC_OBJS)
  
  $(DYNAMIC_LIBRARY): $(DYNAMIC_OBJS)
  	$(CC) -shared $(SOFLAGS) -o $@ $(DYNAMIC_OBJS)

+ 1 - 1
package/libupnp/Makefile

@@ -19,7 +19,7 @@ include ${TOPDIR}/mk/package.mk
 
 $(eval $(call PKG_template,LIBUPNP,${PKG_NAME},${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION}))
 
-TCFLAGS+=		-fPIC
+TARGET_CFLAGS+=		-fPIC
 CONFIGURE_ARGS+=	--disable-samples
 
 post-build:

+ 1 - 1
package/libvirt/Makefile

@@ -21,7 +21,7 @@ include ${TOPDIR}/mk/package.mk
 
 $(eval $(call PKG_template,LIBVIRT,${PKG_NAME},${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION}))
 
-TCFLAGS+=		-std=c99
+TARGET_CFLAGS+=		-std=c99
 CONFIGURE_ARGS+=	--without-xen \
 			--without-uml \
 			--without-esx \

+ 1 - 1
package/lighttpd/Makefile

@@ -68,7 +68,7 @@ $(eval $(call PKG_mod_template,LIGHTTPD_MOD_STATUS,status))
 $(eval $(call PKG_mod_template,LIGHTTPD_MOD_USERTRACK,usertrack))
 $(eval $(call PKG_mod_template,LIGHTTPD_MOD_WEBDAV,webdav))
 
-TCPPFLAGS+=		-I$(STAGING_TARGET_DIR)/usr/include/libxml2
+TARGET_CPPFLAGS+=	-I$(STAGING_TARGET_DIR)/usr/include/libxml2
 CONFIGURE_ENV+=		PCRE_LIB="-lpcre"
 CONFIGURE_ARGS+=	\
 			--libdir=/usr/lib/lighttpd \

+ 1 - 1
package/logrotate/Makefile

@@ -18,7 +18,7 @@ include ${TOPDIR}/mk/package.mk
 $(eval $(call PKG_template,LOGROTATE,${PKG_NAME},${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION}))
 
 CONFIG_STYLE:=		manual
-TCFLAGS+=              -D_GNU_SOURCE -DVERSION=\"$(PKG_VERSION)\"
+TARGET_CFLAGS+=		-D_GNU_SOURCE -DVERSION=\"$(PKG_VERSION)\"
 
 post-install:
 	${INSTALL_DIR} ${IDIR_LOGROTATE}/usr/sbin

+ 2 - 2
package/lua/Makefile

@@ -26,8 +26,8 @@ $(eval $(call PKG_template,LUAC,luac,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS
 $(eval $(call PKG_template,LUA_EXAMPLES,lua-examples,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKGSD_LUAEXAMPLES},${PKG_SECTION}))
 
 CONFIG_STYLE:=		manual
-MAKE_FLAGS+=		CFLAGS="${TCFLAGS} ${TCPPFLAGS} -DLUA_USE_LINUX -fPIC" \
-			MYLDFLAGS="${TLDFLAGS}" \
+MAKE_FLAGS+=		CFLAGS="${TARGET_CFLAGS} ${TARGET_CPPFLAGS} -DLUA_USE_LINUX -fPIC" \
+			MYLDFLAGS="${TARGET_LDFLAGS}" \
 			CC="${TARGET_CC}" LD="${TARGET_CROSS}ld" \
 			AR="${TARGET_CROSS}ar rcu" \
 			RANLIB="${TARGET_CROSS}ranlib"

+ 2 - 5
package/lynx/Makefile

@@ -21,10 +21,8 @@ include ${TOPDIR}/mk/package.mk
 
 $(eval $(call PKG_template,LYNX,${PKG_NAME},${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION}))
 
-TCPPFLAGS+=		-I${STAGING_TARGET_DIR}/include/openssl
-TCPPFLAGS+=		-DUSE_OPENSSL_INCL -DUSE_X509_SUPPORT
-TLDFLAGS+=		-lz
-
+TARGET_CPPFLAGS+=	-I${STAGING_TARGET_DIR}/include/openssl
+TARGET_CPPFLAGS+=	-DUSE_OPENSSL_INCL -DUSE_X509_SUPPORT
 CONFIGURE_ENV+=		ac_cv_path_TELNET=telnet \
 			ac_cv_path_TN3270=tn3270 \
 			ac_cv_path_RLOGIN=rlogin \
@@ -78,7 +76,6 @@ CONFIGURE_ARGS+=	\
 			--disable-widec \
 			--disable-locale-charset \
 			--with-build-cppflags="-I/usr/include/ncurses"
-
 MAKE_FILE:=		makefile
 
 post-install:

+ 1 - 1
package/madplay/Makefile

@@ -19,7 +19,7 @@ include ${TOPDIR}/mk/package.mk
 
 $(eval $(call PKG_template,MADPLAY,${PKG_NAME},${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION}))
 
-CONFIGURE_ENV+=		BUILD_CC="${TARGET_CC}" HOSTCC=${HOST_CC} \
+CONFIGURE_ENV+=		BUILD_CC="${TARGET_CC}" HOSTCC=${CC_FOR_BUILD} \
 			LIBS="-lz" \
 			ac_cv_linux_vers=2 \
 			td_cv_buggygetaddrinfo="no"

+ 14 - 0
package/madplay/patches/patch-configure

@@ -0,0 +1,14 @@
+--- madplay-0.15.2b.orig/configure	2004-02-23 22:36:21.000000000 +0100
++++ madplay-0.15.2b/configure	2011-01-21 16:04:04.644909723 +0100
+@@ -19057,10 +19057,7 @@ do
+ 	    arch="$arch $1"
+ 	    shift
+ 	    ;;
+-	-fomit-frame-pointer)
+-	    shift
+-	    ;;
+-	-O*|-f*)
++	-O*)
+ 	    optimize="$1"
+ 	    shift
+ 	    ;;

+ 3 - 4
package/maradns/Makefile

@@ -4,22 +4,21 @@
 include ${TOPDIR}/rules.mk
 
 PKG_NAME:=		maradns
-PKG_VERSION:=		1.4.03
+PKG_VERSION:=		1.4.05
 PKG_RELEASE:=		1
-PKG_MD5SUM:=		9e715104234cc9bf01e2afaad27eb787
+PKG_MD5SUM:=		aff277f6ba0e1ff46d32a60ab84f16cb
 PKG_DESCR:=		small and secure DNS server
 PKG_SECTION:=		dns
-PKG_NOPARALLEL:=	1
 PKG_DEPENDS:=		libpthread
 PKG_URL:=		http://www.maradns.org
 PKG_SITES:=		http://www.maradns.org/download/1.4/${PKG_VERSION}/
+PKG_NOPARALLEL:=	1
 
 include ${TOPDIR}/mk/package.mk
 
 $(eval $(call PKG_template,MARADNS,${PKG_NAME},${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION}))
 
 CONFIG_STYLE:=		manual
-
 FAKE_FLAGS+=		PREFIX="${WRKINST}/usr" \
 			RPM_BUILD_ROOT="${WRKINST}"
 

+ 13 - 5
package/maradns/patches/cross-compile-fix.patch

@@ -1,12 +1,20 @@
 diff -urN maradns-1.0.26.old/rng/Makefile maradns-1.0.26.dev/rng/Makefile
---- maradns-1.4.03.orig/rng/Makefile	2006-01-02 17:59:33.000000000 +0100
-+++ maradns-1.4.03/rng/Makefile	2010-02-06 00:19:48.241836878 +0100
-@@ -25,7 +25,7 @@ rng-api-fst.o: rng-alg-fst.o rng-api-fst
- 	$(CC) -c $(FLAGS) -o rng-api-fst.o rng-api-fst.c
+--- maradns-1.4.05.orig/rng/Makefile	2006-01-02 17:59:33.000000000 +0100
++++ maradns-1.4.05/rng/Makefile	2011-01-21 16:47:29.318658272 +0100
+@@ -19,13 +19,13 @@ superclean:
+ 	rm -f $(ROBJECTS) core make_32bit_tables $(TABLES)
+ 
+ rng-alg-fst.o: rng-alg-fst.c rng-alg-fst.h $(TABLES)
+-	$(CC) -c $(FLAGS) -o rng-alg-fst.o rng-alg-fst.c
++	$(CC) -c $(CFLAGS) -o rng-alg-fst.o rng-alg-fst.c
+ 
+ rng-api-fst.o: rng-alg-fst.o rng-api-fst.h 
+-	$(CC) -c $(FLAGS) -o rng-api-fst.o rng-api-fst.c
++	$(CC) -c $(CFLAGS) -o rng-api-fst.o rng-api-fst.c
  
  make_32bit_tables: make_32bit_tables.c
 -	$(CC) -o make_32bit_tables make_32bit_tables.c
-+	$(HOSTCC) -o make_32bit_tables make_32bit_tables.c
++	$(CC_FOR_BUILD) -o make_32bit_tables make_32bit_tables.c
  
  rng-32bit-tables.h: make_32bit_tables
  	./make_32bit_tables > rng-32bit-tables.h

+ 11 - 11
package/maradns/patches/patch-Makefile

@@ -1,12 +1,12 @@
---- maradns-1.4.03.orig/Makefile	2006-01-02 17:59:33.000000000 +0100
-+++ maradns-1.4.03/Makefile	2010-02-06 00:19:48.471836901 +0100
+--- maradns-1.4.05.orig/Makefile	2006-01-02 17:59:33.000000000 +0100
++++ maradns-1.4.05/Makefile	2011-01-21 16:48:06.124913980 +0100
 @@ -1,15 +1,82 @@
 -# This is a wrapper that runs "./configure ; make"
 -all:
 -	./compile.sh
-+VERSION=1.4.03
-+COMPILED="Linux system at Sat Feb 6 00:19:48 CET 2010"
-+COMPILED_DEBUG="Linux system at Sat Feb 6 00:19:48 CET 2010 (Debug)"
++VERSION=1.4.05
++COMPILED="Linux system at Fri Jan 21 16:48:06 CET 2011"
++COMPILED_DEBUG="Linux system at Fri Jan 21 16:48:06 CET 2011 (Debug)"
 +# Server objects
 +SOBJECTS=server/MaraBigHash.o
 +# js_string library (buffer overflow resistant string library) objects
@@ -34,23 +34,23 @@
 +# LDFLAGS=-L/usr/ucblib -lucb -lxnet
 +# end the Solaris section
 +# Non-Solaris version of "M"
-+V="VERSION=$(VERSION)"
++VER="VERSION=$(VERSION)"
 +Q="DEFINES=-DSELECT_PROBLEM"
 +
 +# Debug
 +
-+FLAGS = -O2 -Wall -DSELECT_PROBLEM
-+M="CC=$(CC) $(FLAGS)"
-+D="CC=$(CC) $(FLAGS) -DDEBUG -DTHREADS"
++CFLAGS ?= -O2 -Wall -DSELECT_PROBLEM
++M="CC=$(CC)"
++D="CC=$(CC) -DDEBUG -DTHREADS"
 +#FLAGS = -g
 +
 +all: 
 +	cd libs ; make $(M) ; cd ../dns ; make $(M) ; \
 +	cd ../rng ; make $(M) ; cd ../parse ; make $(M) ; \
 +	cd ../qual ; make $(M) ; cd ../server ; \
-+	make $(M) $(V) COMPILED=\"$(COMPILED)\" ; \
++	make $(M) $(VER) COMPILED=\"$(COMPILED)\" ; \
 +	cd ../tools ; make $(M) ; \
-+	cd ../tcp ; make $(M) $(V) ; cat ../00README.FIRST
++	cd ../tcp ; make $(M) $(VER)
 +
 +debug: 
 +	cd libs ; make $(D) DEBUG="-DDEBUG -DTHREADS" ; \

+ 4 - 4
package/maradns/patches/patch-build_Makefile_linux

@@ -1,5 +1,5 @@
---- maradns-1.4.03.orig/build/Makefile.linux	2006-11-24 12:44:29.000000000 +0100
-+++ maradns-1.4.03/build/Makefile.linux	2010-02-06 00:23:58.393084387 +0100
+--- maradns-1.4.05.orig/build/Makefile.linux	2006-11-24 12:44:29.000000000 +0100
++++ maradns-1.4.05/build/Makefile.linux	2011-01-21 16:36:23.968658279 +0100
 @@ -23,23 +23,23 @@ EXECS=server/maradns
  # LDFLAGS=-L/usr/ucblib -lucb -lxnet
  # end the Solaris section
@@ -14,8 +14,8 @@
 -M="CC=$(CC) $(FLAGS)"
 -D="CC=$(CC) $(FLAGS) -DDEBUG -DTHREADS"
 +CFLAGS ?= -O2 -Wall -DSELECT_PROBLEM
-+M="CC=$(CC) $(CFLAGS)"
-+D="CC=$(CC) $(CFLAGS) -DDEBUG -DTHREADS"
++M="CC=$(CC)"
++D="CC=$(CC) -DDEBUG -DTHREADS"
  #FLAGS = -g
  
  all: 

+ 21 - 2
package/maradns/patches/patch-dns_Makefile

@@ -1,5 +1,5 @@
---- maradns-1.4.03.orig/dns/Makefile	2005-12-20 11:10:40.000000000 +0100
-+++ maradns-1.4.03/dns/Makefile	2010-02-06 00:19:48.481829524 +0100
+--- maradns-1.4.05.orig/dns/Makefile	2005-12-20 11:10:40.000000000 +0100
++++ maradns-1.4.05/dns/Makefile	2011-01-21 16:48:06.144914132 +0100
 @@ -3,7 +3,7 @@ JOBJS=../libs/JsStr.o ../libs/JsStrOS.o 
  MHOBJS=../libs/MaraHash.o
  OBJECTS=$(DOBJECTS) $(JOBJS) $(MHOBJS)
@@ -9,3 +9,22 @@
  #FLAGS = -g $(DEBUG)
  
  all: Queries.o Compress.o bobbit.o Decompress.o
+@@ -12,14 +12,14 @@ clean:
+ 	rm -f Queries.o Compress.o bobbit.o Decompress.o
+ 
+ Queries.o: Queries.c ../libs/JsStr.h ../libs/MaraHash.h ../MaraDns.h
+-	$(CC) -c $(FLAGS) -o Queries.o Queries.c 
++	$(CC) -c $(CFLAGS) -o Queries.o Queries.c 
+ 
+ Compress.o: Compress.c ../libs/JsStr.h ../libs/MaraHash.h ../MaraDns.h
+-	$(CC) -c $(FLAGS) -o Compress.o Compress.c 
++	$(CC) -c $(CFLAGS) -o Compress.o Compress.c 
+ 
+ Decompress.o: Decompress.c ../libs/JsStr.h ../libs/MaraHash.h ../MaraDns.h
+-	$(CC) -c $(FLAGS) -o Decompress.o Decompress.c 
++	$(CC) -c $(CFLAGS) -o Decompress.o Decompress.c 
+ 
+ bobbit.o: bobbit.c ../libs/JsStr.h ../libs/MaraHash.h ../MaraDns.h
+-	$(CC) -c $(FLAGS) -o bobbit.o bobbit.c 
++	$(CC) -c $(CFLAGS) -o bobbit.o bobbit.c 
+ 

+ 21 - 0
package/maradns/patches/patch-dns_Makefile_recursive

@@ -0,0 +1,21 @@
+--- maradns-1.4.05.orig/dns/Makefile.recursive	2006-01-02 17:59:33.000000000 +0100
++++ maradns-1.4.05/dns/Makefile.recursive	2011-01-21 16:47:09.678658422 +0100
+@@ -12,14 +12,14 @@ clean:
+ 	rm -f Queries.o Compress.o bobbit.o Decompress.o
+ 
+ Queries.o: Queries.c ../libs/JsStr.h ../libs/MaraHash.h ../MaraDns.h
+-	$(CC) -c $(FLAGS) -o Queries.o Queries.c 
++	$(CC) -c $(CFLAGS) -o Queries.o Queries.c 
+ 
+ Compress.o: Compress.c ../libs/JsStr.h ../libs/MaraHash.h ../MaraDns.h
+-	$(CC) -c $(FLAGS) -o Compress.o Compress.c 
++	$(CC) -c $(CFLAGS) -o Compress.o Compress.c 
+ 
+ Decompress.o: Decompress.c ../libs/JsStr.h ../libs/MaraHash.h ../MaraDns.h
+-	$(CC) -c $(FLAGS) -o Decompress.o Decompress.c 
++	$(CC) -c $(CFLAGS) -o Decompress.o Decompress.c 
+ 
+ bobbit.o: bobbit.c ../libs/JsStr.h ../libs/MaraHash.h ../MaraDns.h
+-	$(CC) -c $(FLAGS) -o bobbit.o bobbit.c 
++	$(CC) -c $(CFLAGS) -o bobbit.o bobbit.c 
+ 

+ 31 - 0
package/maradns/patches/patch-libs_Makefile

@@ -0,0 +1,31 @@
+--- maradns-1.4.05.orig/libs/Makefile	2006-01-02 17:59:33.000000000 +0100
++++ maradns-1.4.05/libs/Makefile	2011-01-21 16:46:50.568579851 +0100
+@@ -9,22 +9,22 @@ clean:
+ 	rm -f core $(OBJECTS) tests mtest *.exe
+ 
+ MaraHash.o: JsStr.h MaraHash.c
+-	$(CC) -c $(FLAGS) -o MaraHash.o MaraHash.c 
++	$(CC) -c $(CFLAGS) -o MaraHash.o MaraHash.c 
+ 
+ JsStr.o: JsStr.h JsStr.c
+-	$(CC) -c $(FLAGS) -o JsStr.o JsStr.c 
++	$(CC) -c $(CFLAGS) -o JsStr.o JsStr.c 
+ 
+ JsStrOS.o: JsStr.h JsStrOS.c
+-	$(CC) -c $(FLAGS) -o JsStrOS.o JsStrOS.c 
++	$(CC) -c $(CFLAGS) -o JsStrOS.o JsStrOS.c 
+ 
+ JsStrCP.o: JsStr.h JsStrCP.c
+-	$(CC) -c $(FLAGS) -o JsStrCP.o JsStrCP.c 
++	$(CC) -c $(CFLAGS) -o JsStrCP.o JsStrCP.c 
+ 
+ mtest: mtest.c $(OBJECTS)
+-	$(CC) $(FLAGS) -o mtest mtest.c $(OBJECTS)
++	$(CC) $(CFLAGS) $(LDFLAGS) -o mtest mtest.c $(OBJECTS)
+ 
+ tests: tests.c $(OBJECTS)
+-	$(CC) $(FLAGS) -o tests tests.c $(OBJECTS)
++	$(CC) $(CFLAGS) $(LDFLAGS) -o tests tests.c $(OBJECTS)
+ 
+ #onetime: $(OBJECTS) kiwi.h config.h onetime.c do_scramble.o cryptdate.o
+ #	$(CC) $(FLAGS) -o onetime onetime.c do_scramble.o cryptdate.o

+ 80 - 0
package/maradns/patches/patch-parse_Makefile

@@ -0,0 +1,80 @@
+--- maradns-1.4.05.orig/parse/Makefile	2006-07-18 05:50:44.000000000 +0200
++++ maradns-1.4.05/parse/Makefile	2011-01-21 16:47:47.994913518 +0100
+@@ -8,8 +8,8 @@ DOBJECTS=../dns/Queries.o ../dns/Compres
+ OBJECTS=$(JOBJS) $(MHOBJS) $(POBJECTS) $(DOBJECTS) $(OUTOBJ)
+ EXECS=parsetest parsetest2
+ 
+-#FLAGS = -g -Wall $(DEBUG)
+-#FLAGS = -g $(DEBUG)
++#CFLAGS = -g -Wall $(DEBUG)
++#CFLAGS = -g $(DEBUG)
+ 
+ all: $(POBJECTS) $(OUTOBJ)
+ 
+@@ -20,50 +20,50 @@ clean:
+ 	cd libs ; make
+ 
+ ParseMaraRc.o: ParseMaraRc.c ../libs/JsStr.h ../libs/MaraHash.h ../MaraDns.h ParseMaraRc_en.h
+-	$(CC) -c $(FLAGS) -o ParseMaraRc.o ParseMaraRc.c 
++	$(CC) -c $(CFLAGS) -o ParseMaraRc.o ParseMaraRc.c 
+ 
+ ParseCsv1.o: ParseCsv1.c ../libs/JsStr.h ../libs/MaraHash.h ../MaraDns.h
+-	$(CC) -c $(FLAGS) -o ParseCsv1.o ParseCsv1.c 
++	$(CC) -c $(CFLAGS) -o ParseCsv1.o ParseCsv1.c 
+ 
+ ParseIpAcl.o: ParseIpAcl.c ../libs/JsStr.h ../libs/MaraHash.h ../MaraDns.h
+-	$(CC) -c $(FLAGS) -o ParseIpAcl.o ParseIpAcl.c
++	$(CC) -c $(CFLAGS) -o ParseIpAcl.o ParseIpAcl.c
+ 
+ Parse_ipv6.o: Parse_ipv6.c ../libs/MaraHash.h
+-	$(CC) -c $(FLAGS) -o Parse_ipv6.o Parse_ipv6.c
++	$(CC) -c $(CFLAGS) -o Parse_ipv6.o Parse_ipv6.c
+ 
+ Csv2_esc_txt.o: Csv2_esc_txt.c ../libs/JsStr.h
+-	$(CC) -c $(FLAGS) -o Csv2_esc_txt.o Csv2_esc_txt.c
++	$(CC) -c $(CFLAGS) -o Csv2_esc_txt.o Csv2_esc_txt.c
+ 
+ Csv2_main.o: Csv2_main.c ../libs/JsStr.h Csv2_read.h
+-	$(CC) -c $(FLAGS) -o Csv2_main.o Csv2_main.c
++	$(CC) -c $(CFLAGS) -o Csv2_main.o Csv2_main.c
+ 
+ Csv2_read.o: Csv2_read.c ../libs/JsStr.h Csv2_read.h
+-	$(CC) -c $(FLAGS) -o Csv2_read.o Csv2_read.c
++	$(CC) -c $(CFLAGS) -o Csv2_read.o Csv2_read.c
+ 
+ Csv2_parse.o: Csv2_parse.c ../libs/JsStr.h Csv2_read.h
+-	$(CC) -c $(FLAGS) -o Csv2_parse.o Csv2_parse.c
++	$(CC) -c $(CFLAGS) -o Csv2_parse.o Csv2_parse.c
+ 
+ Csv2_rr_aaaa.o: Csv2_rr_aaaa.c ../libs/JsStr.h Csv2_read.h
+-	$(CC) -c $(FLAGS) -o Csv2_rr_aaaa.o Csv2_rr_aaaa.c
++	$(CC) -c $(CFLAGS) -o Csv2_rr_aaaa.o Csv2_rr_aaaa.c
+ 
+ Csv2_rr_wks.o: Csv2_rr_wks.c ../libs/JsStr.h Csv2_read.h
+-	$(CC) -c $(FLAGS) -o Csv2_rr_wks.o Csv2_rr_wks.c
++	$(CC) -c $(CFLAGS) -o Csv2_rr_wks.o Csv2_rr_wks.c
+ 
+ Csv2_rr_a.o: Csv2_rr_a.c ../libs/JsStr.h Csv2_read.h
+-	$(CC) -c $(FLAGS) -o Csv2_rr_a.o Csv2_rr_a.c
++	$(CC) -c $(CFLAGS) -o Csv2_rr_a.o Csv2_rr_a.c
+ 
+ Csv2_rr_soa.o: Csv2_rr_soa.c ../libs/JsStr.h Csv2_read.h
+-	$(CC) -c $(FLAGS) -o Csv2_rr_soa.o Csv2_rr_soa.c
++	$(CC) -c $(CFLAGS) -o Csv2_rr_soa.o Csv2_rr_soa.c
+ 
+ Csv2_rr_txt.o: Csv2_rr_txt.c ../libs/JsStr.h Csv2_read.h
+-	$(CC) -c $(FLAGS) -o Csv2_rr_txt.o Csv2_rr_txt.c
++	$(CC) -c $(CFLAGS) -o Csv2_rr_txt.o Csv2_rr_txt.c
+ 
+ Csv2_database.o: Csv2_database.c ../libs/JsStr.h Csv2_read.h
+-	$(CC) -c $(FLAGS) -o Csv2_database.o Csv2_database.c
++	$(CC) -c $(CFLAGS) -o Csv2_database.o Csv2_database.c
+ 
+ parsetest: parsetest.c $(OBJECTS) 
+-	$(CC) $(FLAGS) -o parsetest parsetest.c $(OBJECTS) 
++	$(CC) $(CFLAGS) -o parsetest parsetest.c $(OBJECTS) 
+ 
+ parsetest2: parsetest2.c $(OBJECTS) 
+-	$(CC) $(FLAGS) -o parsetest2 parsetest2.c $(OBJECTS) 
++	$(CC) $(CFLAGS) -o parsetest2 parsetest2.c $(OBJECTS) 
+ 

+ 9 - 0
package/maradns/patches/patch-qual_Makefile_threadsafe

@@ -0,0 +1,9 @@
+--- maradns-1.4.05.orig/qual/Makefile.threadsafe	2006-01-22 06:22:01.000000000 +0100
++++ maradns-1.4.05/qual/Makefile.threadsafe	2011-01-21 16:48:40.348658539 +0100
+@@ -8,5 +8,5 @@ clean:
+ 	rm -f qual_timestamp.o
+ 
+ qual_timestamp.o: qual_timestamp.c ../libs/JsStr.h ../libs/MaraHash.h ../MaraDns.h
+-	$(CC) -c $(FLAGS) -o qual_timestamp.o qual_timestamp.c 
++	$(CC) -c $(CFLAGS) -o qual_timestamp.o qual_timestamp.c 
+ 

+ 2 - 2
package/maradns/patches/patch-rng_rng-32bit-tables_h

@@ -1,5 +1,5 @@
---- maradns-1.4.03.orig/rng/rng-32bit-tables.h	2010-02-02 18:12:47.000000000 +0100
-+++ maradns-1.4.03/rng/rng-32bit-tables.h	2010-02-06 00:19:49.965584207 +0100
+--- maradns-1.4.05.orig/rng/rng-32bit-tables.h	2010-09-25 16:14:04.000000000 +0200
++++ maradns-1.4.05/rng/rng-32bit-tables.h	2011-01-21 16:25:33.324914221 +0100
 @@ -1,332 +1,332 @@
  /* This file is automatically generated by the program make_32bit_tables.c */
  

+ 32 - 8
package/maradns/patches/patch-server_Makefile

@@ -1,5 +1,5 @@
---- maradns-1.4.03.orig/server/Makefile	2006-01-02 17:59:33.000000000 +0100
-+++ maradns-1.4.03/server/Makefile	2010-02-06 00:19:48.471836901 +0100
+--- maradns-1.4.05.orig/server/Makefile	2006-01-02 17:59:33.000000000 +0100
++++ maradns-1.4.05/server/Makefile	2011-01-21 16:45:45.307408698 +0100
 @@ -1,11 +1,13 @@
 -SOBJECTS=MaraBigHash.o recursive.o timestamp.o read_kvars.o MaraAnyChain.o
 +SOBJECTS=MaraBigHash.o recursive.o timestamp.o read_kvars.o MaraAnyChain.o \
@@ -16,13 +16,37 @@
  POBJECTS=../parse/ParseMaraRc.o ../parse/ParseCsv1.o $(POBJ4) $(POBJ5)
  DOBJECTS=../dns/Queries.o ../dns/Compress.o ../dns/bobbit.o ../dns/Decompress.o
  ROBJECTS=../rng/rng-api-fst.o ../rng/rng-alg-fst.o
-@@ -46,6 +48,9 @@ timestamp.o: timestamp.c MaraDNS_locale.
- MaraAnyChain.o: MaraAnyChain.c
- 	$(CC) -c $(FLAGS) -o MaraAnyChain.o MaraAnyChain.c
+@@ -32,23 +34,26 @@ libs/tests:
+ 	cd libs ; make
  
-+udpsuccess.o: udpsuccess.c
-+	$(CC) -c $(FLAGS) -o udpsuccess.o udpsuccess.c
+ read_kvars.o: read_kvars.c ../libs/JsStr.h ../libs/MaraHash.h ../MaraDns.h
+-	$(CC) -c $(FLAGS) -o read_kvars.o read_kvars.c
++	$(CC) -c $(CPPFLAGS) $(CFLAGS) -o read_kvars.o read_kvars.c
+ 
+ MaraBigHash.o: MaraBigHash.c ../libs/JsStr.h ../libs/MaraHash.h ../MaraDns.h MaraBigHash_locale.h
+-	$(CC) -c $(FLAGS) -o MaraBigHash.o MaraBigHash.c 
++	$(CC) -c $(CPPFLAGS) $(CFLAGS) -o MaraBigHash.o MaraBigHash.c 
+ 
+ recursive.o: recursive.c ../libs/JsStr.h ../libs/MaraHash.h ../MaraDns.h
+-	$(CC) -c $(FLAGS) -o recursive.o recursive.c 
++	$(CC) -c $(CPPFLAGS) $(CFLAGS) -o recursive.o recursive.c 
+ 
+ timestamp.o: timestamp.c MaraDNS_locale.h
+-	$(CC) -c $(FLAGS) -o timestamp.o timestamp.c
++	$(CC) -c $(CPPFLAGS) $(CFLAGS) -o timestamp.o timestamp.c
+ 
+ MaraAnyChain.o: MaraAnyChain.c
+-	$(CC) -c $(FLAGS) -o MaraAnyChain.o MaraAnyChain.c
++	$(CC) -c $(CPPFLAGS) $(CFLAGS) -o MaraAnyChain.o MaraAnyChain.c
 +
++udpsuccess.o: udpsuccess.c
++	$(CC) -c $(CPPFLAGS) $(CFLAGS) -o udpsuccess.o udpsuccess.c
+ 
  maradns: MaraDNS.c $(OBJECTS) MaraDNS_locale.h
- 	$(CC) $(FLAGS) -DVERSION=\"$(VERSION)\" -DCOMPILED=\"$(COMPILED)\" -o maradns MaraDNS.c $(OBJECTS) -lpthread
+-	$(CC) $(FLAGS) -DVERSION=\"$(VERSION)\" -DCOMPILED=\"$(COMPILED)\" -o maradns MaraDNS.c $(OBJECTS) -lpthread
++	$(CC) $(CFLAGS) $(LDFLAGS) -DVERSION=\"$(VERSION)\" -DCOMPILED=\"$(COMPILED)\" -o maradns MaraDNS.c $(OBJECTS) -lpthread
+ 
+ simple: simple.c $(XOBJECTS) MaraDNS_locale.h
+-	$(CC) $(FLAGS) -DVERSION=\"$(VERSION)\" -DCOMPILED=\"$(COMPILED)\" -o simple $(OBJECTS) simple.c 
++	$(CC) $(CFLAGS) $(LDFLAGS) -DVERSION=\"$(VERSION)\" -DCOMPILED=\"$(COMPILED)\" -o simple $(OBJECTS) simple.c 
  

+ 37 - 0
package/maradns/patches/patch-server_Makefile_recursive

@@ -0,0 +1,37 @@
+--- maradns-1.4.05.orig/server/Makefile.recursive	2007-08-16 15:35:43.000000000 +0200
++++ maradns-1.4.05/server/Makefile.recursive	2011-01-21 16:45:30.748658697 +0100
+@@ -34,26 +34,26 @@ libs/tests:
+ 	cd libs ; make
+ 
+ read_kvars.o: read_kvars.c ../libs/JsStr.h ../libs/MaraHash.h ../MaraDns.h
+-	$(CC) -c $(FLAGS) -o read_kvars.o read_kvars.c
++	$(CC) -c $(CPPFLAGS) $(CFLAGS) -o read_kvars.o read_kvars.c
+ 
+ MaraBigHash.o: MaraBigHash.c ../libs/JsStr.h ../libs/MaraHash.h ../MaraDns.h MaraBigHash_locale.h
+-	$(CC) -c $(FLAGS) -o MaraBigHash.o MaraBigHash.c 
++	$(CC) -c $(CPPFLAGS) $(CFLAGS) -o MaraBigHash.o MaraBigHash.c 
+ 
+ recursive.o: recursive.c ../libs/JsStr.h ../libs/MaraHash.h ../MaraDns.h
+-	$(CC) -c $(FLAGS) -o recursive.o recursive.c 
++	$(CC) -c $(CPPFLAGS) $(CFLAGS) -o recursive.o recursive.c 
+ 
+ timestamp.o: timestamp.c MaraDNS_locale.h
+-	$(CC) -c $(FLAGS) -o timestamp.o timestamp.c
++	$(CC) -c $(CPPFLAGS) $(CFLAGS) -o timestamp.o timestamp.c
+ 
+ MaraAnyChain.o: MaraAnyChain.c
+-	$(CC) -c $(FLAGS) -o MaraAnyChain.o MaraAnyChain.c
++	$(CC) -c $(CPPFLAGS) $(CFLAGS) -o MaraAnyChain.o MaraAnyChain.c
+ 
+ udpsuccess.o: udpsuccess.c
+-	$(CC) -c $(FLAGS) -o udpsuccess.o udpsuccess.c
++	$(CC) -c $(CPPFLAGS) $(CFLAGS) -o udpsuccess.o udpsuccess.c
+ 
+ maradns: MaraDNS.c $(OBJECTS) MaraDNS_locale.h
+-	$(CC) $(FLAGS) -DVERSION=\"$(VERSION)\" -DCOMPILED=\"$(COMPILED)\" -o maradns MaraDNS.c $(OBJECTS) -lpthread
++	$(CC) $(CFLAGS) $(LDFLAGS) -DVERSION=\"$(VERSION)\" -DCOMPILED=\"$(COMPILED)\" -o maradns MaraDNS.c $(OBJECTS) -lpthread
+ 
+ simple: simple.c $(XOBJECTS) MaraDNS_locale.h
+-	$(CC) $(FLAGS) -DVERSION=\"$(VERSION)\" -DCOMPILED=\"$(COMPILED)\" -o simple $(OBJECTS) simple.c 
++	$(CC) $(CFLAGS) $(LDFLAGS) -DVERSION=\"$(VERSION)\" -DCOMPILED=\"$(COMPILED)\" -o simple $(OBJECTS) simple.c 
+ 

+ 17 - 2
package/maradns/patches/patch-tcp_Makefile

@@ -1,5 +1,5 @@
---- maradns-1.4.03.orig/tcp/Makefile	2005-12-20 11:10:40.000000000 +0100
-+++ maradns-1.4.03/tcp/Makefile	2010-02-06 00:19:48.481829524 +0100
+--- maradns-1.4.05.orig/tcp/Makefile	2005-12-20 11:10:40.000000000 +0100
++++ maradns-1.4.05/tcp/Makefile	2011-01-21 16:41:10.254914344 +0100
 @@ -2,10 +2,11 @@ JOBJS=../libs/JsStr.o ../libs/JsStrOS.o 
  MJOBJS=../qual/qual_timestamp.o
  MHOBJS=../libs/MaraHash.o
@@ -22,3 +22,18 @@
  #FLAGS = -g $(DEBUG)
  
  all: $(EXECS)
+@@ -25,11 +26,11 @@ clean:
+ 	rm -f core $(EXECS) $(TCPOBJS) *.exe
+ 
+ getzone: getzone.c $(OBJECTS) 
+-	$(CC) $(FLAGS) -o getzone getzone.c $(OBJECTS)
++	$(CC) $(CFLAGS) $(LDFLAGS) -o getzone getzone.c $(OBJECTS)
+ 
+ fetchzone: fetchzone.c $(OBJECTS) 
+-	$(CC) $(FLAGS) -o fetchzone fetchzone.c $(OBJECTS) 
++	$(CC) $(CFLAGS) $(LDFLAGS) -o fetchzone fetchzone.c $(OBJECTS) 
+ 
+ zoneserver: zoneserver.c zoneserver_en.h $(OBJECTS)
+-	$(CC) $(FLAGS) -DVERSION=\"$(VERSION)\" -o zoneserver zoneserver.c $(OBJECTS) $(RNGOBJS)
++	$(CC) $(CFLAGS) $(LDFLAGS) -DVERSION=\"$(VERSION)\" -o zoneserver zoneserver.c $(OBJECTS) $(RNGOBJS)
+ 

+ 17 - 0
package/maradns/patches/patch-tcp_Makefile_recursive

@@ -0,0 +1,17 @@
+--- maradns-1.4.05.orig/tcp/Makefile.recursive	2006-07-18 05:50:44.000000000 +0200
++++ maradns-1.4.05/tcp/Makefile.recursive	2011-01-21 16:40:56.008658167 +0100
+@@ -26,11 +26,11 @@ clean:
+ 	rm -f core $(EXECS) $(TCPOBJS) *.exe
+ 
+ getzone: getzone.c $(OBJECTS) 
+-	$(CC) $(FLAGS) -o getzone getzone.c $(OBJECTS)
++	$(CC) $(CFLAGS) $(LDFLAGS) -o getzone getzone.c $(OBJECTS)
+ 
+ fetchzone: fetchzone.c $(OBJECTS) 
+-	$(CC) $(FLAGS) -o fetchzone fetchzone.c $(OBJECTS) 
++	$(CC) $(CFLAGS) $(LDFLAGS) -o fetchzone fetchzone.c $(OBJECTS) 
+ 
+ zoneserver: zoneserver.c zoneserver_en.h $(OBJECTS)
+-	$(CC) $(FLAGS) -DVERSION=\"$(VERSION)\" -o zoneserver zoneserver.c $(OBJECTS) $(RNGOBJS)
++	$(CC) $(CFLAGS) $(LDFLAGS) -DVERSION=\"$(VERSION)\" -o zoneserver zoneserver.c $(OBJECTS) $(RNGOBJS)
+ 

+ 25 - 0
package/maradns/patches/patch-tools_Makefile_recursive

@@ -0,0 +1,25 @@
+--- maradns-1.4.05.orig/tools/Makefile.recursive	2006-01-02 17:59:33.000000000 +0100
++++ maradns-1.4.05/tools/Makefile.recursive	2011-01-21 16:42:58.874910569 +0100
+@@ -18,17 +18,17 @@ clean:
+ 	rm -f core $(EXECS) *.exe
+ 
+ askmara: askmara.c askmara_labels_en.h $(OBJECTS) $(Q) $(OUTOBJ)
+-	$(CC) $(FLAGS) -o askmara askmara.c $(OBJECTS) $(Q) $(OUTOBJ)
++	$(CC) $(CFLAGS) $(LDFLAGS) -o askmara askmara.c $(OBJECTS) $(Q) $(OUTOBJ)
+ 
+ askmara-tcp: askmara-tcp.c askmara_labels_en.h $(OBJECTS) $(ROBJECTS) $(POBJECTS)
+-	$(CC) $(FLAGS) -o askmara-tcp askmara-tcp.c $(OBJECTS) $(ROBJECTS) $(POBJECTS)
++	$(CC) $(CFLAGS) $(LDFLAGS) -o askmara-tcp askmara-tcp.c $(OBJECTS) $(ROBJECTS) $(POBJECTS)
+ 
+ benchmark: benchmark.c askmara_labels_en.h $(OBJECTS) $(POBJECTS)
+-	$(CC) $(FLAGS) -o benchmark benchmark.c $(OBJECTS) $(POBJECTS)
++	$(CC) $(CFLAGS) $(LDFLAGS) -o benchmark benchmark.c $(OBJECTS) $(POBJECTS)
+ 
+ duende: duende.c 
+-	$(CC) $(FLAGS) -o duende duende.c
++	$(CC) $(CFLAGS) $(LDFLAGS) -o duende duende.c
+ 
+ strip.control: strip.control.c
+-	$(CC) $(FLAGS) -o strip.control strip.control.c
++	$(CC) $(CFLAGS) $(LDFLAGS) -o strip.control strip.control.c
+ 

+ 20 - 2
package/mgetty/patches/patch-Makefile

@@ -1,5 +1,23 @@
 --- mgetty-1.1.36.orig/Makefile	2007-06-15 13:15:56.000000000 +0200
-+++ mgetty-1.1.36/Makefile	2009-08-28 15:17:14.235450692 +0200
++++ mgetty-1.1.36/Makefile	2011-01-21 17:07:06.158658312 +0100
+@@ -4,7 +4,7 @@
+ #
+ # this is the C compiler to use (on SunOS, the standard "cc" does not
+ # grok my code, so please use gcc there. On ISC 4.0, use "icc".).
+-CC=gcc
++CC?=gcc
+ #CC=cc
+ #
+ #### C Compiler Flags ####
+@@ -102,7 +102,7 @@ CC=gcc
+ #	    USTAT	  - ustat(), no statfs etc.
+ #
+ #CFLAGS=-Wall -O2 -pipe -DSECUREWARE -DUSE_POLL
+-CFLAGS=-O2 -Wall -pipe
++CFLAGS?=-O2 -Wall -pipe
+ #CFLAGS=-O -DSVR4
+ #CFLAGS=-O -DSVR4 -DSVR42
+ #CFLAGS=-O -DUSE_POLL
 @@ -164,7 +164,9 @@ LIBS=
  #
  # if your systems doesn't have one, use the shell script that I provide
@@ -27,7 +45,7 @@
 -mksed: mksed.c policy.h Makefile 
 +REALGCC:=/usr/bin/gcc
 +mksed: mksed.c policy.h Makefile
-+	( echo $(REALGCC); $(MAKE) "CC=$(REALGCC)" "CFLAGS=$(CFLAGS)" mksed-wrong;\
++	( echo $(CC_FOR_BUILD); $(MAKE) "CC=$(CC_FOR_BUILD)" "CFLAGS=$(CFLAGS_FOR_BUILD)" mksed-wrong;\
 +	);
 +
 +mksed-wrong: mksed.c policy.h Makefile 

+ 3 - 3
package/miax/Makefile

@@ -25,9 +25,9 @@ CONFIG_STYLE:=		manual
 INSTALL_STYLE:=		manual
 
 MAKE_FLAGS+=		CC="${TARGET_CC}" \
-			OFLAGS="${TCFLAGS}" \
-			CPPFLAGS="${TCPPFLAGS}" \
-			LDFLAGS="${TLDFLAGS}" \
+			OFLAGS="${TARGET_CFLAGS}" \
+			CPPFLAGS="${TARGET_CPPFLAGS}" \
+			LDFLAGS="${TARGET_LDFLAGS}"
 
 do-install:
 	${INSTALL_DIR} ${IDIR_MIAX}/usr/bin

+ 1 - 1
package/microperl/Makefile

@@ -22,7 +22,7 @@ $(eval $(call PKG_template,MICROPERL,${PKG_NAME},${PKG_VERSION}-${PKG_RELEASE},$
 CONFIG_STYLE:=		manual
 INSTALL_STYLE:=		manual
 
-MAKE_FLAGS+=		CC="${TARGET_CC}" OPTIMIZE="${TCFLAGS}"
+MAKE_FLAGS+=		CC="${TARGET_CC}" OPTIMIZE="${TARGET_CFLAGS}"
 MAKE_FILE:=		Makefile.micro
 
 pre-configure:

Some files were not shown because too many files changed in this diff