From 2ba2ded1935a26673f190835da53200a43b4b2e0 Mon Sep 17 00:00:00 2001 From: zxilly Date: Mon, 23 Nov 2020 20:32:39 +0800 Subject: [PATCH] add --- CMakeLists.txt | 4 ++-- Makefile | 51 ++++++++++++++++++++++++++++++++++++++++++++++++++ main.c | 6 ------ src/main.c | 6 ++++++ 4 files changed, 59 insertions(+), 8 deletions(-) create mode 100644 Makefile delete mode 100644 main.c create mode 100644 src/main.c diff --git a/CMakeLists.txt b/CMakeLists.txt index 333e574..f4ecdc8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,6 @@ -cmake_minimum_required(VERSION 3.17) +cmake_minimum_required(VERSION 3.16) project(UA2F C) set(CMAKE_C_STANDARD 99) -add_executable(UA2F main.c) \ No newline at end of file +add_executable(UA2F src/main.c) \ No newline at end of file diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..fc16cee --- /dev/null +++ b/Makefile @@ -0,0 +1,51 @@ +include $(TOPDIR)/rules.mk +include $(INCLUDE_DIR)/kernel.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:=UA2F +PKG_VERSION:=1.0 +PKG_RELEASE:=1 + +# Source settings (i.e. where to find the source codes) +# This is a custom variable, used below +SOURCE_DIR:=./src + +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/ua2f + SECTION:=net + CATEGORY:=Network + SUBMENU:=Routing and Redirection + TITLE:=Change User-Agent to Fwords + URL:=https://learningman.top +endef + +# Package description; a more verbose description on what our package does +define Package/ua2f/description + Change User-agent to Fwords to prevent be checked by Dr.Com. +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 $(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)/helloworld.o -c $(PKG_BUILD_DIR)/helloworld.c + $(TARGET_CC) $(TARGET_LDFLAGS) -o $(PKG_BUILD_DIR)/$1 $(PKG_BUILD_DIR)/helloworld.o +endef + +# Package install instructions; create a directory inside the package to hold our executable, and then copy the executable we built previously into the folder +define Package/ua2f/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/helloworld $(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,ua2f)) \ No newline at end of file diff --git a/main.c b/main.c deleted file mode 100644 index f26b97c..0000000 --- a/main.c +++ /dev/null @@ -1,6 +0,0 @@ -#include - -int main() { - printf("Hello, World!\n"); - return 0; -} diff --git a/src/main.c b/src/main.c new file mode 100644 index 0000000..43e5258 --- /dev/null +++ b/src/main.c @@ -0,0 +1,6 @@ +#include + +int main(void){ + int a=200; + +} \ No newline at end of file