Skip to content

Commit

Permalink
chore: Update README and the root Makefile for the latest build system
Browse files Browse the repository at this point in the history
  • Loading branch information
tomghuang committed Apr 2, 2019
1 parent 432a160 commit bb37058
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 97 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

build/
dist/
.archive/
.tags/

# Ignore JetBrains and Eclipse IDE metadata and default build directories
Expand Down
30 changes: 11 additions & 19 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -53,26 +51,20 @@ MAKEFILE_DIR := $(abspath $(dir $(MAKEFILE_PATH)))
.PHONY: help
help:
@printf "Usage: make <target> [options]\n"
@printf " make co TAG=<TAG_NAME> : checkout build from the local repository\n"
@printf " make co TAG=<TAG_NAME> : checkout the specified tag\n"
@printf " make archive TAG=<TAG_NAME> : create src archive in the .archive directory\n"
@printf " make tag TAG=<TAG_NAME> : tag main branch\n"
@printf " make taglist : list all tags\n"
@printf " make tag TAG=<TAG_NAME> : 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/<CONFIG>\n"
@printf " Tag : $(MAKEFILE_DIR)/<TAG_NAME>\n"
@printf " Tag output : $(MAKEFILE_DIR)/<TAG_NAME>/build/bin/<CONFIG>\n"
@printf "\n"
@printf "Examples for <TAG_NAME> (use 'make taglist' to get a complete list):\n"
@printf "The <TAG_NAME> format is: <MAJOR>.<MINOR>.<PATCH>.<BUILD>. The <BUILD> 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 <TAG_NAME> 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
Expand All @@ -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
Expand All @@ -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
Expand Down
108 changes: 30 additions & 78 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
----------
Expand All @@ -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
-------
Expand Down

0 comments on commit bb37058

Please sign in to comment.