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
 | 
					#!/bin/bash
 | 
				
			||||||
 | 
					
 | 
				
			||||||
SCRIPT_DIR="$(dirname $0)"
 | 
					 | 
				
			||||||
CC=clang
 | 
					CC=clang
 | 
				
			||||||
CFLAGS="-g -Wall -Werror -pedantic -I$SCRIPT_DIR/include"
 | 
					CFLAGS="-g -Wall -Werror -pedantic -I./include"
 | 
				
			||||||
SRC="$SCRIPT_DIR/src/main.c"
 | 
					SRC="./src/main.c"
 | 
				
			||||||
OUT=$SCRIPT_DIR/main
 | 
					OUT=./main
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# STATE_TABLE
 | 
					# STATE_TABLE
 | 
				
			||||||
$CC $CFLAGS -I$SCRIPT_DIR/include/lexer $SCRIPT_DIR/generate_state_table.c -o $SCRIPT_DIR/gentable
 | 
					(set -x;$CC $CFLAGS -I./include/lexer ./generate_state_table.c -o ./gentable)
 | 
				
			||||||
$SCRIPT_DIR/gentable
 | 
					./gentable
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# DSTRING
 | 
					# DSTRING
 | 
				
			||||||
CFLAGS+=" -I$SCRIPT_DIR/include/dstring"
 | 
					CFLAGS+=" -I./include/dstring"
 | 
				
			||||||
SRC+=" $SCRIPT_DIR/src/dstring/*.c"
 | 
					SRC+=" ./src/dstring/*.c"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# JSON_ENTITIES
 | 
					# JSON_ENTITIES
 | 
				
			||||||
CFLAGS+=" -I$SCRIPT_DIR/include/json_entities"
 | 
					CFLAGS+=" -I./include/json_entities"
 | 
				
			||||||
SRC+=" $SCRIPT_DIR/src/json_entities/*.c"
 | 
					SRC+=" ./src/json_entities/*.c"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# LEXER
 | 
					# LEXER
 | 
				
			||||||
CFLAGS+=" -I$SCRIPT_DIR/include/lexer"
 | 
					CFLAGS+=" -I./include/lexer"
 | 
				
			||||||
SRC+=" $SCRIPT_DIR/src/lexer/*.c"
 | 
					SRC+=" ./src/lexer/*.c"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# PARSER
 | 
					# PARSER
 | 
				
			||||||
CFLAGS+=" -I$SCRIPT_DIR/include/parser"
 | 
					CFLAGS+=" -I./include/parser"
 | 
				
			||||||
SRC+=" $SCRIPT_DIR/src/parser/*.c"
 | 
					SRC+=" ./src/parser/*.c"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
$CC $CFLAGS $SRC -o $OUT
 | 
					(set -x;$CC $CFLAGS $SRC -o $OUT)
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user