summaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorNao Pross <np@0hm.ch>2024-02-12 14:52:43 +0100
committerNao Pross <np@0hm.ch>2024-02-12 14:52:43 +0100
commiteda5bc26f44ee9a6f83dcf8c91f17296d7fc509d (patch)
treebc2efa38ff4e350f9a111ac87065cd7ae9a911c7 /Makefile
downloadfsisotool-eda5bc26f44ee9a6f83dcf8c91f17296d7fc509d.tar.gz
fsisotool-eda5bc26f44ee9a6f83dcf8c91f17296d7fc509d.zip
Move into version control
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile78
1 files changed, 78 insertions, 0 deletions
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)
+