aboutsummaryrefslogtreecommitdiff
path: root/smash/Makefile
diff options
context:
space:
mode:
authorNathan Reiner <nathan@nathanreiner.xyz>2023-02-10 13:40:15 +0100
committerNathan Reiner <nathan@nathanreiner.xyz>2023-02-10 13:40:15 +0100
commitd2f37b5965d5c122bbc0e86e0e91b0d631012325 (patch)
tree888277f57ea7518d507a5df17b1c679e10f8aac9 /smash/Makefile
parentb6e7782be4a7e5d6e4b40787f0bb4e5c65e99520 (diff)
Make autobootstrap system
Diffstat (limited to 'smash/Makefile')
-rw-r--r--smash/Makefile30
1 files changed, 14 insertions, 16 deletions
diff --git a/smash/Makefile b/smash/Makefile
index b8fb606..0f90909 100644
--- a/smash/Makefile
+++ b/smash/Makefile
@@ -1,20 +1,18 @@
-default_target: all
+SRC=$(wildcard *.c)
+OBJ=$(SRC:%.c=objects/%.o)
+CFLAGS=-static -nostdlib -fno-stack-protector -Wno-implicit-function-declaration -fno-builtin -g
-unit_test_parser:
- gcc parser.c ../lib/slib.a -static -nostdlib -fno-stack-protector -Wno-implicit-function-declaration -o test -DPARSER_UNIT_TEST -g
- ./test
+default_target: smash
-unit_test_variables:
- gcc variables.c ../lib/slib.a -static -nostdlib -fno-stack-protector -o test -DVARIABLES_UNIT_TEST -g
- ./test
+objects/%.o: %.c
+ @echo Building $<
+ @-mkdir -p $$(dirname $@)
+ @gcc -c $< -o $@ ${CFLAGS}
-unit_test_builtin:
- gcc builtin.c ../lib/slib.a -static -nostdlib -fno-stack-protector -Wno-implicit-function-declaration -o test -DBUILTIN_UNIT_TEST -g
- ./test
+smash: ${OBJ}
+ @echo Buliding Smash
+ @gcc ${OBJ} ../lib/slib.a -o smash ${CFLAGS}
-unit_test_exec:
- gcc exec.c builtin.c parser.c ../lib/slib.a -static -nostdlib -fno-stack-protector -Wno-implicit-function-declaration -o test -DEXEC_UNIT_TEST -g
- ./test
-
-all:
- gcc main.c env.c comment.c exec.c parser.c builtin.c ../lib/slib.a -static -nostdlib -fno-stack-protector -Wno-implicit-function-declaration -fno-builtin -o smash -DVARIABLES_UNIT_TEST -g
+clean:
+ @echo Cleaning Up Smash
+ @rm -r objects smash