aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--makefile33
2 files changed, 25 insertions, 9 deletions
diff --git a/.gitignore b/.gitignore
index 9883dd6..d0c1c13 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,5 +1,6 @@
__pycache__
obj/*.o
+bin/
a.out
a.exe
satscalc
diff --git a/makefile b/makefile
index c86d5af..0785786 100644
--- a/makefile
+++ b/makefile
@@ -8,7 +8,13 @@ CXX = g++
# Enabling C++17 mode so I can have more <algorithm> stuff
CVERSION=-std=c++17
-CFLAGS=
+# Native compilation flags and crosscompilation flags for Windows
+CFLAGS=-g
+WINFLAGS=-g -gcodeview
+
+# Executable name stuff
+V=v0.2.0-alpha
+NAME=satscalc
# LIBDIR is where you can find the linkable objects or whatever. They are used for the linking stage.
# -L /usr/lib/x86_64-linux-gnu/
@@ -25,26 +31,35 @@ OBJECTS=$(patsubst src/%.cpp, $(OBJDIR)%.o, $(SOURCES))
# This last line creates an identical list of objects based on the list of .cpp files.
a.out: $(OBJECTS)
- $(CXX) $(LIBDIR) $(CVERSION) $(CFLAGS) $(LIBS) $(OBJECTS) -o satscalc
+ $(CXX) $(LIBDIR) $(CVERSION) $(LIBS) $(OBJECTS) -o $(NAME)
$(OBJECTS): obj/%.o : src/%.cpp
mkdir -p $(OBJDIR)
- $(CXX) -g $(INCLUDE) $(CVERSION) $(CFLAGS) -c $< -o $@
+ $(CXX) $(CFLAGS) $(INCLUDE) $(CVERSION) $(CFLAGS) -c $< -o $@
windows:
- zig c++ -target x86_64-windows-gnu src/*.cpp $(CVERSION) -g -gcodeview -o satscalc.exe
+ zig c++ -target x86_64-windows-gnu src/*.cpp $(CVERSION) $(WINFLAGS) -o $(NAME).exe
windows32:
- zig c++ -target i386-windows-gnu src/*.cpp $(CVERSION) -g -gcodeview -o satscalc32.exe
+ zig c++ -target i386-windows-gnu src/*.cpp $(CVERSION) $(WINFLAGS) -o $(NAME).exe
mac:
- zig c++ -target x86_64-macos-gnu src/*.cpp $(CVERSION) -g -gcodeview -o satscalc
-
+ zig c++ -target x86_64-macos-gnu src/*.cpp $(CVERSION) $(CFLAGS) -o $(NAME)
+
+release:
+ mkdir -p bin/linux
+ make CFLAGS=-O2 NAME=bin/linux/$(NAME)-$(V)
+ mkdir -p bin/mac
+ make mac CFLAGS=-O2 NAME=bin/mac/$(NAME)-$(V)
+ mkdir -p bin/windows
+ make windows WINFLAGS="-O2 --static" NAME=bin/windows/$(NAME)-$(V)
+ make windows32 WINFLAGS="-O2 --static" NAME=bin/windows/$(NAME)-$(V)-win32
+
clean:
- rm obj/*.o
+ rm -f obj/*.o
cleanall:
- rm obj/*.o a.out
+ rm -rf obj/*.o bin/ $(NAME)
install: a.out
cp satscalc /usr/local/bin/satscalc