From eda5bc26f44ee9a6f83dcf8c91f17296d7fc509d Mon Sep 17 00:00:00 2001 From: Nao Pross Date: Mon, 12 Feb 2024 14:52:43 +0100 Subject: Move into version control --- Makefile | 78 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 Makefile (limited to 'Makefile') diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..3c24719 --- /dev/null +++ b/Makefile @@ -0,0 +1,78 @@ +EXE := fsisotool + +CXX := c++ +CXXFLAGS := -std=c++11 -Isrc -Isrc/imgui -Isrc/implot -Isrc/imgui/backends -Isrc/armadillo/include # -I src/slycot +CXXFLAGS += -g -Wall -Wformat +LIBS := + +# FOR := gfortran +# FORFLAGS := -lstdc++ -static-libgfortran + +SOURCES_CPP := src/main.cpp \ + src/control.h \ + src/control.cpp \ + src/graphics.h \ + src/graphics.cpp \ + $(wildcard src/implot/*.cpp) \ + $(wildcard src/implot/*.h) \ + $(wildcard src/imgui/*.cpp) \ + $(wildcard src/imgui/*.h) \ + src/imgui/backends/imgui_impl_opengl3.h \ + src/imgui/backends/imgui_impl_glfw.h \ + src/imgui/backends/imgui_impl_glfw.cpp \ + src/imgui/backends/imgui_impl_opengl3_loader.h \ + src/imgui/backends/imgui_impl_opengl3.cpp \ + $(wildcard src/armadillo/*.cpp) + # $(wildcard src/slycot/*.cpp) \ + # $(wildcard src/slycot/*.h) \ + +# SOURCES_F := $(wildcard src/slycot/*.f) + +OBJS := $(subst src, build, $(addsuffix .o, $(basename $(filter %.cpp, $(SOURCES_CPP))))) +# OBJS += $(subst src, build, $(addsuffix .o, $(basename $(filter %.f, $(SOURCES_F))))) + +UNAME_S := $(shell uname -s) +LINUX_GL_LIBS = -lGL + +ifeq ($(UNAME_S), Linux) #LINUX + ECHO_MESSAGE = "Linux" + LIBS += $(LINUX_GL_LIBS) `pkg-config --static --libs glfw3` + CXXFLAGS += `pkg-config --cflags glfw3` +endif + +ifeq ($(UNAME_S), Darwin) #APPLE + ECHO_MESSAGE = "Mac OS X" + LIBS += -framework OpenGL -framework Cocoa -framework IOKit -framework CoreVideo -framework Accelerate + LIBS += -L/usr/local/lib -L/opt/local/lib -L/opt/homebrew/lib # -L/opt/homebrew/lib/gcc/current + LIBS += -lglfw -llapack # -lgfortran + CXXFLAGS += -I/usr/local/include -I/opt/local/include -I/opt/homebrew/include +endif + +ifeq ($(OS), Windows_NT) + ECHO_MESSAGE = "MinGW" + LIBS += -lglfw3 -lgdi32 -lopengl32 -limm32 + CXXFLAGS += `pkg-config --cflags glfw3` +endif + +.PHONY: all dir clean +all: $(EXE) + @echo Build complete for $(ECHO_MESSAGE) + +dir: + mkdir -p build/imgui/backends + mkdir -p build/implot + mkdir -p build/armadillo + # mkdir -p build/slycot + +clean: + rm -rdf $(EXE) $(OBJS) build + +build/%.o:src/%.cpp | dir + $(CXX) $(CXXFLAGS) -c -o $@ $< + +# build/%.o:src/%.f | dir +# $(FOR) $(FORFLAGS) -c -o $@ $< + +$(EXE): $(OBJS) + $(CXX) -o $@ $^ $(CXXFLAGS) $(LIBS) + -- cgit v1.2.1