From 25a0e7d64e8149f237303bf2072fa86dce69df78 Mon Sep 17 00:00:00 2001 From: Rafal Kupiec Date: Thu, 12 Jul 2018 13:32:53 +0200 Subject: [PATCH] More generic Makefile, allowing to build just source files with changes --- Makefile | 34 ++++++++++++++++++++++++++++++---- 1 file changed, 30 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index a3091e1..0423000 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,32 @@ -ph7: api.c builtin.c compile.c constant.c hashmap.c lex.c lib.c memobj.c oo.c parse.c vfs.c vm.c interpreter.c - cc -o ph7 api.c builtin.c compile.c constant.c hashmap.c lex.c lib.c memobj.c oo.c parse.c vfs.c vm.c interpreter.c -W -Wunused -Wall -I. -Ofast +CFLAGS = -W -Wunused -Wall -I. -Ofast +LDFLAGS = +CC = gcc +INCLUDES = + +OBJ =\ + api.o \ + builtin.o \ + compile.o \ + constant.o \ + hashmap.o \ + interpreter.o \ + lex.o \ + lib.o \ + memobj.o \ + oo.o \ + parse.o \ + vfs.o \ + vm.o + + +all: main clean: - rm -rf *.o - rm -rf ph7 + rm -f *.o ph7 + +main: $(OBJ) + $(CC) $(OBJ) $(LIBS) -o ph7 + +.c.o: + $(CC) -c $(INCLUDES) $(CFLAGS) $< +