write a makefile and compile it

This commit is contained in:
Christoph J. Scherr 2025-03-12 13:25:40 +01:00
parent 4b6dd78dbf
commit 90307d2527
Signed by: PlexSheep
GPG key ID: 9EB784BB202BB7BB
2 changed files with 43 additions and 0 deletions

1
.gitignore vendored Normal file
View file

@ -0,0 +1 @@
bin

42
Makefile Normal file
View file

@ -0,0 +1,42 @@
# Makefile for 'Kaiser Operating System (KOS)' (cringe) and my first calculator app
# This makefile is not part of the original files.
# Compiler
CXX = g++
# Compiler flags
CXXFLAGS = -Wall -Wextra -std=c++11 -Ifiles
# Executables
CALCULATOR = $(BIN)/calculator
KOS = $(BIN)/kos
# Source files
CALCULATOR_SRC = files/calculator.cxx
KOS_SRC = files/KOS.cpp
# Header files
HEADERS = files/calculator.h files/KOSFunctions.h files/KOSVariables.h
BIN = ./bin
# Default target
all: $(CALCULATOR) $(KOS)
$(BIN):
mkdir -p $(BIN)
# Calculator executable
$(CALCULATOR): $(CALCULATOR_SRC) $(HEADERS) $(BIN)
$(CXX) $(CXXFLAGS) -o $@ $<
# KOS executable
$(KOS): $(KOS_SRC) $(HEADERS)
$(CXX) $(CXXFLAGS) -o $@ $<
# Clean up
clean:
rm -f $(CALCULATOR) $(KOS)
rm -rf $(BIN)
.PHONY: all clean