- fixed Makefile to produce a shared linked hwinfo again
[opensuse:hwinfo.git] / Makefile
1 TOPDIR          = $(CURDIR)
2 SUBDIRS         = src
3 TARGETS         = hwinfo
4 CLEANFILES      = hwinfo hwinfo.static
5
6 include Makefile.common
7
8 OBJS_NO_TINY    = names.o parallel.o modem.o
9
10 .PNONY: static tiny
11
12 hwinfo: hwinfo.o $(LIBHD)
13         $(CC) hwinfo.o $(LDFLAGS) -lhd -o $@
14
15 static: hwinfo
16         $(CC) -static hwinfo.o $(LDFLAGS) -o hwinfo.static
17         strip -R .note -R .comment hwinfo.static
18
19 tiny:
20         @make EXTRA_FLAGS=-DLIBHD_TINY
21
22 shared: hwinfo.o
23         @make EXTRA_FLAGS=-fpic
24         $(CC) -shared -Wl,--whole-archive $(LIBHD) -Wl,--no-whole-archive \
25                 -Wl,-soname=libhd.so.$(LIBHD_MAJOR_VERSION)\
26                 -o $(LIBHD_SO) 
27         $(CC) hwinfo.o $(LDFLAGS) $(LIBHD_SO) -o hwinfo
28
29 install:
30         install -d -m 755 /usr/sbin /usr/lib /usr/include
31         install -m 755 -s hwinfo /usr/sbin
32         if [ -f $(LIBHD_SO) ] ; then \
33                 install $(LIBHD_SO) /usr/lib ; \
34                 ln -snf libhd.so.$(LIBHD_VERSION) /usr/lib/libhd.so ; \
35         else \
36                 install -m 644 $(LIBHD) /usr/lib ; \
37         fi
38         install -m 644 src/hd/hd.h /usr/include