Add release build and compile test
This commit is contained in:
		
							
								
								
									
										32
									
								
								compile
									
									
									
									
									
								
							
							
						
						
									
										32
									
								
								compile
									
									
									
									
									
								
							| @@ -1,13 +1,39 @@ | |||||||
| #!/bin/bash | #!/bin/bash | ||||||
|  |  | ||||||
|  | BUILD_TYPE="debug" | ||||||
|  |  | ||||||
|  | while [[ $# > 0 ]];do | ||||||
|  |   case $1 in | ||||||
|  |     --release) | ||||||
|  |       BUILD_TYPE="release" | ||||||
|  |       shift | ||||||
|  |       ;; | ||||||
|  |     *|-*|--*) | ||||||
|  |       echo "Unknown option $1" | ||||||
|  |       exit 1 | ||||||
|  |       ;; | ||||||
|  |   esac | ||||||
|  | done | ||||||
|  |  | ||||||
| CC=clang | CC=clang | ||||||
|  | CFLAGS="-Wall -Werror -pedantic " | ||||||
|  | LIBFLAGS="-fPIC -shared" | ||||||
| INCLUDE="\ | INCLUDE="\ | ||||||
| 	$(find src -type d | xargs -I{} echo -n "-I{} ") \ | 	$(find src -type d | xargs -I{} echo -n "-I{} ") \ | ||||||
| " | " | ||||||
| SRC="\ | SRC="\ | ||||||
| 	$(find src -type f -name *.c | xargs -I{} echo -n "{} ") \ | 	$(find src -type f -name "*.c" | xargs -I{} echo -n "{} ") \ | ||||||
| " | " | ||||||
| CFLAGS="-O3 -shared -fPIC -Wall -Werror -pedantic" | if [[ $BUILD_TYPE == "release" ]]; then | ||||||
|  |   CFLAGS+="-O3" | ||||||
|  | else | ||||||
|  |   CFLAGS+="-g -fsanitize=address -fsanitize=undefined" | ||||||
|  | fi | ||||||
|  |  | ||||||
| OUT="libwapp.so" | OUT="libwapp.so" | ||||||
|  |  | ||||||
| (set -x ; $CC $CFLAGS $INCLUDE $SRC -o $OUT) | (set -x ; $CC $CFLAGS $LIBFLAGS $INCLUDE $SRC -o $OUT) | ||||||
|  |  | ||||||
|  | if [[ -f ./test.c ]]; then | ||||||
|  | 	(set -x ; $CC $CFLAGS $INCLUDE $SRC ./test.c -o test) | ||||||
|  | fi | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user