File: Makefile

package info (click to toggle)
wmacpi 2.4-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 268 kB
  • sloc: ansic: 1,671; makefile: 45
file content (73 lines) | stat: -rw-r--r-- 1,701 bytes parent folder | download | duplicates (2)
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
66
67
68
69
70
71
72
73
# set options.  pick one, acpi or apm.  comment out the other one.  don't
# uncomment both, bad things will happen :)

WMACPI_VER = 2.4

OPT	:= -O2

# uncomment this to build the command line acpi tool
BUILD_CLI = 1

# uncomment this to make wmacpi use less system colors (looks uglier too)
#OPT	+= -DLOW_COLOR

# debugging options (don't bother with these)
#OPT	= -pg -g

CC	:= gcc
CFLAGS	+= $(OPT) -Wall -W -g -ansi -DWMACPI_VER='"$(WMACPI_VER)"'
LDFLAGS += $(OPT) -lX11 -ldockapp

WMSRC	:= wmacpi.c libacpi.c
HEADERS := libacpi.h
targets := wmacpi
doc_targets := wmacpi.1

ifdef BUILD_CLI
targets += wmacpi-cli
doc_targets += wmacpi-cli.1
endif

PREFIX := /usr/local

all: $(targets)

# build the list of object files
WMOBJ := $(patsubst %.c,%.o,$(filter %.c,$(WMSRC)))

# include per-file dependencies
-include $(WMOBJ:.o=.d)

wmacpi:	$(WMOBJ)
	$(CC) -o $@ $^ $(LDFLAGS)

# for the Debian package, we want to make building the command line tools
# optional. So, we hide all the necessary stuff here . . .
ifdef BUILD_CLI
CLSRC := wmacpi-cli.c libacpi.c
CLOBJ := $(patsubst %.c,%.o,$(filter %.c,$(CLSRC)))
-include $(CLOBJ:.o=.d)

wmacpi-cli: $(CLOBJ)
	$(CC) $(LDFLAGS) -o $@ $^
endif

# build per-file dependencies - note that -MM may not be supported
# in gcc versions older than 2.95.4, but most likely is.
%.d: %.c
	gcc -MM $(CFLAGS) $< > $@

clean:
	rm -f TAGS *.o *~ trace *.out *.bb *.bbg
	rm -f *.d $(targets)

clean-all: clean

install: $(targets)
	install -d $(DESTDIR)$(PREFIX)/bin/
	install -pc $(targets) $(DESTDIR)$(PREFIX)/bin/
	install -d $(DESTDIR)$(PREFIX)/share/man/man1/
	install -pc $(doc_targets) $(DESTDIR)$(PREFIX)/share/man/man1/

tags:
	etags $(WMSRC) $(CLSRC) $(HEADERS)