fortrangoingonforty/fortbite / 45b2a91

Browse files

build things

Authored by espadonne
SHA
45b2a91f93aafee8fbf8df2fe28e36b404843acf
Parents
9816bbb
Tree
7398ceb

2 changed files

StatusFile+-
A Makefile 72 0
A fpm.toml 40 0
Makefileadded
@@ -0,0 +1,72 @@
1
+# Makefile for FORTBITE - Modern Fortran Calculator
2
+# Author: espadonne (mfw)
3
+
4
+# Compiler and flags
5
+FC = gfortran
6
+FFLAGS = -Wall -Wextra -fcheck=all -g -O2 -std=f2008
7
+LDFLAGS = 
8
+LIBS = 
9
+
10
+# Directories
11
+SRCDIR = src
12
+BUILDDIR = build
13
+MODDIR = $(BUILDDIR)/mod
14
+BINDIR = $(BUILDDIR)/bin
15
+
16
+# Target executable
17
+TARGET = $(BINDIR)/fortbite
18
+
19
+# Source files (order matters for dependencies)
20
+SOURCES = $(SRCDIR)/fortbite_precision_m.f90 \
21
+          $(SRCDIR)/fortbite_types_m.f90 \
22
+          $(SRCDIR)/fortbite_arithmetic_m.f90 \
23
+          $(SRCDIR)/fortbite_io_m.f90 \
24
+          $(SRCDIR)/fortbite.f90
25
+
26
+# Object files
27
+OBJECTS = $(SOURCES:$(SRCDIR)/%.f90=$(BUILDDIR)/%.o)
28
+
29
+# Default target
30
+all: directories $(TARGET)
31
+
32
+# Create necessary directories
33
+directories:
34
+	@mkdir -p $(BUILDDIR) $(MODDIR) $(BINDIR)
35
+
36
+# Link the executable
37
+$(TARGET): $(OBJECTS)
38
+	$(FC) $(LDFLAGS) -J$(MODDIR) -o $@ $^ $(LIBS)
39
+	@echo "Built FORTBITE successfully!"
40
+
41
+# Compile Fortran source files
42
+$(BUILDDIR)/%.o: $(SRCDIR)/%.f90
43
+	$(FC) $(FFLAGS) -J$(MODDIR) -c $< -o $@
44
+
45
+# Dependencies (manually specified for now)
46
+$(BUILDDIR)/fortbite_types_m.o: $(BUILDDIR)/fortbite_precision_m.o
47
+$(BUILDDIR)/fortbite_arithmetic_m.o: $(BUILDDIR)/fortbite_precision_m.o $(BUILDDIR)/fortbite_types_m.o
48
+$(BUILDDIR)/fortbite_io_m.o: $(BUILDDIR)/fortbite_precision_m.o $(BUILDDIR)/fortbite_types_m.o
49
+$(BUILDDIR)/fortbite.o: $(BUILDDIR)/fortbite_precision_m.o $(BUILDDIR)/fortbite_types_m.o $(BUILDDIR)/fortbite_io_m.o
50
+
51
+# Clean up
52
+clean:
53
+	rm -rf $(BUILDDIR)
54
+
55
+# Run the program
56
+run: $(TARGET)
57
+	./$(TARGET)
58
+
59
+# Install (optional)
60
+install: $(TARGET)
61
+	cp $(TARGET) /usr/local/bin/fortbite
62
+
63
+# Help
64
+help:
65
+	@echo "FORTBITE Makefile targets:"
66
+	@echo "  all      - Build the executable (default)"
67
+	@echo "  clean    - Remove build files"
68
+	@echo "  run      - Build and run FORTBITE"
69
+	@echo "  install  - Install to /usr/local/bin"
70
+	@echo "  help     - Show this help message"
71
+
72
+.PHONY: all clean run install help directories
fpm.tomladded
@@ -0,0 +1,40 @@
1
+name = "fortbite"
2
+version = "1.0.0"
3
+license = "MIT"
4
+author = "espadonne (mfw)"
5
+maintainer = "espadonne@fortbite.org"
6
+copyright = "2024 FORTBITE Contributors"
7
+
8
+[build]
9
+auto-executables = true
10
+auto-tests = true
11
+auto-examples = false
12
+
13
+[fortran]
14
+implicit-typing = false
15
+implicit-external = false
16
+
17
+[dependencies]
18
+# Future dependencies for external libraries
19
+# stdlib = "*"  # Fortran Standard Library (when available)
20
+
21
+[dev-dependencies]
22
+# Test framework dependencies will go here
23
+
24
+[[executable]]
25
+name = "fortbite"
26
+source-dir = "src"
27
+main = "fortbite.f90"
28
+
29
+[[test]]
30
+name = "test-precision"
31
+source-dir = "test"
32
+main = "test_precision.f90"
33
+
34
+[[test]]
35
+name = "test-types" 
36
+source-dir = "test"
37
+main = "test_types.f90"
38
+
39
+[install]
40
+library = false