diff --git a/Doxyfile b/Doxyfile index a30c9c3..cbc2586 100644 --- a/Doxyfile +++ b/Doxyfile @@ -668,7 +668,7 @@ WARN_LOGFILE = # directories like "/usr/src/myproject". Separate the files or directories # with spaces. -INPUT = +INPUT = src/ # This tag can be used to specify the character encoding of the source files # that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is diff --git a/Makefile b/Makefile index 49933af..093b938 100644 --- a/Makefile +++ b/Makefile @@ -1,54 +1,5 @@ -# compiler, tools -CC = clang -PKG_CONFIG ?= pkg-config - -# flags -CFLAGS ?= -march=native -O2 -pipe -CFLAGS += -std=c99 -pedantic -Wall -Wextra -Werror -Wno-unused-variable -Wno-unused-parameter -Wno-unused-function -ifeq ($(shell $(CC) -v 2>&1 | grep 'gcc version' &>/dev/null && echo 1),1) -CFLAGS += -Wno-unused-but-set-variable -endif -LDFLAGS ?= -Wl,-O1 -Wl,--as-needed -Wl,--hash-style=gnu - -ifndef NODEBUG -CFLAGS += -O0 -g3 -endif - -TARGET = drow-engine -HEADERS = err.h parser.h types.h print.h filereader.h gl_draw.h -OBJECTS = main.o parser.o print.o filereader.o gl_draw.c -INCS = -I. - -CFLAGS += $(shell $(PKG_CONFIG) --cflags gl glu glib-2.0) -LIBS = $(shell $(PKG_CONFIG) --libs gl glu glib-2.0) -lglut -lm -CPPFLAGS += -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED -D_GNU_SOURCE - -# install variables -INSTALL = install -INSTALL_BIN = install -m755 -INSTALL_DIR = install -d -PREFIX = /usr/local -LIBDIR = lib64 -INSTALL_BINDIR = $(PREFIX)/bin -INSTALL_LIBDIR = $(PREFIX)/$(LIBDIR) - -%.o: %.c - $(CC) $(CFLAGS) $(CPPFLAGS) $(INCS) -c $*.c - -all: $(TARGET) - -$(TARGET): $(HEADERS) $(OBJECTS) - $(CC) $(CFLAGS) $(CPPFLAGS) $(INCS) -o $(TARGET) $(OBJECTS) $(LDFLAGS) $(LIBS) - -install: - $(INSTALL_DIR) "$(DESTDIR)$(INSTALL_BINDIR)" - $(INSTALL_BIN) $(TARGET) "$(DESTDIR)$(INSTALL_BINDIR)" - -uninstall: - rm "$(DESTDIR)$(INSTALL_BINDIR)/$(TARGET)" - -clean: - rm -f *.o $(TARGET) core vgcore* +all: + $(MAKE) -C src all doc: doxygen @@ -56,4 +7,15 @@ doc: doc-pdf: doc $(MAKE) -C latex pdf -.PHONY: clean install doc doc-pdf +clean: + $(MAKE) -C src clean + rm -rf drown-engine + +install: + $(MAKE) -C install + +uninstall: + $(MAKE) -C uninstall + + +.PHONY: all doc doc-pdf clean install uninstall diff --git a/Briliant_simple.obj b/obj/Briliant_simple.obj similarity index 100% rename from Briliant_simple.obj rename to obj/Briliant_simple.obj diff --git a/testcube_mitSpitze.obj b/obj/testcube_mitSpitze.obj similarity index 100% rename from testcube_mitSpitze.obj rename to obj/testcube_mitSpitze.obj diff --git a/testcube_trans.obj b/obj/testcube_trans.obj similarity index 100% rename from testcube_trans.obj rename to obj/testcube_trans.obj diff --git a/src/Makefile b/src/Makefile new file mode 100644 index 0000000..59007ee --- /dev/null +++ b/src/Makefile @@ -0,0 +1,54 @@ +# compiler, tools +CC = clang +PKG_CONFIG ?= pkg-config + +# flags +CFLAGS ?= -march=native -O2 -pipe +CFLAGS += -std=c99 -pedantic -Wall -Wextra -Werror -Wno-unused-variable -Wno-unused-parameter -Wno-unused-function +ifeq ($(shell $(CC) -v 2>&1 | grep 'gcc version' &>/dev/null && echo 1),1) +CFLAGS += -Wno-unused-but-set-variable +endif +LDFLAGS ?= -Wl,-O1 -Wl,--as-needed -Wl,--hash-style=gnu + +ifndef NODEBUG +CFLAGS += -O0 -g3 +endif + +TARGET = drow-engine +HEADERS = err.h parser.h types.h print.h filereader.h gl_draw.h +OBJECTS = main.o parser.o print.o filereader.o gl_draw.c +INCS = -I. + +CFLAGS += $(shell $(PKG_CONFIG) --cflags gl glu glib-2.0) +LIBS = $(shell $(PKG_CONFIG) --libs gl glu glib-2.0) -lglut -lm +CPPFLAGS += -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED -D_GNU_SOURCE + +# install variables +INSTALL = install +INSTALL_BIN = install -m755 +INSTALL_DIR = install -d +PREFIX = /usr/local +LIBDIR = lib64 +INSTALL_BINDIR = $(PREFIX)/bin +INSTALL_LIBDIR = $(PREFIX)/$(LIBDIR) + +%.o: %.c + $(CC) $(CFLAGS) $(CPPFLAGS) $(INCS) -c $*.c + +all: $(TARGET) + +$(TARGET): $(HEADERS) $(OBJECTS) + $(CC) $(CFLAGS) $(CPPFLAGS) $(INCS) -o ../$(TARGET) $(OBJECTS) $(LDFLAGS) $(LIBS) + +install: $(TARGET) + $(INSTALL_DIR) "$(DESTDIR)$(INSTALL_BINDIR)" + $(INSTALL_BIN) $(TARGET) "$(DESTDIR)$(INSTALL_BINDIR)" + +uninstall: + rm "$(DESTDIR)$(INSTALL_BINDIR)/$(TARGET)" + +clean: + rm -f *.o $(TARGET) core vgcore* + + +.PHONY: all clean install uninstall diff --git a/err.h b/src/err.h similarity index 100% rename from err.h rename to src/err.h diff --git a/filereader.c b/src/filereader.c similarity index 100% rename from filereader.c rename to src/filereader.c diff --git a/filereader.h b/src/filereader.h similarity index 100% rename from filereader.h rename to src/filereader.h diff --git a/gl_draw.c b/src/gl_draw.c similarity index 100% rename from gl_draw.c rename to src/gl_draw.c diff --git a/gl_draw.h b/src/gl_draw.h similarity index 100% rename from gl_draw.h rename to src/gl_draw.h diff --git a/main.c b/src/main.c similarity index 100% rename from main.c rename to src/main.c diff --git a/parser.c b/src/parser.c similarity index 100% rename from parser.c rename to src/parser.c diff --git a/parser.h b/src/parser.h similarity index 100% rename from parser.h rename to src/parser.h diff --git a/print.c b/src/print.c similarity index 100% rename from print.c rename to src/print.c diff --git a/print.h b/src/print.h similarity index 100% rename from print.h rename to src/print.h diff --git a/types.h b/src/types.h similarity index 100% rename from types.h rename to src/types.h