-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
47 lines (38 loc) · 1.31 KB
/
Copy pathMakefile
File metadata and controls
47 lines (38 loc) · 1.31 KB
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
# Makefile for Library Management System
# Targets:
# make console → build the console app
# make gui → build the GTK GUI app
# make all → build both
# make clean → remove build artifacts
CC = gcc
CFLAGS = -Wall -Wextra -g -Iinclude
GTK_FLAGS = $(shell pkg-config --cflags gtk+-3.0 2>/dev/null)
GTK_LIBS = $(shell pkg-config --libs gtk+-3.0 2>/dev/null)
# Common source (shared by both apps)
COMMON_SRC = src/db.c
# Console sources
CON_SRC = $(COMMON_SRC) src/console_ui.c src/main_console.c
CON_OUT = library_console
# GUI sources
GUI_SRC = $(COMMON_SRC) src/gui_ui.c src/main_gui.c
GUI_OUT = library_gui
.PHONY: all console gui clean
all: console gui
console: $(CON_SRC)
$(CC) $(CFLAGS) -o $(CON_OUT) $(CON_SRC)
@echo "✓ Console app built: ./$(CON_OUT)"
gui: $(GUI_SRC)
@if pkg-config --exists gtk+-3.0; then \
$(CC) $(CFLAGS) $(GTK_FLAGS) -o $(GUI_OUT) $(GUI_SRC) $(GTK_LIBS); \
echo "✓ GUI app built: ./$(GUI_OUT)"; \
else \
echo "✗ GTK3 not found. Install with:"; \
echo " Ubuntu/Debian: sudo apt install libgtk-3-dev"; \
echo " Fedora: sudo dnf install gtk3-devel"; \
echo " macOS: brew install gtk+3"; \
echo " Windows: use MSYS2 + mingw-w64-x86_64-gtk3"; \
exit 1; \
fi
clean:
rm -f $(CON_OUT) $(GUI_OUT)
@echo "✓ Cleaned."