From 05ce3e45bbaf1ab1b6f1dd618a76b3157e2ee7dd Mon Sep 17 00:00:00 2001 From: John Date: Mon, 22 Apr 2019 17:14:26 +0100 Subject: [PATCH] Make file introduced and tested. Requires make. --- .gitignore | 1 + makefile | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+) create mode 100644 makefile diff --git a/.gitignore b/.gitignore index bb24c6b..a1d0aef 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ *.exe *.log +target-build_binary/ \ No newline at end of file diff --git a/makefile b/makefile new file mode 100644 index 0000000..fa68157 --- /dev/null +++ b/makefile @@ -0,0 +1,54 @@ +# Compiler and linker specific configuration macros and flags. +# ============================================================ + +CC = gcc + +CFLAG = -std=c99 -mconsole -Os -s -Wall -Wextra +LDFLAG = -lwinmm + +BUILD_PATH = target-build_binary + +INCLUDE_PATH = -I../lib_oldjaytrax +MODULE_PATH = ../lib_oldjaytrax + +INCLUDE = ioutil.h mixcore.h jaytrax.h jxs.h +MODULES = jaytrax.c mixcore.c jxs.c +OBJS = jaytrax.o mixcore.o jxs.o + +SRC = $(MODULES:%.c=$(MODULE_PATH)/%.c) + +# Macros for clitools generation. +# ================================================= +EXE_NAME = jaytrax_bin32.exe + +EXECUTABLE_INCLUDE_PATH = -I../clitools +EXECUTABLE_MODULE_PATH = ../clitools + +EXECUTABLE_INCLUDE_INCLUDE_PATH = winmmout.h +EXECUTABLE_MODULES = winmmout.c main.c +EXECUTABLE_OBJECTS = winmmout.o main.o + +EXE_SRC = $(EXECUTABLE_MODULES:%.c=$(EXECUTABLE_MODULE_PATH)/%.c) + +# Commands and dependencies in declarative clauses. +# ================================================= + +all: build + +build: compile link + +compile: + cd $(BUILD_PATH) && $(CC) $(INCLUDE_PATH) $(EXECUTABLE_INCLUDE_PATH) $(CFLAG) -c $(SRC) $(EXE_SRC) + +link: + cd $(BUILD_PATH) && $(CC) $(OBJS) $(EXECUTABLE_OBJECTS) $(LDFLAG) -o $(EXE_NAME) + +install: + echo Not yet implemented. + +clean: + rm $(BUILD_PATH) *.exe + rm $(BUILD_PATH) *.o + +# Need to handle change detection per object file. TODO. + \ No newline at end of file