aboutsummaryrefslogtreecommitdiffstats
path: root/makefile
diff options
context:
space:
mode:
authorYann Herklotz <ymherklotz@gmail.com>2017-02-06 11:02:43 +0000
committerYann Herklotz <ymherklotz@gmail.com>2017-02-06 11:02:43 +0000
commitbc3afbc163f176e6db5d935953908c8d00d917a5 (patch)
tree63d1f94e2aca71592eec1d43f73a5c326994c961 /makefile
parent7c188eff520dc659f2ba324e0eb85174ea318c86 (diff)
downloadCompiler-bc3afbc163f176e6db5d935953908c8d00d917a5.tar.gz
Compiler-bc3afbc163f176e6db5d935953908c8d00d917a5.zip
adding all
Diffstat (limited to 'makefile')
-rw-r--r--makefile44
1 files changed, 31 insertions, 13 deletions
diff --git a/makefile b/makefile
index 5f938f3..3ecd3ec 100644
--- a/makefile
+++ b/makefile
@@ -1,13 +1,31 @@
-
-
-bin/c_lexer :
- echo "No current build commands for C lexer."
- exit 1
-
-bin/c_parser :
- echo "No current build commands for C parser."
- exit 1
-
-bin/c_compiler :
- echo "No current build commands for C compile."
- exit 1
+CC := g++ # this is the main compiler
+# CC := clange --analyze # and comment out the linker last line
+
+CFLAGS := -g -Wall -Wextra -Wpedantic -std=c++14
+INC := -Iinclude
+
+bin/c_lexer: build/main.o build/c_lexer.o build/c_lexer.yy.o
+ @echo " Linking..."
+ @mkdir -p bin
+ @echo " $(CC) $^ -o bin/c_lexer"; $(CC) $^ -o bin/c_lexer
+
+build/c_lexer.yy.o: src/c_lexer.yy.cpp
+ @mkdir -p build
+ @echo " $(CC) $(CFLAGS) $(INC) -c -o $@ $<"; $(CC) $(CFLAGS) $(INC) -c -o $@ $<
+
+build/main.o: src/main.cpp
+ @mkdir -p build
+ @echo " $(CC) $(CFLAGS) $(INC) -c -o $@ $<"; $(CC) $(CFLAGS) $(INC) -c -o $@ $<
+
+build/c_lexer.o: src/c_lexer.cpp
+ @mkdir -p build
+ @echo " $(CC) $(CFLAGS) $(INC) -c -o $@ $<"; $(CC) $(CFLAGS) $(INC) -c -o $@ $<
+
+src/c_lexer.yy.cpp: src/c_lexer.flex
+ @echo " flex -o $@ $<"; flex -o $@ $<
+
+clean:
+ @echo " Cleaning..."
+ @echo " $(RM) -r build bin src/c_lexer.yy.cpp"; $(RM) -r build bin src/c_lexer.yy.cpp
+
+.PHONY: clean