2017-03-16 00:56:37 +00:00
|
|
|
# GST
|
2017-02-09 20:02:59 +00:00
|
|
|
|
2017-03-16 00:56:37 +00:00
|
|
|
######################################################
|
|
|
|
##### Set global variables for all gst Makefiles #####
|
|
|
|
######################################################
|
|
|
|
CFLAGS=-std=c99 -Wall -Wextra -Wpedantic -g -I./include
|
2017-02-09 20:02:59 +00:00
|
|
|
PREFIX=/usr/local
|
2017-03-16 00:56:37 +00:00
|
|
|
GST_TARGET=client/gst
|
|
|
|
GST_CORELIB=core/libgst.a
|
2017-03-22 04:27:18 +00:00
|
|
|
GST_HEADERS=$(addprefix include/gst/, gst.h stl.h compile.h disasm.h parse.h)
|
2017-03-16 00:56:37 +00:00
|
|
|
|
|
|
|
all: $(GST_TARGET)
|
|
|
|
|
|
|
|
###################################
|
|
|
|
##### The core vm and runtime #####
|
|
|
|
###################################
|
|
|
|
GST_CORE_SOURCES=$(addprefix core/,\
|
2017-03-22 04:27:18 +00:00
|
|
|
compile.c disasm.c parse.c stl.c strings.c stringcache.c\
|
2017-03-21 03:06:38 +00:00
|
|
|
value.c vm.c ds.c gc.c thread.c serialize.c)
|
2017-03-16 00:56:37 +00:00
|
|
|
GST_CORE_OBJECTS=$(patsubst %.c,%.o,$(GST_CORE_SOURCES))
|
|
|
|
$(GST_CORELIB): $(GST_CORE_OBJECTS) $(GST_HEADERS)
|
|
|
|
ar rcs $(GST_CORELIB) $(GST_CORE_OBJECTS)
|
|
|
|
|
|
|
|
##############################
|
|
|
|
##### The example client #####
|
|
|
|
##############################
|
|
|
|
GST_CLIENT_SOURCES=client/main.c
|
|
|
|
GST_CLIENT_OBJECTS=$(patsubst %.c,%.o,$(GST_CLIENT_SOURCES))
|
2017-03-21 03:06:38 +00:00
|
|
|
$(GST_TARGET): $(GST_CLIENT_OBJECTS) $(GST_HEADERS) $(GST_CORELIB)
|
|
|
|
$(CC) $(CFLAGS) -o $(GST_TARGET) $(GST_CLIENT_OBJECTS) $(GST_CORELIB)
|
2017-03-16 00:56:37 +00:00
|
|
|
|
|
|
|
# Compile all .c to .o
|
|
|
|
%.o : %.c $(GST_HEADERS)
|
2017-02-09 20:02:59 +00:00
|
|
|
$(CC) $(CFLAGS) -o $@ -c $<
|
|
|
|
|
2017-03-16 00:56:37 +00:00
|
|
|
run: $(GST_TARGET)
|
|
|
|
./$(GST_TARGET)
|
2017-02-09 20:02:59 +00:00
|
|
|
|
2017-03-16 00:56:37 +00:00
|
|
|
debug: $(GST_TARGET)
|
|
|
|
gdb $(GST_TARGET)
|
2017-02-09 20:02:59 +00:00
|
|
|
|
2017-03-16 00:56:37 +00:00
|
|
|
valgrind: $(GST_TARGET)
|
|
|
|
valgrind ./$(GST_TARGET) --leak-check=full
|
2017-02-09 20:02:59 +00:00
|
|
|
|
2017-03-16 00:56:37 +00:00
|
|
|
clean:
|
|
|
|
rm $(GST_TARGET) || true
|
|
|
|
rm $(GST_CORELIB) || true
|
|
|
|
rm $(GST_CORE_OBJECTS) || true
|
|
|
|
rm $(GST_CLIENT_OBJECTS) || true
|
2017-03-22 04:27:18 +00:00
|
|
|
rm vgcore.* || true
|
2017-02-09 20:56:45 +00:00
|
|
|
|
|
|
|
.PHONY: clean install run debug valgrind
|