-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
65 lines (52 loc) · 2.11 KB
/
Makefile
File metadata and controls
65 lines (52 loc) · 2.11 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# Makefile for building 'melonDS' RPMs from a local project directory
# Created by: gopeterjun@naver.com
# Created on: Sat 15 Nov 2025
# Last Updated: Fri 05 Dec 2025
# Define the RPM build directories
BUILD_DIRS = SPECS SOURCES BUILD RPMS SRPMS BUILDROOT
# Define the location of the spec file
SPEC_FILE = SPECS/melonDS.spec
# Define required tools to build RPM packages
REQUIRED_BINS := rpmbuild spectool
# Get the absolute path to the current directory
TOP_DIR = $(shell pwd)
TMP_DIR = $(TOP_DIR)/tmp
# Phony targets aren't actual files
.PHONY: all help scaffold sources test build clean
# Default target: build the RPM
all: build
test: check-tools
@echo "✓ All RPM build tools are available."
check-tools:
@echo "Checking for RPM build tools..."
@for bin in $(REQUIRED_BINS); do \
type $$bin >/dev/null || { echo "ERROR: $$bin not found in PATH"; exit 1; }; \
done
@echo "All required binaries found: $(REQUIRED_BINS)"
# The scaffold target creates the directory structure
scaffold:
@echo "Creating RPM build directory structure..."
@mkdir -p $(BUILD_DIRS)
@echo "Done."
# The 'sources' target downloads sources locally
sources: scaffold test
@echo "Downloading sources to $(TOP_DIR)/SOURCES..."
@spectool -g -R --define "_topdir $(TOP_DIR)" $(SPEC_FILE)
# The 'build' target builds the binary and source RPMs
build: sources
@echo "Building RPMs in $(TOP_DIR)..."
@mkdir -p $(TMP_DIR)
@rpmbuild -ba --define "_topdir $(TOP_DIR)" --define "_tmppath $(TMP_DIR)" $(SPEC_FILE)
@echo "Build complete. Find RPMs in $(TOP_DIR)/RPMS and $(TOP_DIR)/SRPMS."
# The 'clean' target removes build outputs
clean:
@echo "Cleaning build directories..."
@rm -rf BUILD BUILDROOT RPMS SRPMS
@echo "Done."
# The help target explains available commands
help:
@echo " make test - check for rpmbuild dependencies."
@echo " make scaffold - Creates the standard RPM build directories."
@echo " make sources - Downloads source tarballs into the local SOURCES directory."
@echo " make build - Builds the binary and source RPMs (default)."
@echo " make clean - Removes the BUILD, BUILDROOT, RPMS, and SRPMS directories."