Changeset 4905

Show
Ignore:
Timestamp:
09/29/07 23:03:32 (1 year ago)
Author:
khali
Message:

Add a main Makefile and make it call the tools and eeprom modules
Makefiles.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • i2c-tools/trunk/eeprom/Makefile

    r4489 r4905  
    55# Licensed under the GNU Public License. 
    66 
    7 DESTDIR = 
    8 prefix  = /usr/local 
    9 bindir  = $(prefix)/bin 
     7EEPROM_DIR      := eeprom 
    108 
    11 INSTALL         := install 
    12 INSTALL_DIR     := $(INSTALL) -m 755 -d 
    13 INSTALL_PROGRAM := $(INSTALL) -m 755 
    14 RM              := rm -f 
    15  
    16 PROGRAMS        := decode-dimms.pl decode-vaio.pl ddcmon decode-edid.pl \ 
     9EEPROM_TARGETS  := decode-dimms.pl decode-vaio.pl ddcmon decode-edid.pl \ 
    1710                   decode-xeon.pl 
    18  
    19 all : $(PROGRAMS) 
    2011 
    2112# 
     
    2314# 
    2415 
    25 install : install-bin 
     16install-eeprom: $(addprefix $(EEPROM_DIR)/,$(EEPROM_TARGETS)) 
     17        $(INSTALL_DIR) $(DESTDIR)$(bindir) 
     18        for program in $(EEPROM_TARGETS) ; do \ 
     19        $(INSTALL_PROGRAM) $(EEPROM_DIR)/$$program $(DESTDIR)$(bindir) ; done 
    2620 
    27 uninstall : uninstall-bin 
    28  
    29 install-bin : $(PROGRAMS) 
    30         $(INSTALL_DIR) $(DESTDIR)$(bindir) 
    31         for program in $(PROGRAMS) ; do \ 
    32         $(INSTALL_PROGRAM) $$program $(DESTDIR)$(bindir) ; done 
    33  
    34 uninstall-bin : 
    35         for program in $(PROGRAMS) ; do \ 
     21uninstall-eeprom: 
     22        for program in $(EEPROM_TARGETS) ; do \ 
    3623        $(RM) $(DESTDIR)$(bindir)/$$program ; done 
    3724 
    38 clean : 
     25install: install-eeprom 
     26 
     27uninstall: uninstall-eeprom 
  • i2c-tools/trunk/tools/Makefile

    r4499 r4905  
    55# Licensed under the GNU Public License. 
    66 
    7 CC      = gcc 
    8 CFLAGS  = -Wall -Wstrict-prototypes -Wshadow -Wpointer-arith -Wcast-qual \ 
    9           -Wcast-align -Wwrite-strings -Wnested-externs -Winline -W \ 
    10           -Wundef -Wmissing-prototypes -I../include 
     7TOOLS_DIR       := tools 
    118 
    12 CFLAGS  += -O2 
    13 # When debugging, use the following instead 
    14 #CFLAGS += -O -g 
     9TOOLS_CFLAGS    := -Wstrict-prototypes -Wshadow -Wpointer-arith -Wcast-qual \ 
     10                   -Wcast-align -Wwrite-strings -Wnested-externs -Winline \ 
     11                   -W -Wundef -Wmissing-prototypes -I../include 
    1512 
    16 # Pass linker flags here 
    17 LDFLAGS = 
    18  
    19 DESTDIR = 
    20 prefix  = /usr/local 
    21 sbindir = $(prefix)/sbin 
    22 mandir  = $(prefix)/share/man 
    23 man8dir = $(mandir)/man8 
    24  
    25 INSTALL         := install 
    26 INSTALL_DATA    := $(INSTALL) -m 644 
    27 INSTALL_DIR     := $(INSTALL) -m 755 -d 
    28 INSTALL_PROGRAM := $(INSTALL) -m 755 
    29 RM              := rm -f 
    30  
    31 PROGRAMS        := i2cdetect i2cdump i2cset i2cget 
    32  
    33 all : $(PROGRAMS) 
     13TOOLS_TARGETS   := i2cdetect i2cdump i2cset i2cget 
    3414 
    3515# 
     
    3717# 
    3818 
    39 i2cdetect : i2cdetect.o i2cbusses.o 
     19$(TOOLS_DIR)/i2cdetect: $(TOOLS_DIR)/i2cdetect.o $(TOOLS_DIR)/i2cbusses.o 
    4020        $(CC) $(LDFLAGS) -o $@ $^ 
    4121 
    42 i2cdump : i2cdump.o i2cbusses.o util.o 
     22$(TOOLS_DIR)/i2cdump: $(TOOLS_DIR)/i2cdump.o $(TOOLS_DIR)/i2cbusses.o $(TOOLS_DIR)/util.o 
    4323        $(CC) $(LDFLAGS) -o $@ $^ 
    4424 
    45 i2cset : i2cget.o i2cbusses.o util.o 
     25$(TOOLS_DIR)/i2cset: $(TOOLS_DIR)/i2cget.o $(TOOLS_DIR)/i2cbusses.o $(TOOLS_DIR)/util.o 
    4626        $(CC) $(LDFLAGS) -o $@ $^ 
    4727 
    48 i2cget : i2cset.o i2cbusses.o util.o 
     28$(TOOLS_DIR)/i2cget: $(TOOLS_DIR)/i2cset.o $(TOOLS_DIR)/i2cbusses.o $(TOOLS_DIR)/util.o 
    4929        $(CC) $(LDFLAGS) -o $@ $^ 
    5030 
     
    5333# 
    5434 
    55 i2cdetect.o : i2cdetect.c i2cbusses.h 
    56         $(CC) $(CFLAGS) -c $< -o $@ 
     35$(TOOLS_DIR)/i2cdetect.o: $(TOOLS_DIR)/i2cdetect.c $(TOOLS_DIR)/i2cbusses.h 
     36        $(CC) $(CFLAGS) $(TOOLS_CFLAGS) -c $< -o $@ 
    5737 
    58 i2cdump.o : i2cdump.c i2cbusses.h util.h 
    59         $(CC) $(CFLAGS) -c $< -o $@ 
     38$(TOOLS_DIR)/i2cdump.o: $(TOOLS_DIR)/i2cdump.c $(TOOLS_DIR)/i2cbusses.h $(TOOLS_DIR)/util.h 
     39        $(CC) $(CFLAGS) $(TOOLS_CFLAGS) -c $< -o $@ 
    6040 
    61 i2cset.o : i2cset.c i2cbusses.h util.h 
    62         $(CC) $(CFLAGS) -c $< -o $@ 
     41$(TOOLS_DIR)/i2cset.o: $(TOOLS_DIR)/i2cset.c $(TOOLS_DIR)/i2cbusses.h $(TOOLS_DIR)/util.h 
     42        $(CC) $(CFLAGS) $(TOOLS_CFLAGS) -c $< -o $@ 
    6343 
    64 i2cget.o : i2cget.c i2cbusses.h util.h 
    65         $(CC) $(CFLAGS) -c $< -o $@ 
     44$(TOOLS_DIR)/i2cget.o: $(TOOLS_DIR)/i2cget.c $(TOOLS_DIR)/i2cbusses.h $(TOOLS_DIR)/util.h 
     45        $(CC) $(CFLAGS) $(TOOLS_CFLAGS) -c $< -o $@ 
    6646 
    67 i2cbusses.o : i2cbusses.c i2cbusses.h 
    68         $(CC) $(CFLAGS) -c $< -o $@ 
     47$(TOOLS_DIR)/i2cbusses.o: $(TOOLS_DIR)/i2cbusses.c $(TOOLS_DIR)/i2cbusses.h 
     48        $(CC) $(CFLAGS) $(TOOLS_CFLAGS) -c $< -o $@ 
    6949 
    70 util.o : util.c util.h 
    71         $(CC) $(CFLAGS) -c $< -o $@ 
     50$(TOOLS_DIR)/util.o: $(TOOLS_DIR)/util.c $(TOOLS_DIR)/util.h 
     51        $(CC) $(CFLAGS) $(TOOLS_CFLAGS) -c $< -o $@ 
    7252 
    7353# 
     
    7555# 
    7656 
    77 strip : $(PROGRAMS) 
    78         strip $(PROGRAMS) 
     57all-tools: $(addprefix $(TOOLS_DIR)/,$(TOOLS_TARGETS)) 
    7958 
    80 install : install-bin install-man 
     59strip-tools: $(addprefix $(TOOLS_DIR)/,$(TOOLS_TARGETS)) 
     60        strip $(addprefix $(TOOLS_DIR)/,$(TOOLS_TARGETS)) 
    8161 
    82 uninstall : uninstall-bin uninstall-man 
     62clean-tools: 
     63        $(RM) $(addprefix $(TOOLS_DIR)/,*.o $(TOOLS_TARGETS)) 
    8364 
    84 install-bin : $(PROGRAMS) 
    85         $(INSTALL_DIR) $(DESTDIR)$(sbindir) 
    86         for program in $(PROGRAMS) ; do \ 
    87         $(INSTALL_PROGRAM) $$program $(DESTDIR)$(sbindir) ; done 
     65install-tools: $(addprefix $(TOOLS_DIR)/,$(TOOLS_TARGETS)) 
     66        $(INSTALL_DIR) $(DESTDIR)$(sbindir) $(DESTDIR)$(man8dir) 
     67        for program in $(TOOLS_TARGETS) ; do \ 
     68        $(INSTALL_PROGRAM) $(TOOLS_DIR)/$$program $(DESTDIR)$(sbindir) ; \ 
     69        $(INSTALL_DATA) $(TOOLS_DIR)/$$program.8 $(DESTDIR)$(man8dir) ; done 
    8870 
    89 uninstall-bin : 
    90         for program in $(PROGRAMS) ; do \ 
    91         $(RM) $(DESTDIR)$(sbindir)/$$program ; done 
    92  
    93 install-man : 
    94         $(INSTALL_DIR) $(DESTDIR)$(man8dir) 
    95         for program in $(PROGRAMS) ; do \ 
    96         $(INSTALL_DATA) $$program.8 $(DESTDIR)$(man8dir) ; done 
    97  
    98 uninstall-man : 
    99         for program in $(PROGRAMS) ; do \ 
     71uninstall-tools: 
     72        for program in $(TOOLS_TARGETS) ; do \ 
     73        $(RM) $(DESTDIR)$(sbindir)/$$program ; \ 
    10074        $(RM) $(DESTDIR)$(man8dir)/$$program.8 ; done 
    10175 
    102 clean : 
    103         $(RM) *.o $(PROGRAMS) core 
     76all: all-tools 
     77 
     78strip: strip-tools 
     79 
     80clean: clean-tools 
     81 
     82install: install-tools 
     83 
     84uninstall: uninstall-tools