-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathGNUmakefile
More file actions
63 lines (49 loc) · 1.38 KB
/
GNUmakefile
File metadata and controls
63 lines (49 loc) · 1.38 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
PREFIX ?= /usr/local
GENERATED_MAKEFILE := $(wildcard Makefile)
.PHONY: distclean
distclean:
@if [ -f Makefile ]; then \
echo "Running make distclean..."; \
$(MAKE) -f Makefile distclean 2>/dev/null || true; \
fi
@echo "Removing autotools generated files..."
@rm -rf Makefile Makefile.in configure config.* libtool aclocal.m4 stamp-h1 autom4te.cache
@rm -rf compile config.guess config.sub depcomp install-sh ltmain.sh missing
@rm -rf .libs .deps src/.libs src/.deps
@rm -f *.lo *.la src/*.lo src/*.la
@echo "All generated files removed. Run 'make' to rebuild."
# If Makefile exists, delegate to it
ifneq ($(GENERATED_MAKEFILE),)
.DEFAULT_GOAL := all
%:
$(MAKE) -f Makefile $@
else
# No Makefile - need to generate build system
.DEFAULT_GOAL := all
configure: configure.ac Makefile.am
@echo "Generating build system..."
@which glibtoolize > /dev/null 2>&1 && glibtoolize --copy --force --quiet || libtoolize --copy --force --quiet
@aclocal
@autoheader
@automake --add-missing --copy --foreign
@autoconf
@echo ""
Makefile: configure
@echo "Running configure..."
@./configure --prefix=$(PREFIX)
@echo ""
.PHONY: all
all: Makefile
@$(MAKE) -f Makefile all
@echo ""
@echo "Build complete. Install with: make install"
@echo ""
.PHONY: build
build: all
.PHONY: install
install: Makefile
@$(MAKE) -f Makefile install
.PHONY: clean
clean: Makefile
@$(MAKE) -f Makefile clean
endif