Ensure build scripts fail if attempting to run them from different
directory
This commit is contained in:
		
							
								
								
									
										29
									
								
								compile
									
									
									
									
									
								
							
							
						
						
									
										29
									
								
								compile
									
									
									
									
									
								
							@@ -1,29 +1,28 @@
 | 
			
		||||
#!/bin/bash
 | 
			
		||||
 | 
			
		||||
SCRIPT_DIR="$(dirname $0)"
 | 
			
		||||
CC=clang
 | 
			
		||||
CFLAGS="-g -Wall -Werror -pedantic -I$SCRIPT_DIR/include"
 | 
			
		||||
SRC="$SCRIPT_DIR/src/main.c"
 | 
			
		||||
OUT=$SCRIPT_DIR/main
 | 
			
		||||
CFLAGS="-g -Wall -Werror -pedantic -I./include"
 | 
			
		||||
SRC="./src/main.c"
 | 
			
		||||
OUT=./main
 | 
			
		||||
 | 
			
		||||
# STATE_TABLE
 | 
			
		||||
$CC $CFLAGS -I$SCRIPT_DIR/include/lexer $SCRIPT_DIR/generate_state_table.c -o $SCRIPT_DIR/gentable
 | 
			
		||||
$SCRIPT_DIR/gentable
 | 
			
		||||
(set -x;$CC $CFLAGS -I./include/lexer ./generate_state_table.c -o ./gentable)
 | 
			
		||||
./gentable
 | 
			
		||||
 | 
			
		||||
# DSTRING
 | 
			
		||||
CFLAGS+=" -I$SCRIPT_DIR/include/dstring"
 | 
			
		||||
SRC+=" $SCRIPT_DIR/src/dstring/*.c"
 | 
			
		||||
CFLAGS+=" -I./include/dstring"
 | 
			
		||||
SRC+=" ./src/dstring/*.c"
 | 
			
		||||
 | 
			
		||||
# JSON_ENTITIES
 | 
			
		||||
CFLAGS+=" -I$SCRIPT_DIR/include/json_entities"
 | 
			
		||||
SRC+=" $SCRIPT_DIR/src/json_entities/*.c"
 | 
			
		||||
CFLAGS+=" -I./include/json_entities"
 | 
			
		||||
SRC+=" ./src/json_entities/*.c"
 | 
			
		||||
 | 
			
		||||
# LEXER
 | 
			
		||||
CFLAGS+=" -I$SCRIPT_DIR/include/lexer"
 | 
			
		||||
SRC+=" $SCRIPT_DIR/src/lexer/*.c"
 | 
			
		||||
CFLAGS+=" -I./include/lexer"
 | 
			
		||||
SRC+=" ./src/lexer/*.c"
 | 
			
		||||
 | 
			
		||||
# PARSER
 | 
			
		||||
CFLAGS+=" -I$SCRIPT_DIR/include/parser"
 | 
			
		||||
SRC+=" $SCRIPT_DIR/src/parser/*.c"
 | 
			
		||||
CFLAGS+=" -I./include/parser"
 | 
			
		||||
SRC+=" ./src/parser/*.c"
 | 
			
		||||
 | 
			
		||||
$CC $CFLAGS $SRC -o $OUT
 | 
			
		||||
(set -x;$CC $CFLAGS $SRC -o $OUT)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user