From 3fec03eeaa7dbe5152255ebdc0aae9841c241565 Mon Sep 17 00:00:00 2001 From: Jonas Gunz Date: Sun, 5 May 2019 22:58:14 +0200 Subject: Makefile fixing --- Makefile | 54 ++++++++++++++++++++++++++++-------------------------- src/cRender.h | 23 +++++++++++++---------- 2 files changed, 41 insertions(+), 36 deletions(-) diff --git a/Makefile b/Makefile index e5111ef..b13428f 100644 --- a/Makefile +++ b/Makefile @@ -1,25 +1,25 @@ -CC = clang -CFLAGS = -Wall -std=c++11 -fPIC -LDFLAGS = -shared -SONAME = termgl -BUILDDIR = build -SOURCEDIR = src -OBJECTDIR = obj -TESTSOURCE = test -#VERSION -VERSION = 1 -PATCHLEVEL = 0 -OUTPUT = lib$(SONAME).so.$(VERSION).$(PATCHLEVEL) +CC = clang +CPPFLAGS = -Wall -std=c++11 -fPIC +LDFLAGS = -shared +SONAME = termgl + +BUILDDIR = build +SOURCEDIR = src +OBJECTDIR = obj +TESTSOURCE = test +OUTPUT = lib$(SONAME).so.$(VERSION).$(PATCHLEVEL) -SRCS=$(wildcard $(SOURCEDIR)/*.cpp) -OBJS =$(SRCS:.cpp=.o) -OBJ =$(OBJS:$(SOURCEDIR)/%=$(OBJECTDIR)/%) +#VERSION +VERSION = 1 +PATCHLEVEL = 0 -#OBJ = cObject.o cObjectHandler.o cRender.o cInput.o cWiremesh.o +SRCS = $(wildcard $(SOURCEDIR)/*.cpp) +OBJS = $(SRCS:.cpp=.o) +OBJ = $(OBJS:$(SOURCEDIR)/%=$(OBJECTDIR)/%) -build: dir genversion $(OBJ) - @echo [ LD ] $(OBJ) - @$(CC) $(CFLAGS) -o $(BUILDDIR)/lib/$(OUTPUT) $(OBJ) $(LDFLAGS) -Wl,-soname=lib$(SONAME).so.$(VERSION) +build: dir genversion $(OBJ) + @echo [LD] $(OBJ) + @$(CC) $(CPPFLAGS) -o $(BUILDDIR)/lib/$(OUTPUT) $(OBJ) $(LDFLAGS) -Wl,-soname=lib$(SONAME).so.$(VERSION) @ln -sf $(OUTPUT) $(BUILDDIR)/lib/lib$(SONAME).so.$(VERSION) @ln -sf $(OUTPUT) $(BUILDDIR)/lib/lib$(SONAME).so @cp $(SOURCEDIR)/c*.h $(BUILDDIR)/inc @@ -35,13 +35,15 @@ debug: CFLAGS += -g -D _DEBUG debug: build; $(OBJECTDIR)/%.o: $(SOURCEDIR)/%.cpp - @echo [ CC ] $< - @$(CC) $(CFLAGS) -c $< -o $@ + @echo [CC] $< + @$(CC) $(CPPFLAGS) -c $< -o $@ $(OBJECTDIR)/%.o: example/%.cpp - @echo [ CC ] $< - @$(CC) $(CFLAGS) -I$(SOURCEDIR) -c $< + @echo [CC] $< + @$(CC) $(CPPFLAGS) -I$(SOURCEDIR) -c $< +debug: CPPFLAGS+=-g +debug: build all: clean build @@ -66,10 +68,10 @@ genversion: @echo "#define BUILDER \"`git config user.name`\"" >> $(SOURCEDIR)/version.h @echo "#define BUILDERMAIL \"`git config user.email`\"" >> $(SOURCEDIR)/version.h -gentest: build $(OBJECTDIR)/$(TESTSOURCE).o - @echo [ LD ] $(TESTSOURCE).o +gentest: debug $(OBJECTDIR)/$(TESTSOURCE).o + @echo [LD] $(TESTSOURCE).o @mkdir -p $(BUILDDIR)/test - @$(CC) $(DEBUGFLAGS) -o $(BUILDDIR)/test/test $(TESTSOURCE).o $(OBJ) -lstdc++ -lm + @$(CC) $(CPPFLAGS) -g -o $(BUILDDIR)/test/test $(TESTSOURCE).o $(OBJ) -lstdc++ -lm run: gentest @./$(BUILDDIR)/test/test diff --git a/src/cRender.h b/src/cRender.h index 4aa2c4d..5b6189e 100644 --- a/src/cRender.h +++ b/src/cRender.h @@ -29,6 +29,9 @@ #define _ERR_RENDER_BLOCKED_BY_CHILD_ 3 #define _ERR_SCREEN_TOO_SMALL_ 4 +//Testing +#define _DEBUG + //Colors #ifdef _WIN32 @@ -47,29 +50,29 @@ //FG #define _COL_DEFAULT 0x00 - #define _COL_BLACK 0x1e//30 - #define _COL_RED 0x1f//31 - #define _COL_GREEN 0x20//32 + #define _COL_BLACK 0x1e//30 + #define _COL_RED 0x1f//31 + #define _COL_GREEN 0x20//32 #define _COL_YELLOW 0x21//33 - #define _COL_BLUE 0x22//34 - #define _COL_WHITE 0x25//37 + #define _COL_BLUE 0x22//34 + #define _COL_WHITE 0x25//37 //BG #define _COL_BLACK_BG 0x1e00 + 0x0a00//30 - #define _COL_RED_BG 0x1f00 + 0x0a00//31 + #define _COL_RED_BG 0x1f00 + 0x0a00//31 #define _COL_GREEN_BG 0x2000 + 0x0a00//32 #define _COL_YELLOW_BG 0x2100 + 0x0a00//33 - #define _COL_BLUE_BG 0x2200 + 0x0a00//34 + #define _COL_BLUE_BG 0x2200 + 0x0a00//34 #define _COL_WHITE_BG 0x2500 + 0x0a00//37 //MOD - #define _COL_BOLD 0x010000 + #define _COL_BOLD 0x010000 #define _COL_UNDERLINE 0x040000 - #define _COL_INVERSE 0x070000 + #define _COL_INVERSE 0x070000 //Not needed #define _COL_BOLD_OFF 21 - #define _COL_UNDERLINE_OFF 24 + #define _COL_UNDERLINE_OFF 24 #define _COL_INVERSE_OFF 27 #endif // __linux__ -- cgit v1.2.3