hi guys,
i want to build the "capsulator" from "http://www.openflow.org/wk/index.php/Tu … Capsulator" into a openwrt package. i download the Capsulator source file.
i put it in the /package/Capsulator/src folder.
i don't change the original Makefile in the Capsulator source file.
the Capsulator/src/Makefile shows below.
# Makefile for Capsulator
# ------------------------------------------------------------------------------
# make -- builds Capsulator and all dependencies in the default mode
# make debug -- builds Capsulator in debug mode
# make release-- builds Capsulator in release mode
# make clean -- clean up byproducts
# utility programs used by this Makefile
CC = gcc
MAKE = gmake --no-print-directory
# set system-dependent variables
OSTYPE = $(shell uname)
ifeq ($(OSTYPE),Linux)
ARCH=-D_LINUX_
ENDIAN=-D_LITTLE_ENDIAN_
LIB_SOCKETS =
endif
ifeq ($(OSTYPE),SunOS)
ARCH=-D_SOLARIS_
ENDIAN=-D_BIG_ENDIAN_
LIB_SOCKETS = -lnsl -lsocket
endif
# define names of our build targets
APP = capsulator
# compiler and its directives
DIR_INC =
DIR_LIB =
LIBS = $(LIB_SOCKETS) -lpthread
FLAGS_CC_BASE = -c -Wall $(ARCH) $(ENDIAN) $(DIR_INC)
# compiler directives for debug and release modes
BUILD_TYPE = debug
ifeq ($(BUILD_TYPE),debug)
FLAGS_CC_BUILD_TYPE = -g -D_DEBUG_
else
FLAGS_CC_BUILD_TYPE = -O3
endif
# put all the flags together
CFLAGS = $(FLAGS_CC_BASE) $(FLAGS_CC_BUILD_TYPE)
# project sources
SRCS = common.c capsulator.c get_ip_for_interface.c main.c
OBJS = $(patsubst %.c,%.o,$(SRCS))
DEPS = $(patsubst %.c,.%.d,$(SRCS))
# include the dependencies once we've built them
ifdef INCLUDE_DEPS
include $(DEPS)
endif
#########################
## PHONY TARGETS
#########################
# note targets which don't produce a file with the target's name
.PHONY: all clean clean-all clean-deps debug release deps
# build the program
all: $(APP)
# clean up by-products (except dependency files)
clean:
rm -f *.o $(APP)
# clean up all by-products
clean-all: clean clean-deps
# clean up dependency files
clean-deps:
rm -f .*.d
# shorthand for building debug or release builds
debug release:
@$(MAKE) BUILD_TYPE=$@ all
# build the dependency files
deps: $(DEPS)
# includes are ready build command
IR=ir
$(APP).$(IR): $(OBJS)
$(CC) -o $(APP) $(OBJS) $(DIR_LIB) $(LIBS)
#########################
## REAL TARGETS
#########################
$(APP): deps
@$(MAKE) BUILD_TYPE=$(BUILD_TYPE) INCLUDE_DEPS=1 $@.$(IR)
$(DEPS): .%.d: %.c
$(CC) -MM $(CFLAGS) $(DIRS_INC) $< > $@
and Capsulator/Makefile shows below.
include $(TOPDIR)/rules.mk
PKG_NAME:=Capsulator
PKG_RELEASE:=1
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
include $(INCLUDE_DIR)/package.mk
define Package/Capsulator
SECTION:=utils
CATEGORY:=Utilities
TITLE:=this is Capsulator_test
endef
define Package/Capsulator/description
this is a test Capsulator!
endef
#CONFIGURE_VARS+= \
CC="$(TOOLCHAIN_DIR)/bin/$(TARGET_CC)"
#MAKE_FLAGS += \
CXXFLAGS="$(TARGET_CXXFLAGS) -fno-builtin -fno-rtti -nostdinc++" \
CPPFLAGS="$(TARGET_CPPFLAGS) -I$(STAGING_DIR)/usr/include/uClibc++ -I$(LINUX_DIR)/include" \
LDFLAGS="$(TARGET_LDFLAGS) $(LDFLAGS)" \
LIBS="$(TARGET_LIBS) -nodefaultlibs -luClibc++ -lm" \
DESTDIR="$(PKG_INSTALL_DIR)"
define Build/Prepare
mkdir -p $(PKG_BUILD_DIR)
$(CP) ./src/* $(PKG_BUILD_DIR)/
endef
#define Build/Compile
# $(MAKE) -C $(PKG_BUILD_DIR) $(MAKE_FLAGS);
#endef
define Package/Capsulator/install
$(INSTALL_DIR) $(1)/bin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/Capsulator $(1)/bin
endef
$(eval $(call BuildPackage,Capsulator))
i am new to do this kind of thing. i try to build a helloworld package before, and it succeeds.
so i do some changes from the helloworld package.
here is the problem.
i do make package/Capsulator/compile
the error shows below.
crazygod@crazygod-virtual-machine:~/backfire$ make package/Capsulator/compile V=99
make[1]: Entering directory `/home/crazygod/backfire'
make[2]: Entering directory `/home/crazygod/backfire/package/Capsulator'
make -C /home/crazygod/backfire/build_dir/target-mips_r2_uClibc-0.9.30.1/Capsulator AR=mips-openwrt-linux-uclibc-ar AS="mips-openwrt-linux-uclibc-gcc -c -Os -pipe -mips32r2 -mtune=mips32r2 -funit-at-a-time -fhonour-copts -msoft-float" LD=mips-openwrt-linux-uclibc-ld NM=mips-openwrt-linux-uclibc-nm CC="mips-openwrt-linux-uclibc-gcc" GCC="mips-openwrt-linux-uclibc-gcc" CXX="mips-openwrt-linux-uclibc-g++" RANLIB=mips-openwrt-linux-uclibc-ranlib STRIP=mips-openwrt-linux-uclibc-strip OBJCOPY=mips-openwrt-linux-uclibc-objcopy OBJDUMP=mips-openwrt-linux-uclibc-objdump SIZE=mips-openwrt-linux-uclibc-size CROSS="mips-openwrt-linux-uclibc-" ARCH="mips" CXXFLAGS=" -fno-builtin -fno-rtti -nostdinc++" CPPFLAGS="-I/home/crazygod/backfire/staging_dir/target-mips_r2_uClibc-0.9.30.1/usr/include -I/home/crazygod/backfire/staging_dir/target-mips_r2_uClibc-0.9.30.1/include -I/home/crazygod/backfire/staging_dir/toolchain-mips_r2_gcc-4.3.3+cs_uClibc-0.9.30.1/include -I/home/crazygod/backfire/staging_dir/target-mips_r2_uClibc-0.9.30.1/usr/include/uClibc++ -I/include" LDFLAGS="-L/home/crazygod/backfire/staging_dir/target-mips_r2_uClibc-0.9.30.1/usr/lib -L/home/crazygod/backfire/staging_dir/target-mips_r2_uClibc-0.9.30.1/lib -L/home/crazygod/backfire/staging_dir/toolchain-mips_r2_gcc-4.3.3+cs_uClibc-0.9.30.1/lib " LIBS=" -nodefaultlibs -luClibc++ -lm" DESTDIR="/home/crazygod/backfire/build_dir/target-mips_r2_uClibc-0.9.30.1/Capsulator/ipkg-install";
make[3]: Entering directory `/home/crazygod/backfire/build_dir/target-mips_r2_uClibc-0.9.30.1/Capsulator'
mips-openwrt-linux-uclibc-gcc -MM -c -Wall mips -D_LITTLE_ENDIAN_ -g -D_DEBUG_ capsulator.c > .capsulator.d
mips-openwrt-linux-uclibc-gcc: mips: No such file or directory
make[3]: *** [.capsulator.d] Error 1
make[3]: Leaving directory `/home/crazygod/backfire/build_dir/target-mips_r2_uClibc-0.9.30.1/Capsulator'
make[2]: *** [/home/crazygod/backfire/build_dir/target-mips_r2_uClibc-0.9.30.1/Capsulator/.built] Error 2
make[2]: Leaving directory `/home/crazygod/backfire/package/Capsulator'
make[1]: *** [package/Capsulator/compile] Error 2
make[1]: Leaving directory `/home/crazygod/backfire'
make: *** [package/Capsulator/compile] Error 2
plz someone helps me.
any suggestion is appreciated.
(Last edited by crazygod1100908 on 13 May 2013, 10:04)