root/i2c-tools/trunk/tools/Makefile @ 4499

Revision 4499, 2.0 KB (checked in by khali, 7 years ago)

Show more warnings, and fix them.

Line 
1# I2C tools for Linux
2#
3# Copyright (C) 2007  Jean Delvare <khali@linux-fr.org>
4#
5# Licensed under the GNU Public License.
6
7CC      = gcc
8CFLAGS  = -Wall -Wstrict-prototypes -Wshadow -Wpointer-arith -Wcast-qual \
9          -Wcast-align -Wwrite-strings -Wnested-externs -Winline -W \
10          -Wundef -Wmissing-prototypes -I../include
11
12CFLAGS  += -O2
13# When debugging, use the following instead
14#CFLAGS += -O -g
15
16# Pass linker flags here
17LDFLAGS =
18
19DESTDIR =
20prefix  = /usr/local
21sbindir = $(prefix)/sbin
22mandir  = $(prefix)/share/man
23man8dir = $(mandir)/man8
24
25INSTALL         := install
26INSTALL_DATA    := $(INSTALL) -m 644
27INSTALL_DIR     := $(INSTALL) -m 755 -d
28INSTALL_PROGRAM := $(INSTALL) -m 755
29RM              := rm -f
30
31PROGRAMS        := i2cdetect i2cdump i2cset i2cget
32
33all : $(PROGRAMS)
34
35#
36# Programs
37#
38
39i2cdetect : i2cdetect.o i2cbusses.o
40        $(CC) $(LDFLAGS) -o $@ $^
41
42i2cdump : i2cdump.o i2cbusses.o util.o
43        $(CC) $(LDFLAGS) -o $@ $^
44
45i2cset : i2cget.o i2cbusses.o util.o
46        $(CC) $(LDFLAGS) -o $@ $^
47
48i2cget : i2cset.o i2cbusses.o util.o
49        $(CC) $(LDFLAGS) -o $@ $^
50
51#
52# Objects
53#
54
55i2cdetect.o : i2cdetect.c i2cbusses.h
56        $(CC) $(CFLAGS) -c $< -o $@
57
58i2cdump.o : i2cdump.c i2cbusses.h util.h
59        $(CC) $(CFLAGS) -c $< -o $@
60
61i2cset.o : i2cset.c i2cbusses.h util.h
62        $(CC) $(CFLAGS) -c $< -o $@
63
64i2cget.o : i2cget.c i2cbusses.h util.h
65        $(CC) $(CFLAGS) -c $< -o $@
66
67i2cbusses.o : i2cbusses.c i2cbusses.h
68        $(CC) $(CFLAGS) -c $< -o $@
69
70util.o : util.c util.h
71        $(CC) $(CFLAGS) -c $< -o $@
72
73#
74# Commands
75#
76
77strip : $(PROGRAMS)
78        strip $(PROGRAMS)
79
80install : install-bin install-man
81
82uninstall : uninstall-bin uninstall-man
83
84install-bin : $(PROGRAMS)
85        $(INSTALL_DIR) $(DESTDIR)$(sbindir)
86        for program in $(PROGRAMS) ; do \
87        $(INSTALL_PROGRAM) $$program $(DESTDIR)$(sbindir) ; done
88
89uninstall-bin :
90        for program in $(PROGRAMS) ; do \
91        $(RM) $(DESTDIR)$(sbindir)/$$program ; done
92
93install-man :
94        $(INSTALL_DIR) $(DESTDIR)$(man8dir)
95        for program in $(PROGRAMS) ; do \
96        $(INSTALL_DATA) $$program.8 $(DESTDIR)$(man8dir) ; done
97
98uninstall-man :
99        for program in $(PROGRAMS) ; do \
100        $(RM) $(DESTDIR)$(man8dir)/$$program.8 ; done
101
102clean :
103        $(RM) *.o $(PROGRAMS) core
Note: See TracBrowser for help on using the browser.