summaryrefslogtreecommitdiff
path: root/Makefile
blob: ded52737b83e3f77e541382ecbab650349175d69 (plain)
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
# Update 2011-10-21: object file(s) must come before LDFLAGS and -llibs ?!
# gcc version used is 4.6.1
# I think it's time to move to autotools :-(
# $@ = output file, $< = first input, $+ = all input files

ECHO	= /bin/echo -e
SHELL	= /bin/sh
RM	= /bin/rm -f

CC	= gcc
STRIP	= strip
CFLAGS	= -g -Os -I./include -I/usr/include/libxml2
CFLAGS	+= -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Wextra
CFLAGS	+= -Wunused -Wconversion

PROGS = mpd-i2c-ctrl

all:	$(PROGS)

clean:
	$(RM) src/*.o

tidy:
	$(RM) src/*.o $(PROGS)

install: $(PROGS)
	@printf "\t==> Installing progs\n"
	@install -m 0755 -d $(DESTDIR)/usr/bin
	@install -m 0755 -t $(DESTDIR)/usr/bin $(PROGS)
	@ln -s $(DESTDIR)/usr/bin/mpd-i2c-ctrl $(DESTDIR)/usr/bin/mpd-send-cmd

# Generic instructions. Dont change.
src/%.o: src/%.c
	@printf "\t--> Compiling `basename $<`\n"
	@$(CC) $(CFLAGS) -c $< -o $@

# Specific programs
mpd-i2c-ctrl:	src/mpd-i2c-ctrl.o src/socket.o
	@printf "\t==> Linking objects to output file $@\n"
	@$(CC) $(CFLAGS) $(LDFLAGS) $+ -lxml2 -o $@
	@$(STRIP) $@