Temat: Tworzenie paczki z aplikacja na openWRT
Cześć,
potrzebuję zrobić paczkę z mojej aplikacji. Mam problem tylko z dograniem makefila do tego. Zrobiłem przykładową paczkę z aplikacją, która nie potrzebuje nic innego oprócz main.c
Docelowa aplikacja posiada kilka plików .c i .h, które są potrzebne do kompilacji.
Mój makefile wygląda tak :
include $(TOPDIR)/rules.mk
# Name, version and release number
# The name and version of your package are used to define the variable to point to the build directory of your package: $(PKG_BUILD_DIR)
PKG_NAME:=czytnik
PKG_VERSION:=1.0
PKG_RELEASE:=1
TARGET_CFLAGS=-DLOG_USE_COLOR -DMAIN_LOG_LEVEL -I"../../include" -I"../../drivers" -I"../../libraries"
TARGET_LDFLAGS=-DLOG_USE_COLOR -DMAIN_LOG_LEVEL -L"../../include" -L"../../drivers" -L"../../libraries"
TARGET_CC=mipsel-openwrt-linux-gcc
# Source settings (i.e. where to find the source codes)
# This is a custom variable, used below
SOURCE_DIR:=/home/xyz/git/backup/iksde/app
include $(INCLUDE_DIR)/package.mk
# Package definition; instructs on how and where our package will appear in the overall configuration menu ('make menuconfig')
define Package/czytnik
SECTION:=app
CATEGORY:=Examples
TITLE:=czytnik app
endef
# Package description; a more verbose description on what our package does
define Package/czytnik/description
czytnik app.
endef
# Package preparation instructions; create the build directory and copy the source code.
# The last command is necessary to ensure our preparation instructions remain compatible with the patching system.
define Build/Prepare
mkdir -p $(PKG_BUILD_DIR)
cp -r $(SOURCE_DIR)/* $(PKG_BUILD_DIR)
$(Build/Patch)
endef
# Package build instructions; invoke the target-specific compiler to first compile the source file, and then to link the file into the final executable
define Build/Compile
$(TARGET_CC) $(TARGET_CFLAGS) -o $(PKG_BUILD_DIR)/main.o -c $(PKG_BUILD_DIR)/main.c
$(TARGET_CC) $(TARGET_LDFLAGS) -o $(PKG_BUILD_DIR)/$1 $(PKG_BUILD_DIR)/main.o
endef
# Package install instructions; create a directory inside the package to hold our executable, and then copy the executable we built previously into th$
define Package/czytnik/install
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/czytnik $(1)/usr/bin
endef
# This command is always the last, it uses the definitions and variables we give above in order to get the job done
$(eval $(call BuildPackage,czytnik))Dodalem foldery w ktorych znajduja się potrzbene pliki w TARGET_CFLAGS. Przy kompilacji dostaje ->
No such file or directory
oczywiscie plik znajduje się w /include/
Projekt cały buduję się w środowisku ECLIPSE bez problemu. Ale mam chyba problem z poprawnym zrozumieniem tego makefila