root/i2c-tools/trunk/tools/Module.mk

Revision 5610, 2.7 KB (checked in by khali, 3 years ago)

List include first, so that other modules can use it.

Line 
1# I2C tools for Linux
2#
3# Copyright (C) 2007  Jean Delvare <khali@linux-fr.org>
4#
5# This program is free software; you can redistribute it and/or modify
6# it under the terms of the GNU General Public License as published by
7# the Free Software Foundation; either version 2 of the License, or
8# (at your option) any later version.
9
10TOOLS_DIR       := tools
11
12TOOLS_CFLAGS    := -Wstrict-prototypes -Wshadow -Wpointer-arith -Wcast-qual \
13                   -Wcast-align -Wwrite-strings -Wnested-externs -Winline \
14                   -W -Wundef -Wmissing-prototypes -Iinclude
15
16TOOLS_TARGETS   := i2cdetect i2cdump i2cset i2cget
17
18#
19# Programs
20#
21
22$(TOOLS_DIR)/i2cdetect: $(TOOLS_DIR)/i2cdetect.o $(TOOLS_DIR)/i2cbusses.o
23        $(CC) $(LDFLAGS) -o $@ $^
24
25$(TOOLS_DIR)/i2cdump: $(TOOLS_DIR)/i2cdump.o $(TOOLS_DIR)/i2cbusses.o $(TOOLS_DIR)/util.o
26        $(CC) $(LDFLAGS) -o $@ $^
27
28$(TOOLS_DIR)/i2cset: $(TOOLS_DIR)/i2cset.o $(TOOLS_DIR)/i2cbusses.o $(TOOLS_DIR)/util.o
29        $(CC) $(LDFLAGS) -o $@ $^
30
31$(TOOLS_DIR)/i2cget: $(TOOLS_DIR)/i2cget.o $(TOOLS_DIR)/i2cbusses.o $(TOOLS_DIR)/util.o
32        $(CC) $(LDFLAGS) -o $@ $^
33
34#
35# Objects
36#
37
38$(TOOLS_DIR)/i2cdetect.o: $(TOOLS_DIR)/i2cdetect.c $(TOOLS_DIR)/i2cbusses.h $(INCLUDE_DIR)/linux/i2c-dev.h
39        $(CC) $(CFLAGS) $(TOOLS_CFLAGS) -c $< -o $@
40
41$(TOOLS_DIR)/i2cdump.o: $(TOOLS_DIR)/i2cdump.c $(TOOLS_DIR)/i2cbusses.h $(TOOLS_DIR)/util.h $(INCLUDE_DIR)/linux/i2c-dev.h
42        $(CC) $(CFLAGS) $(TOOLS_CFLAGS) -c $< -o $@
43
44$(TOOLS_DIR)/i2cset.o: $(TOOLS_DIR)/i2cset.c $(TOOLS_DIR)/i2cbusses.h $(TOOLS_DIR)/util.h $(INCLUDE_DIR)/linux/i2c-dev.h
45        $(CC) $(CFLAGS) $(TOOLS_CFLAGS) -c $< -o $@
46
47$(TOOLS_DIR)/i2cget.o: $(TOOLS_DIR)/i2cget.c $(TOOLS_DIR)/i2cbusses.h $(TOOLS_DIR)/util.h $(INCLUDE_DIR)/linux/i2c-dev.h
48        $(CC) $(CFLAGS) $(TOOLS_CFLAGS) -c $< -o $@
49
50$(TOOLS_DIR)/i2cbusses.o: $(TOOLS_DIR)/i2cbusses.c $(TOOLS_DIR)/i2cbusses.h $(INCLUDE_DIR)/linux/i2c-dev.h
51        $(CC) $(CFLAGS) $(TOOLS_CFLAGS) -c $< -o $@
52
53$(TOOLS_DIR)/util.o: $(TOOLS_DIR)/util.c $(TOOLS_DIR)/util.h
54        $(CC) $(CFLAGS) $(TOOLS_CFLAGS) -c $< -o $@
55
56#
57# Commands
58#
59
60all-tools: $(addprefix $(TOOLS_DIR)/,$(TOOLS_TARGETS))
61
62strip-tools: $(addprefix $(TOOLS_DIR)/,$(TOOLS_TARGETS))
63        strip $(addprefix $(TOOLS_DIR)/,$(TOOLS_TARGETS))
64
65clean-tools:
66        $(RM) $(addprefix $(TOOLS_DIR)/,*.o $(TOOLS_TARGETS))
67
68install-tools: $(addprefix $(TOOLS_DIR)/,$(TOOLS_TARGETS))
69        $(INSTALL_DIR) $(DESTDIR)$(sbindir) $(DESTDIR)$(man8dir)
70        for program in $(TOOLS_TARGETS) ; do \
71        $(INSTALL_PROGRAM) $(TOOLS_DIR)/$$program $(DESTDIR)$(sbindir) ; \
72        $(INSTALL_DATA) $(TOOLS_DIR)/$$program.8 $(DESTDIR)$(man8dir) ; done
73
74uninstall-tools:
75        for program in $(TOOLS_TARGETS) ; do \
76        $(RM) $(DESTDIR)$(sbindir)/$$program ; \
77        $(RM) $(DESTDIR)$(man8dir)/$$program.8 ; done
78
79all: all-tools
80
81strip: strip-tools
82
83clean: clean-tools
84
85install: install-tools
86
87uninstall: uninstall-tools
Note: See TracBrowser for help on using the browser.