summaryrefslogtreecommitdiff
path: root/Makefile
blob: 3ec472fbd7fe7d55b394fd4bdd756d5b197cfd8a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
CC      = /usr/bin/g++
CFLAGS  = -Wall -g -std=c++11 -Werror=missing-prototypes
LDFLAGS =
OUTPUT = Engine
BUILDDIR = build
#VERSION
VERSION = 0
PATCHLEVEL = 2

OBJ = main.o cObject.o cObjectHandler.o cRender.o cInput.o cWiremesh.o

debug: genversion $(OBJ)
	mkdir -p $(BUILDDIR)
	$(CC) $(CFLAGS) -o $(BUILDDIR)/$(OUTPUT) $(OBJ) $(LDFLAGS)

%.o: %.cpp
	@echo
	@echo Building $<
	@echo ==============
	@echo
	$(CC) $(CFLAGS) -c $<

all: clean debug

.PHONY: clean

clean:
	rm -df $(BUILDDIR)/$(OUTPUT) *.o version.h

run: debug
	./$(BUILDDIR)/$(OUTPUT)

genversion:
	@echo Building Version
	@echo "//Generated by MAKEFILE. DO NOT Edit." > version.h
	@echo "#pragma once" >> version.h
	@echo "#define VERSION $(VERSION)" >> version.h
	@echo "#define PATCHLEVEL $(PATCHLEVEL)" >> version.h
	@echo "#define BRANCH \"`git status -bs | grep '##'`\"" >> version.h
	@echo "#define DATE \"`date +'%d.%m.20%y'`\"" >> version.h
	@echo "#define TIME \"`date +'%H:%M:%S'`\"" >> version.h