summaryrefslogtreecommitdiff
path: root/build/native.mk
blob: e4495d5476bbc0809c67a0e44e995488775a1d35 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# Native build rules for GlaMaC
# This file contains rules for building on the native platform (Linux/Windows)

# Default target
all: glamac glautils

# Native build targets
glamac: $(BINDIR)/glamac$(EXE_EXT)

glautils: $(GLAUTILS_BINS)

$(BINDIR)/glamac$(EXE_EXT): $(GLAMAC_SRCS) | $(BINDIR)
	@echo "Building glamac..."
	$(CC) $^ $(CFLAGS_NATIVE) $(SDL3_LIBS) -o $@

# Special rule for fgla which needs glass_data dependencies
$(BINDIR)/fgla$(EXE_EXT): $(SRCDIR)/glautils/fgla.c $(GLASS_DATA_SRCS) | $(BINDIR)
	$(CC) $^ $(CFLAGS_NATIVE) -o $@

# General rule for other glautils (excluding fgla)
$(BINDIR)/%$(EXE_EXT): $(SRCDIR)/glautils/%.c | $(BINDIR)
	$(CC) $< $(CFLAGS_NATIVE) -o $@

# Excel to JSON conversion
EXCEL_FILES := $(wildcard ../data/Excel/*.xlsx)
JSON_FILES := $(patsubst ../data/Excel/%.xlsx, ../data/JSON/%.json, $(EXCEL_FILES))

convert-catalogs: $(JSON_FILES)

../data/JSON/%.json: ../data/Excel/%.xlsx ../scripts/excel_to_json.py
	@echo "Converting $< to JSON..."
	@$(MKDIR) ../data/JSON
	@cd .. && python3 scripts/excel_to_json.py $< -o $@

# Cleanup
clean: clean-deps-files
	$(RMDIR) $(BINDIR) 2>/dev/null || true

rebuild: clean all

# Build-related phony targets
.PHONY: all glamac glautils convert-catalogs clean rebuild
Back to https://optics-design.com