summaryrefslogtreecommitdiff
path: root/build/dependencies.mk
blob: fa10af4fca694a3372b61b61778438b579090fd8 (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
43
44
45
46
47
48
49
50
51
52
# Dependency management for GlaMaC
# This file contains rules for installing and managing dependencies

# Automatic dependency generation for source files
GLAMAC_DEPS := $(GLAMAC_SRCS:.c=.d)
GLAUTILS_DEPS := $(GLAUTILS_SRCS:.c=.d)
ALL_DEPS := $(GLAMAC_DEPS) $(GLAUTILS_DEPS)

# Include generated dependencies (suppress errors if files don't exist yet)
-include $(ALL_DEPS)

# Rule to generate dependency files
%.d: %.c
	@$(CC) -MM $(CFLAGS) $< | sed 's|\(.*\)\.o[ ]*:|\1.o \1.d:|' > $@

# Clean dependency files
clean-deps-files:
	$(RM) $(ALL_DEPS)

# Add dependency files to clean targets
.PHONY: clean-deps-files

# Dependency management
deps:
ifeq ($(PLATFORM),linux)
	@echo "Installing dependencies..."
	sudo pacman -S --needed sdl3 git cmake pkgconf freetype2 python python-pandas python-openpyxl
	@echo "Building SDL3_ttf from source..."
	cd /tmp && $(RM) -rf SDL_ttf && \
	git clone https://github.com/libsdl-org/SDL_ttf.git && \
	cd SDL_ttf && git checkout release-3.2.2 && \
	cmake -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr && \
	make -C build -j$$(nproc) && sudo make -C build install && \
	sudo ldconfig
	@echo "Dependencies installed!"
else
	@echo "Install SDL3 development libraries manually on Windows."
	@echo "Install Python with pandas and openpyxl for Excel conversion."
endif

clean-deps:
ifeq ($(PLATFORM),linux)
	@echo "Removing SDL3 dependencies..."
	sudo pacman -R sdl3 --noconfirm 2>/dev/null || true
	sudo $(RM) -f /usr/lib/libSDL3_ttf.so* /usr/lib/libSDL3_ttf.a /usr/lib/pkgconfig/SDL3_ttf.pc
	sudo $(RMDIR) /usr/include/SDL3_ttf/ 2>/dev/null || true
	sudo ldconfig
	@echo "Dependencies removed!"
endif

# Dependency-related phony targets
.PHONY: deps clean-deps
Back to https://optics-design.com