annotate Makefile @ 7:56a7ed833d0a

allow overriding CFLAGS add automatic target dependencies to makefile add install target to Makefile minor makefile fixes
author Guido Berhoerster <guido@berhoerster.name>
date Tue, 11 Oct 2011 17:07:49 +0200
parents 7539e6e1c299
children 58a3312a1c59
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7
56a7ed833d0a allow overriding CFLAGS
Guido Berhoerster <guido@berhoerster.name>
parents: 6
diff changeset
1 INSTALL := install
56a7ed833d0a allow overriding CFLAGS
Guido Berhoerster <guido@berhoerster.name>
parents: 6
diff changeset
2 INSTALL.exec := $(INSTALL) -D -m 0755
56a7ed833d0a allow overriding CFLAGS
Guido Berhoerster <guido@berhoerster.name>
parents: 6
diff changeset
3 INSTALL.data := $(INSTALL) -D -m 0644
56a7ed833d0a allow overriding CFLAGS
Guido Berhoerster <guido@berhoerster.name>
parents: 6
diff changeset
4 SED := sed
56a7ed833d0a allow overriding CFLAGS
Guido Berhoerster <guido@berhoerster.name>
parents: 6
diff changeset
5
56a7ed833d0a allow overriding CFLAGS
Guido Berhoerster <guido@berhoerster.name>
parents: 6
diff changeset
6 DESTDIR ?=
56a7ed833d0a allow overriding CFLAGS
Guido Berhoerster <guido@berhoerster.name>
parents: 6
diff changeset
7 prefix ?= /usr/local
56a7ed833d0a allow overriding CFLAGS
Guido Berhoerster <guido@berhoerster.name>
parents: 6
diff changeset
8 bindir ?= $(prefix)/bin
56a7ed833d0a allow overriding CFLAGS
Guido Berhoerster <guido@berhoerster.name>
parents: 6
diff changeset
9 sysconfdir ?= /etc
56a7ed833d0a allow overriding CFLAGS
Guido Berhoerster <guido@berhoerster.name>
parents: 6
diff changeset
10 xdgautostartdir ?= $(sysconfdir)/xdg/autostart
0
f5e03fc667f8 initial commit
Pavol Rusnak <stick@gk2.sk>
parents:
diff changeset
11
7
56a7ed833d0a allow overriding CFLAGS
Guido Berhoerster <guido@berhoerster.name>
parents: 6
diff changeset
12 PACKAGE = pk-update-icon
56a7ed833d0a allow overriding CFLAGS
Guido Berhoerster <guido@berhoerster.name>
parents: 6
diff changeset
13 VERSION = 0.1
56a7ed833d0a allow overriding CFLAGS
Guido Berhoerster <guido@berhoerster.name>
parents: 6
diff changeset
14 OBJS = main.o notify.o packagekit.o
56a7ed833d0a allow overriding CFLAGS
Guido Berhoerster <guido@berhoerster.name>
parents: 6
diff changeset
15 AUTOSTART_FILE = $(PACKAGE).desktop
56a7ed833d0a allow overriding CFLAGS
Guido Berhoerster <guido@berhoerster.name>
parents: 6
diff changeset
16 CPPFLAGS := $(shell pkg-config --cflags gtk+-2.0 libnotify packagekit-glib2) \
56a7ed833d0a allow overriding CFLAGS
Guido Berhoerster <guido@berhoerster.name>
parents: 6
diff changeset
17 -DI_KNOW_THE_PACKAGEKIT_GLIB2_API_IS_SUBJECT_TO_CHANGE
56a7ed833d0a allow overriding CFLAGS
Guido Berhoerster <guido@berhoerster.name>
parents: 6
diff changeset
18 LDLIBS := $(shell pkg-config --libs gtk+-2.0 libnotify packagekit-glib2)
0
f5e03fc667f8 initial commit
Pavol Rusnak <stick@gk2.sk>
parents:
diff changeset
19
7
56a7ed833d0a allow overriding CFLAGS
Guido Berhoerster <guido@berhoerster.name>
parents: 6
diff changeset
20 .DEFAULT_TARGET = all
56a7ed833d0a allow overriding CFLAGS
Guido Berhoerster <guido@berhoerster.name>
parents: 6
diff changeset
21
56a7ed833d0a allow overriding CFLAGS
Guido Berhoerster <guido@berhoerster.name>
parents: 6
diff changeset
22 .PHONY: all clean install
56a7ed833d0a allow overriding CFLAGS
Guido Berhoerster <guido@berhoerster.name>
parents: 6
diff changeset
23
56a7ed833d0a allow overriding CFLAGS
Guido Berhoerster <guido@berhoerster.name>
parents: 6
diff changeset
24 all: $(PACKAGE)
56a7ed833d0a allow overriding CFLAGS
Guido Berhoerster <guido@berhoerster.name>
parents: 6
diff changeset
25
56a7ed833d0a allow overriding CFLAGS
Guido Berhoerster <guido@berhoerster.name>
parents: 6
diff changeset
26 $(PACKAGE): $(OBJS)
56a7ed833d0a allow overriding CFLAGS
Guido Berhoerster <guido@berhoerster.name>
parents: 6
diff changeset
27 $(LINK.o) $^ $(LDLIBS) -o $@
0
f5e03fc667f8 initial commit
Pavol Rusnak <stick@gk2.sk>
parents:
diff changeset
28
f5e03fc667f8 initial commit
Pavol Rusnak <stick@gk2.sk>
parents:
diff changeset
29 %.o: %.c
7
56a7ed833d0a allow overriding CFLAGS
Guido Berhoerster <guido@berhoerster.name>
parents: 6
diff changeset
30 $(COMPILE.c) -MD -o $@ $<
56a7ed833d0a allow overriding CFLAGS
Guido Berhoerster <guido@berhoerster.name>
parents: 6
diff changeset
31 @cp $*.d $*.P; \
56a7ed833d0a allow overriding CFLAGS
Guido Berhoerster <guido@berhoerster.name>
parents: 6
diff changeset
32 $(SED) -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \
56a7ed833d0a allow overriding CFLAGS
Guido Berhoerster <guido@berhoerster.name>
parents: 6
diff changeset
33 -e '/^$$/ d' -e 's/$$/ :/' < $*.d >> $*.P; \
56a7ed833d0a allow overriding CFLAGS
Guido Berhoerster <guido@berhoerster.name>
parents: 6
diff changeset
34 rm -f $*.d
56a7ed833d0a allow overriding CFLAGS
Guido Berhoerster <guido@berhoerster.name>
parents: 6
diff changeset
35
56a7ed833d0a allow overriding CFLAGS
Guido Berhoerster <guido@berhoerster.name>
parents: 6
diff changeset
36 install:
56a7ed833d0a allow overriding CFLAGS
Guido Berhoerster <guido@berhoerster.name>
parents: 6
diff changeset
37 $(INSTALL.exec) $(PACKAGE) $(DESTDIR)$(bindir)/$(PACKAGE)
56a7ed833d0a allow overriding CFLAGS
Guido Berhoerster <guido@berhoerster.name>
parents: 6
diff changeset
38 $(INSTALL.data) $(AUTOSTART_FILE) \
56a7ed833d0a allow overriding CFLAGS
Guido Berhoerster <guido@berhoerster.name>
parents: 6
diff changeset
39 $(DESTDIR)$(xdgautostartdir)/$(AUTOSTART_FILE)
0
f5e03fc667f8 initial commit
Pavol Rusnak <stick@gk2.sk>
parents:
diff changeset
40
f5e03fc667f8 initial commit
Pavol Rusnak <stick@gk2.sk>
parents:
diff changeset
41 clean:
7
56a7ed833d0a allow overriding CFLAGS
Guido Berhoerster <guido@berhoerster.name>
parents: 6
diff changeset
42 -rm -f $(PACKAGE) $(OBJS)
56a7ed833d0a allow overriding CFLAGS
Guido Berhoerster <guido@berhoerster.name>
parents: 6
diff changeset
43
56a7ed833d0a allow overriding CFLAGS
Guido Berhoerster <guido@berhoerster.name>
parents: 6
diff changeset
44 -include $(patsubst %.o,%.P,$(OBJS))