From bb37058d3f98f322064829aa47790c0ccf1e48a0 Mon Sep 17 00:00:00 2001 From: "Tom G. Huang" Date: Mon, 1 Apr 2019 19:11:30 -0700 Subject: [PATCH] chore: Update README and the root Makefile for the latest build system --- .gitignore | 1 + Makefile | 30 ++++++--------- README.md | 108 +++++++++++++++-------------------------------------- 3 files changed, 42 insertions(+), 97 deletions(-) diff --git a/.gitignore b/.gitignore index 10caebf..b469b3d 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,7 @@ build/ dist/ +.archive/ .tags/ # Ignore JetBrains and Eclipse IDE metadata and default build directories diff --git a/Makefile b/Makefile index 87d6027..28413ed 100644 --- a/Makefile +++ b/Makefile @@ -40,9 +40,7 @@ MKINDEX = makeindex PRINTF = printf GIT = git -RELEASE_DIR = output -TMP_DIR = output/tmp -BIN_DIR = bin +BUILD_DIR = build ARCHIVE_DIR = .archive TAGS_DIR = .tags @@ -53,26 +51,20 @@ MAKEFILE_DIR := $(abspath $(dir $(MAKEFILE_PATH))) .PHONY: help help: @printf "Usage: make [options]\n" - @printf " make co TAG= : checkout build from the local repository\n" + @printf " make co TAG= : checkout the specified tag\n" @printf " make archive TAG= : create src archive in the .archive directory\n" - @printf " make tag TAG= : tag main branch\n" - @printf " make taglist : list all tags\n" + @printf " make tag TAG= : tag the master branch\n" + @printf " make taglist : list all available tags\n" @printf " make cleanall : clean the distribution package and temp files\n" @printf " make help : display this message\n" @printf " make githead : show the first 7-digit of the HEAD commit SHA-1\n" @printf "\n" - @printf "Change to the mainline or a specific tag directory, and type 'make' or 'make help'\n" - @printf "to get a list of available targets. You can build the latest version in the mainline\n" - @printf "directory, and build a specific version in the tag directory. Here are the mainline\n" - @printf "and tag directories and their corresponding output directories:\n" - @printf " Mainline : $(MAKEFILE_DIR)/main\n" - @printf " Mainline output : $(MAKEFILE_DIR)/main/build/bin/\n" - @printf " Tag : $(MAKEFILE_DIR)/\n" - @printf " Tag output : $(MAKEFILE_DIR)//build/bin/\n" - @printf "\n" - @printf "Examples for (use 'make taglist' to get a complete list):\n" + @printf "The format is: .... The field is the\n" + @printf "first 7-digit of the HEAD commit SHA-1, which you can get by running 'make githead'.\n" + @printf "Here are some examples (use 'make taglist' to get all available tags):\n" @printf " v0.0.1.189221c\n" @printf " v1.1.0.bbf3b42\n" + @printf " v2.0.0.3b42778\n" .PHONY: co @@ -90,7 +82,7 @@ co: .PHONY: archive archive: @$(MKDIR) $(ARCHIVE_DIR) - @$(GIT) archive -o $(ARCHIVE_DIR)/sb_$(TAG).zip $(TAG) + @$(GIT) archive -o $(ARCHIVE_DIR)/argtable_$(TAG).zip $(TAG) .PHONY: tag @@ -100,14 +92,14 @@ tag: .PHONY: taglist taglist: - @$(PRINTF) "Available TAGs:\n" + @$(PRINTF) "Available tags:\n" @$(GIT) tag -l .PHONY: cleanall cleanall: @$(PRINTF) "Clean the distribution package and temp files...\n" - @$(RM) $(RELEASE_DIR) + @$(RM) $(BUILD_DIR) .PHONY: githead diff --git a/README.md b/README.md index 8b2a26f..e68b928 100644 --- a/README.md +++ b/README.md @@ -26,81 +26,62 @@ Quick Start Argtable3 is a single-file ANSI-C library. All you have to do is adding `argtable3.c` to your projects, and including `argtable3.h` in your source code. -If you have modified Argtable3 and want to quickly verify whether the -modifications break any existing code or not, you can run the following commands -in the project root directory to build both examples and unit tests and run unit -tests: +To build the library, examples, and unit tests, use CMake to generate out-of-source build: -* If you use GCC (Linux, MinGW, Cygwin), type: +* If you use GCC (Linux, MinGW, Cygwin), run: ``` + $ mkdir build + $ cd build + $ cmake .. $ make + $ make test ``` To cleanup, type: ``` - make cleanall + $ make clean ``` -* If you use Microsoft Visual C++ compiler, type: +* If you use Microsoft Visual C++ compiler, run: ``` - $ nmake /f Makefile.nmake + $ mkdir build + $ cd build + $ cmake -G "Visual Studio 15 2017 Win64" .. ``` - To cleanup, type: - - ``` - nmake /f Makefile.nmake cleanall - ``` - -If you want to use CMake to generate Visual Studio 2017 x64 solution file, type: - -``` -$ mkdir build -$ cd build -$ cmake -G "Visual Studio 15 2017 Win64" .. -``` - -To cleanup, just remove the `build` directory. - - -Documentation and Examples --------------------------- + Now you can use Visual Studio 2017 to open the generated solution. To cleanup, + just remove the `build` directory. -To learn how to use the Argtable3 API, you can see the documentation on the web -site, or examples in the `examples` folder. -To build the examples, open the console window of your favorite development -environments, go to the `examples` folder, and use the included Makefiles to build -the examples. - -* If you use GCC (Linux, MinGW, Cygwin), type: +To build a tagged version, go to the project root directory, and use the +`Makefile` in the project root folder to check out the specified version: ``` + $ make taglist + Available TAGs: + v3.1.1.432a160 + $ make co TAG=v3.1.1.432a160 + $ cd .tags/v3.1.1.432a160 + $ mkdir build + $ cd build + $ cmake .. $ make + $ make test ``` - To cleanup, type: - - ``` - make cleanall - ``` +You will find the shared library (or Windows DLL), static library, and the +amalgamation distribution under the build directory. -* If you use Microsoft Visual C++ compiler, type: +Documentation and Examples +-------------------------- - ``` - $ nmake /f Makefile.nmake - ``` +To learn how to use the Argtable3 API, you can see the documentation on the web +site, or examples in the `examples` folder. - To cleanup, type: - - ``` - nmake /f Makefile.nmake cleanall - ``` - Unit Tests ---------- @@ -110,35 +91,6 @@ anyway you want. However, before committing your code to your own repository or the Argtable3 official repository, please make sure your changes can pass the unit tests included in the distribution. -To build and run the unit tests, open the console window of your favorite -development environments, go to the `tests` folder, and use the included Makefiles -to build and run the unit tests. - -* If you use GCC (Linux, MinGW, Cygwin), type: - - ``` - $ make - ``` - - To cleanup, type: - - ``` - make cleanall - ``` - - -* If you use Microsoft Visual C++ compiler, type: - - ``` - $ nmake /f Makefile.nmake - ``` - - To cleanup, type: - - ``` - nmake /f Makefile.nmake cleanall - ``` - Authors -------