Date:2010-09-06 01:51:07 (9 years 3 months ago)
Author:Werner Almesberger
Commit:bb65155eabbf25005b71e2addf37457819a9e6cc
Message:Further cleanup to make the tools build for the "ben" target.

- tools/Makefile.common: set CC to the target-specific compiler
- tools/atspi-id/atspi-id.c: exclude everything USB if HAVE_USB is not set
- tools/atspi-id/atspi-id.c (atspi_usb_handle): rearrange to use a "struct
atspi_dsc *" argument, so that we don't expose an USB dependency
- tools/lib/Makefile: $(F32XBASE)/lib/usb.o is target-specific. Moved it
from OBJS to OBJS_host.
- tools/lib/Makefile (clean): remove objects of all targets
Files: tools/Makefile.common (1 diff)
tools/atspi-id/atspi-id.c (3 diffs)
tools/lib/Makefile (2 diffs)

Change Details

tools/Makefile.common
2727MACROS_host = -DHAVE_USB
2828MACROS_ben = -DHAVE_USD
2929
30CC = $(CC_$(TARGET))
3031CFLAGS += -I../../atrf/fw/include -I../include $(MACROS_$(TARGET))
3132LDLIBS = $(LDLIBS_$(TARGET)) -L../lib -latspi
tools/atspi-id/atspi-id.c
1313
1414#include <stdlib.h>
1515#include <stdio.h>
16
17#ifdef HAVE_USB
1618#include <usb.h>
19#endif
1720
1821#include "at86rf230.h"
1922#include "atspi/ep0.h"
2023#include "atspi.h"
2124
2225
26#ifdef HAVE_USB
27
2328#define FROM_DEV ATSPI_FROM_DEV(0)
2429
2530#define BUF_SIZE 256
2631
2732
28
2933static int get_id(usb_dev_handle *dev, void *data, int size)
3034{
3135    int res;
...... 
6771}
6872
6973
70static void show_usb_info(usb_dev_handle *dev)
74static void show_usb_info(struct atspi_dsc *dsc)
7175{
72    const struct usb_device *device = usb_device(dev);
76    usb_dev_handle *dev;
77    const struct usb_device *device;
7378    uint8_t major, minor, target;
7479    char buf[BUF_SIZE+1]; /* +1 for terminating \0 */
7580    int len;
7681
82    dev = atspi_usb_handle(dsc);
83    if (!dev)
84        return;
85    device = usb_device(dev);
86
7787    printf("%04x:%04x ",
7888        device->descriptor.idVendor, device->descriptor.idProduct);
7989
...... 
8999}
90100
91101
102#else /* HAVE_USB */
103
104
105static void show_usb_info(struct atspi_dsc *dsc)
106{
107}
108
109
110#endif /* !HAVE_USB */
111
112
92113static void show_info(struct atspi_dsc *dsc)
93114{
94    usb_dev_handle *dev;
95115    uint8_t part, version, man_id_0, man_id_1;
96116
97    dev = atspi_usb_handle(dsc);
98    if (dev)
99        show_usb_info(dev);
117    show_usb_info(dsc);
100118
101119    part = atspi_reg_read(dsc, REG_PART_NUM);
102120    version = atspi_reg_read(dsc, REG_VERSION_NUM);
tools/lib/Makefile
1616include ../Makefile.common
1717
1818CFLAGS += -Wall -I$(F32XBASE)/include
19OBJS_host = atusb.o
19OBJS_host = atusb.o $(F32XBASE)/lib/usb.o
2020OBJS_ben = atusd.o
21OBJS = $(F32XBASE)/lib/usb.o atspi.o $(OBJS_$(TARGET))
21OBJS = atspi.o $(OBJS_$(TARGET))
2222
2323.PHONY: all clean spotless
2424
...... 
2828        $(AR) cr $@ $^
2929
3030clean:
31        rm -f $(OBJS)
31        rm -f $(OBJS) $(OBJS_ben) $(OBJS_host)
3232
3333spotless: clean
3434        rm -f $(LIB)

Archive Download the corresponding diff file



interactive