Makfile: [ GCC编译选项 ] >CFLAGS LDFLAGS LIBS

该文章展示了一个在Linux环境下进行编译时设置CFLAGS、LDFLAGS和LIBS变量的例子。使用gcc编译器,将-L和-I选项指定到包含库的目录,以及添加-lrt链接特定库。

比如:

CFLAGS=-I/usr/local/include

LDFLAGS=-L/usr/local/lib

LIBS=-lrt

test: test.o

gcc $(CFLAGS)  $(LDFLAGS) -o $@ $^ $(LIBS)

下载完后samba软件包怎么编译 openssl support zlib make[1]: Entering directory '/data/red-round3/red-round3/Iplatform/openwrt' make[2]: Entering directory '/data/red-round3/red-round3/Iplatform/openwrt' make[3]: Entering directory '/data/red-round3/red-round3/Iplatform/openwrt' make[3]: Leaving directory '/data/red-round3/red-round3/Iplatform/openwrt' make[3]: Entering directory '/data/red-round3/red-round3/Iplatform/openwrt' make[3]: Leaving directory '/data/red-round3/red-round3/Iplatform/openwrt' make[2]: Leaving directory '/data/red-round3/red-round3/Iplatform/openwrt' make[2]: Entering directory '/data/red-round3/red-round3/Iplatform/openwrt' make[3]: Entering directory '/data/red-round3/red-round3/Iplatform/openwrt/ibase/lua' WARNING: skipping lua-examples -- package not selected make[3]: Leaving directory '/data/red-round3/red-round3/Iplatform/openwrt/ibase/lua' make[3]: Entering directory '/data/red-round3/red-round3/Iplatform/openwrt/package/gettext' WARNING: skipping libintl -- package not selected make[3]: Leaving directory '/data/red-round3/red-round3/Iplatform/openwrt/package/gettext' make[3]: Entering directory '/data/red-round3/red-round3/Iplatform/openwrt/package/libiconv' WARNING: skipping libiconv -- package not selected make[3]: Leaving directory '/data/red-round3/red-round3/Iplatform/openwrt/package/libiconv' make[3]: Entering directory '/data/red-round3/red-round3/Iplatform/openwrt/package/libtool' WARNING: skipping libltdl -- package not selected make[3]: Leaving directory '/data/red-round3/red-round3/Iplatform/openwrt/package/libtool' make[3]: Entering directory '/data/red-round3/red-round3/Iplatform/packages/opensource/libjson-c' make[3]: Leaving directory '/data/red-round3/red-round3/Iplatform/packages/opensource/libjson-c' make[3]: Entering directory '/data/red-round3/red-round3/Iplatform/openwrt/ibase/libubox' make[3]: Leaving directory '/data/red-round3/red-round3/Iplatform/openwrt/ibase/libubox' make[3]: Entering directory '/data/red-round3/red-round3/Iplatform/openwrt/ibase/ubus' make[3]: Leaving directory '/data/red-round3/red-round3/Iplatform/openwrt/ibase/ubus' make[3]: Entering directory '/data/red-round3/red-round3/Iplatform/packages/private/usb_sync' make[3]: Leaving directory '/data/red-round3/red-round3/Iplatform/packages/private/usb_sync' make[3]: Entering directory '/data/red-round3/red-round3/Iplatform/openwrt/package/ncurses' make[3]: Leaving directory '/data/red-round3/red-round3/Iplatform/openwrt/package/ncurses' make[3]: Entering directory '/data/red-round3/red-round3/Iplatform/openwrt/package/ncurses' WARNING: skipping libncurses-dev -- package not selected make[3]: Leaving directory '/data/red-round3/red-round3/Iplatform/openwrt/package/ncurses' make[3]: Entering directory '/data/red-round3/red-round3/Iplatform/openwrt/package/ncurses' WARNING: skipping libncurses-dev -- package not selected make[3]: Leaving directory '/data/red-round3/red-round3/Iplatform/openwrt/package/ncurses' make[3]: Entering directory '/data/red-round3/red-round3/Iplatform/packages/opensource/util-linux' make[3]: Leaving directory '/data/red-round3/red-round3/Iplatform/packages/opensource/util-linux' make[3]: Entering directory '/data/red-round3/red-round3/Iplatform/openwrt/package/libreadline' WARNING: skipping libreadline -- package not selected make[3]: Leaving directory '/data/red-round3/red-round3/Iplatform/openwrt/package/libreadline' make[3]: Entering directory '/data/red-round3/red-round3/Iplatform/packages/opensource/samba' make[3]: Leaving directory '/data/red-round3/red-round3/Iplatform/packages/opensource/samba' make[2]: Leaving directory '/data/red-round3/red-round3/Iplatform/openwrt' make[1]: Leaving directory '/data/red-round3/red-round3/Iplatform/openwrt' zhihonghe@14b254839176:/data/red-round3/red-round3/Iplatform/build$ make PRODUCT_NAME=be220v1 iplatform_package/samba/clean V=s openssl support zlib make[1]: Entering directory '/data/red-round3/red-round3/Iplatform/openwrt' make[2]: Entering directory '/data/red-round3/red-round3/Iplatform/openwrt' make[3]: Entering directory '/data/red-round3/red-round3/Iplatform/openwrt' make[3]: Leaving directory '/data/red-round3/red-round3/Iplatform/openwrt' make[3]: Entering directory '/data/red-round3/red-round3/Iplatform/openwrt' make[3]: Leaving directory '/data/red-round3/red-round3/Iplatform/openwrt' make[2]: Leaving directory '/data/red-round3/red-round3/Iplatform/openwrt' make[2]: Entering directory '/data/red-round3/red-round3/Iplatform/openwrt' make[3]: Entering directory '/data/red-round3/red-round3/Iplatform/packages/opensource/samba' rm -f /data/red-round3/red-round3/Iplatform/openwrt/staging_dir/target-arm-openwrt-linux-uclibc-be220v1/stamp/.samba_installed rm -f /data/red-round3/red-round3/Iplatform/openwrt/bin/model_brcm_bcm490x-be220v1/packages/samba36-libs_* rm -f /data/red-round3/red-round3/Iplatform/openwrt/bin/model_brcm_bcm490x-be220v1/packages/samba36-server_* rm -f /data/red-round3/red-round3/Iplatform/openwrt/bin/model_brcm_bcm490x-be220v1/packages/samba36-client_* rm -f /data/red-round3/red-round3/Iplatform/openwrt/staging_dir/target-arm-openwrt-linux-uclibc-be220v1/packages/samba.list /data/red-round3/red-round3/Iplatform/openwrt/staging_dir/host/packages/samba.list rm -rf /data/red-round3/red-round3/Iplatform/openwrt/build_dir/target-arm-openwrt-linux-uclibc-be220v1/samba-3.6.25 make[3]: Leaving directory '/data/red-round3/red-round3/Iplatform/packages/opensource/samba' make[2]: Leaving directory '/data/red-round3/red-round3/Iplatform/openwrt' make[1]: Leaving directory '/data/red-round3/red-round3/Iplatform/openwrt' zhihonghe@14b254839176:/data/red-round3/red-round3/Iplatform/build$ make PRODUCT_NAME=be220v1 iplatform_package/samba/compile V=s openssl support zlib make[1]: Entering directory '/data/red-round3/red-round3/Iplatform/openwrt' make[2]: Entering directory '/data/red-round3/red-round3/Iplatform/openwrt' make[3]: Entering directory '/data/red-round3/red-round3/Iplatform/openwrt' make[3]: Leaving directory '/data/red-round3/red-round3/Iplatform/openwrt' make[3]: Entering directory '/data/red-round3/red-round3/Iplatform/openwrt' make[3]: Leaving directory '/data/red-round3/red-round3/Iplatform/openwrt' make[2]: Leaving directory '/data/red-round3/red-round3/Iplatform/openwrt' make[2]: Entering directory '/data/red-round3/red-round3/Iplatform/openwrt' make[3]: Entering directory '/data/red-round3/red-round3/Iplatform/openwrt/ibase/lua' WARNING: skipping lua-examples -- package not selected make[3]: Leaving directory '/data/red-round3/red-round3/Iplatform/openwrt/ibase/lua' make[3]: Entering directory '/data/red-round3/red-round3/Iplatform/openwrt/package/gettext' WARNING: skipping libintl -- package not selected make[3]: Leaving directory '/data/red-round3/red-round3/Iplatform/openwrt/package/gettext' make[3]: Entering directory '/data/red-round3/red-round3/Iplatform/openwrt/package/libiconv' WARNING: skipping libiconv -- package not selected make[3]: Leaving directory '/data/red-round3/red-round3/Iplatform/openwrt/package/libiconv' make[3]: Entering directory '/data/red-round3/red-round3/Iplatform/openwrt/package/libtool' WARNING: skipping libltdl -- package not selected make[3]: Leaving directory '/data/red-round3/red-round3/Iplatform/openwrt/package/libtool' make[3]: Entering directory '/data/red-round3/red-round3/Iplatform/packages/opensource/libjson-c' make[3]: Leaving directory '/data/red-round3/red-round3/Iplatform/packages/opensource/libjson-c' make[3]: Entering directory '/data/red-round3/red-round3/Iplatform/openwrt/ibase/libubox' make[3]: Leaving directory '/data/red-round3/red-round3/Iplatform/openwrt/ibase/libubox' make[3]: Entering directory '/data/red-round3/red-round3/Iplatform/openwrt/ibase/ubus' make[3]: Leaving directory '/data/red-round3/red-round3/Iplatform/openwrt/ibase/ubus' make[3]: Entering directory '/data/red-round3/red-round3/Iplatform/packages/private/usb_sync' make[3]: Leaving directory '/data/red-round3/red-round3/Iplatform/packages/private/usb_sync' make[3]: Entering directory '/data/red-round3/red-round3/Iplatform/openwrt/package/ncurses' make[3]: Leaving directory '/data/red-round3/red-round3/Iplatform/openwrt/package/ncurses' make[3]: Entering directory '/data/red-round3/red-round3/Iplatform/openwrt/package/ncurses' WARNING: skipping libncurses-dev -- package not selected make[3]: Leaving directory '/data/red-round3/red-round3/Iplatform/openwrt/package/ncurses' make[3]: Entering directory '/data/red-round3/red-round3/Iplatform/openwrt/package/ncurses' WARNING: skipping libncurses-dev -- package not selected make[3]: Leaving directory '/data/red-round3/red-round3/Iplatform/openwrt/package/ncurses' make[3]: Entering directory '/data/red-round3/red-round3/Iplatform/packages/opensource/util-linux' make[3]: Leaving directory '/data/red-round3/red-round3/Iplatform/packages/opensource/util-linux' make[3]: Entering directory '/data/red-round3/red-round3/Iplatform/openwrt/package/libreadline' WARNING: skipping libreadline -- package not selected make[3]: Leaving directory '/data/red-round3/red-round3/Iplatform/openwrt/package/libreadline' make[3]: Entering directory '/data/red-round3/red-round3/Iplatform/packages/opensource/samba' mkdir -p /data/red-round3/red-round3/Iplatform/openwrt/build_dir/target-arm-openwrt-linux-uclibc-be220v1/samba-3.6.25 cp -fpR ./src/* /data/red-round3/red-round3/Iplatform/openwrt/build_dir/target-arm-openwrt-linux-uclibc-be220v1/samba-3.6.25 touch /data/red-round3/red-round3/Iplatform/openwrt/build_dir/target-arm-openwrt-linux-uclibc-be220v1/samba-3.6.25/.prepared_b01c3156afc1b74183de4ac69cbb7e54 (cd /data/red-round3/red-round3/Iplatform/openwrt/build_dir/target-arm-openwrt-linux-uclibc-be220v1/samba-3.6.25/source3/; if [ -x ./configure ]; then /usr/bin/find /data/red-round3/red-round3/Iplatform/openwrt/build_dir/target-arm-openwrt-linux-uclibc-be220v1/samba-3.6.25/ -name config.guess | xargs -r chmod u+w; /usr/bin/find /data/red-round3/red-round3/Iplatform/openwrt/build_dir/target-arm-openwrt-linux-uclibc-be220v1/samba-3.6.25/ -name config.guess | xargs -r -n1 cp /data/red-round3/red-round3/Iplatform/openwrt/scripts/config.guess; /usr/bin/find /data/red-round3/red-round3/Iplatform/openwrt/build_dir/target-arm-openwrt-linux-uclibc-be220v1/samba-3.6.25/ -name config.sub | xargs -r chmod u+w; /usr/bin/find /data/red-round3/red-round3/Iplatform/openwrt/build_dir/target-arm-openwrt-linux-uclibc-be220v1/samba-3.6.25/ -name config.sub | xargs -r -n1 cp /data/red-round3/red-round3/Iplatform/openwrt/scripts/config.sub; AR=arm-buildroot-linux-gnueabi-ar AS="arm-buildroot-linux-gnueabi-gcc -c -DMAX_DEBUG_LEVEL=-1 -D__location__=\\\"\\\" -ffunction-sections -fdata-sections" LD=arm-buildroot-linux-gnueabi-ld NM=arm-buildroot-linux-gnueabi-nm CC="arm-buildroot-linux-gnueabi-gcc" GCC="arm-buildroot-linux-gnueabi-gcc" CXX="arm-buildroot-linux-gnueabi-g++" RANLIB=arm-buildroot-linux-gnueabi-ranlib STRIP=arm-buildroot-linux-gnueabi-strip OBJCOPY=arm-buildroot-linux-gnueabi-objcopy OBJDUMP=arm-buildroot-linux-gnueabi-objdump SIZE=arm-buildroot-linux-gnueabi-size CFLAGS=" -DMAX_DEBUG_LEVEL=-1 -D__location__=\\\"\\\" -ffunction-sections -fdata-sections " CXXFLAGS=" -DMAX_DEBUG_LEVEL=-1 -D__location__=\\\"\\\" -ffunction-sections -fdata-sections " CPPFLAGS="-I/data/red-round3/red-round3/Iplatform/openwrt/staging_dir/target-arm-openwrt-linux-uclibc-be220v1/usr/include -I/data/red-round3/red-round3/Iplatform/openwrt/staging_dir/target-arm-openwrt-linux-uclibc-be220v1/include -I/data/red-round3/red-round3/Iplatform/openwrt/staging_dir/usr-be220v1/include -I/data/red-round3/red-round3/Iplatform/openwrt/../../bcm504L04/toolchain/opt/toolchains/crosstools-arm_softfp-gcc-10.3-linux-4.19-glibc-2.32-binutils-2.36.1/usr/include " LDFLAGS="-L/data/red-round3/red-round3/Iplatform/openwrt/staging_dir/target-arm-openwrt-linux-uclibc-be220v1/usr/lib -L/data/red-round3/red-round3/Iplatform/openwrt/staging_dir/target-arm-openwrt-linux-uclibc-be220v1/lib -Wl,-rpath-link,/data/red-round3/red-round3/Iplatform/openwrt/staging_dir/target-arm-openwrt-linux-uclibc-be220v1/usr/lib -L/data/red-round3/red-round3/Iplatform/openwrt/../../bcm504L04/toolchain/opt/toolchains/crosstools-arm_softfp-gcc-10.3-linux-4.19-glibc-2.32-binutils-2.36.1/usr/lib -L/data/red-round3/red-round3/Iplatform/openwrt/../../bcm504L04/toolchain/opt/toolchains/crosstools-arm_softfp-gcc-10.3-linux-4.19-glibc-2.32-binutils-2.36.1/lib -Wl,--gc-sections -lubox -lubus -lifaddrs " ac_cv_lib_attr_getxattr=no ac_cv_search_getxattr=no ac_cv_file__proc_sys_kernel_core_pattern=yes libreplace_cv_HAVE_C99_VSNPRINTF=yes libreplace_cv_HAVE_IFACE_IFCONF=yes libreplace_cv_HAVE_GETADDRINFO=yes LINUX_LFS_SUPPORT=yes samba_cv_CC_NEGATIVE_ENUM_VALUES=yes samba_cv_HAVE_GETTIMEOFDAY_TZ=yes samba_cv_HAVE_IFACE_IFCONF=yes samba_cv_HAVE_KERNEL_OPLOCKS_LINUX=yes samba_cv_HAVE_SECURE_MKSTEMP=yes samba_cv_HAVE_WRFILE_KEYTAB=no samba_cv_USE_SETREUID=yes samba_cv_USE_SETRESUID=yes samba_cv_have_setreuid=yes samba_cv_have_setresuid=yes ac_cv_header_zlib_h=no samba_cv_zlib_1_2_3=no ./configure --target=arm-openwrt-linux-uclibc --host=arm-openwrt-linux-uclibc --build=x86_64-linux-gnu --program-prefix="" --program-suffix="" --prefix=/usr --exec-prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin --libexecdir=/usr/lib --sysconfdir=/etc --datadir=/usr/share --localstatedir=/var --mandir=/usr/man --infodir=/usr/info --disable-nls --exec-prefix=/usr --prefix=/ --disable-avahi --disable-cups --disable-pie --disable-relro --disable-static --disable-swat --enable-shared-libs --with-codepagedir=/etc/samba --with-configdir=/etc/samba --with-included-iniparser --with-included-popt --with-lockdir=/var/lock --with-logfilebase=/var/log --with-nmbdsocketdir=/var/nmbd --with-piddir=/var/run --with-privatedir=/etc/samba --with-sendfile-support --without-acl-support --without-cluster-support --without-ads --without-krb5 --without-ldap --without-pam --without-winbind --without-libtdb --without-libtalloc --without-libnetapi --without-libsmbsharemodes --without-libtevent --without-libaddns --with-shared-modules=pdb_tdbsam,pdb_wbc_sam,idmap_nss,nss_info_template,auth_winbind,auth_wbc,auth_domain ; fi; ) rm -f /data/red-round3/red-round3/Iplatform/openwrt/build_dir/target-arm-openwrt-linux-uclibc-be220v1/samba-3.6.25/.configured_* touch /data/red-round3/red-round3/Iplatform/openwrt/build_dir/target-arm-openwrt-linux-uclibc-be220v1/samba-3.6.25/.configured_ CFLAGS=" -DMAX_DEBUG_LEVEL=-1 -D__location__=\\\"\\\" -ffunction-sections -fdata-sections -I/data/red-round3/red-round3/Iplatform/openwrt/staging_dir/target-arm-openwrt-linux-uclibc-be220v1/usr/include -I/data/red-round3/red-round3/Iplatform/openwrt/staging_dir/target-arm-openwrt-linux-uclibc-be220v1/include -I/data/red-round3/red-round3/Iplatform/openwrt/staging_dir/usr-be220v1/include -I/data/red-round3/red-round3/Iplatform/openwrt/../../bcm504L04/toolchain/opt/toolchains/crosstools-arm_softfp-gcc-10.3-linux-4.19-glibc-2.32-binutils-2.36.1/usr/include " CXXFLAGS=" -DMAX_DEBUG_LEVEL=-1 -D__location__=\\\"\\\" -ffunction-sections -fdata-sections -I/data/red-round3/red-round3/Iplatform/openwrt/staging_dir/target-arm-openwrt-linux-uclibc-be220v1/usr/include -I/data/red-round3/red-round3/Iplatform/openwrt/staging_dir/target-arm-openwrt-linux-uclibc-be220v1/include -I/data/red-round3/red-round3/Iplatform/openwrt/staging_dir/usr-be220v1/include -I/data/red-round3/red-round3/Iplatform/openwrt/../../bcm504L04/toolchain/opt/toolchains/crosstools-arm_softfp-gcc-10.3-linux-4.19-glibc-2.32-binutils-2.36.1/usr/include " LDFLAGS="-L/data/red-round3/red-round3/Iplatform/openwrt/staging_dir/target-arm-openwrt-linux-uclibc-be220v1/usr/lib -L/data/red-round3/red-round3/Iplatform/openwrt/staging_dir/target-arm-openwrt-linux-uclibc-be220v1/lib -Wl,-rpath-link,/data/red-round3/red-round3/Iplatform/openwrt/staging_dir/target-arm-openwrt-linux-uclibc-be220v1/usr/lib -L/data/red-round3/red-round3/Iplatform/openwrt/../../bcm504L04/toolchain/opt/toolchains/crosstools-arm_softfp-gcc-10.3-linux-4.19-glibc-2.32-binutils-2.36.1/usr/lib -L/data/red-round3/red-round3/Iplatform/openwrt/../../bcm504L04/toolchain/opt/toolchains/crosstools-arm_softfp-gcc-10.3-linux-4.19-glibc-2.32-binutils-2.36.1/lib -Wl,--gc-sections -lubox -lubus -lifaddrs " make -j1 -C /data/red-round3/red-round3/Iplatform/openwrt/build_dir/target-arm-openwrt-linux-uclibc-be220v1/samba-3.6.25/source3 AR=arm-buildroot-linux-gnueabi-ar AS="arm-buildroot-linux-gnueabi-gcc -c -DMAX_DEBUG_LEVEL=-1 -D__location__=\\\"\\\" -ffunction-sections -fdata-sections" LD=arm-buildroot-linux-gnueabi-ld NM=arm-buildroot-linux-gnueabi-nm CC="arm-buildroot-linux-gnueabi-gcc" GCC="arm-buildroot-linux-gnueabi-gcc" CXX="arm-buildroot-linux-gnueabi-g++" RANLIB=arm-buildroot-linux-gnueabi-ranlib STRIP=arm-buildroot-linux-gnueabi-strip OBJCOPY=arm-buildroot-linux-gnueabi-objcopy OBJDUMP=arm-buildroot-linux-gnueabi-objdump SIZE=arm-buildroot-linux-gnueabi-size CROSS="arm-buildroot-linux-gnueabi-" ARCH="arm" DYNEXP= PICFLAG= MODULES= ; make[4]: Entering directory '/data/red-round3/red-round3/Iplatform/openwrt/build_dir/target-arm-openwrt-linux-uclibc-be220v1/samba-3.6.25/source3' make[4]: *** No targets specified and no makefile found. Stop. make[4]: Leaving directory '/data/red-round3/red-round3/Iplatform/openwrt/build_dir/target-arm-openwrt-linux-uclibc-be220v1/samba-3.6.25/source3' Makefile:221: recipe for target '/data/red-round3/red-round3/Iplatform/openwrt/build_dir/target-arm-openwrt-linux-uclibc-be220v1/samba-3.6.25/.built' failed make[3]: *** [/data/red-round3/red-round3/Iplatform/openwrt/build_dir/target-arm-openwrt-linux-uclibc-be220v1/samba-3.6.25/.built] Error 2 make[3]: Leaving directory '/data/red-round3/red-round3/Iplatform/packages/opensource/samba' package/Makefile:133: recipe for target 'package/feeds/iplatform/samba/compile' failed make[2]: *** [package/feeds/iplatform/samba/compile] Error 2 make[2]: Leaving directory '/data/red-round3/red-round3/Iplatform/openwrt' /data/red-round3/red-round3/Iplatform/openwrt/include/toplevel.mk:184: recipe for target 'package/samba/compile' failed make[1]: *** [package/samba/compile] Error 2 make[1]: Leaving directory '/data/red-round3/red-round3/Iplatform/openwrt' Makefile:234: recipe for target 'iplatform_package/samba/compile' failed make: *** [iplatform_package/samba/compile] Error 2
最新发布
11-02
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值