comparison arib25v023/arib25/src/Makefile @ 20:669f7080a8dc

reworked Makefile so that shared object would be built
author Yoshiki Yazawa <yaz@honeyplanet.jp>
date Wed, 25 Feb 2009 22:54:07 +0900
parents 6801fe7e04ff
children 08f9a97364e0
comparison
equal deleted inserted replaced
19:5cd8212bea78 20:669f7080a8dc
1 # PC/SC Lite libraries and headers. 1 PREFIX = /usr/local
2 PCSC_CFLAGS ?= `pkg-config libpcsclite --cflags` 2 MAJOR = 0
3 PCSC_LDLIBS ?= `pkg-config libpcsclite --libs` 3 MINOR = 2
4 REVISION = 3
5 VER = $(MAJOR).$(MINOR).$(REVISION)
6
7 DEST_HEADER = $(PREFIX)/include/arib25
4 8
5 CC = gcc 9 CC = gcc
6 CFLAGS = -Wall -O2 -g $(PCSC_CFLAGS) -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 10 PCSC_CFLAGS ?= `pkg-config libpcsclite --cflags`
7 LDLIBS = $(PCSC_LDLIBS) -lm 11 CPPFLAGS = -Wall $(PCSC_CFLAGS) -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
8 12 CFLAGS = -O2 -g -fPIC
9 TARGET = b25 13
14 PCSC_LIBS ?= `pkg-config libpcsclite --libs`
15 LIBS = $(PCSC_LIBS) -lm
16 LDFLAGS ?=
17
10 OBJS = arib_std_b25.o b_cas_card.o multi2.o td.o ts_section_parser.o 18 OBJS = arib_std_b25.o b_cas_card.o multi2.o td.o ts_section_parser.o
19 HEADERS = arib_std_b25.h b_cas_card.h portable.h
20 TARGET_APP = b25
21 TARGET_LIB = libarib25.so
22 TARGETS = $(TARGET_APP) $(TARGET_LIB)
23 DEPEND = Makefile.dep
24 SONAME = $(TARGET_LIB).$(MAJOR)
11 25
12 all: $(TARGET) 26 all: $(TARGETS)
13
14 arib_std_b25.o: arib_std_b25.c arib_std_b25.h portable.h b_cas_card.h arib_std_b25_error_code.h multi2.h ts_section_parser.h ts_common_types.h
15 b_cas_card.o: b_cas_card.c b_cas_card.h portable.h b_cas_card_error_code.h
16 multi2.o: multi2.c multi2.h portable.h multi2_error_code.h
17 td.o: td.c arib_std_b25.h portable.h b_cas_card.h
18 ts_section_parser.o: ts_section_parser.c ts_section_parser.h ts_common_types.h portable.h ts_section_parser_error_code.h
19
20 $(TARGET): $(OBJS)
21 $(CC) $(LDLIBS) -o $(TARGET) $(OBJS)
22 27
23 clean: 28 clean:
24 rm -f *.o 29 rm -f *.o
25 rm -f $(TARGET) 30 rm -f $(TARGETS)
31
32 $(TARGET_APP): $(OBJS)
33 $(CC) $(LDFLAGS) -o $(TARGET_APP) $(OBJS) $(LIBS)
34
35 $(TARGET_LIB): $(OBJS)
36 $(CC) $(LDFLAGS) -shared -o $(TARGET_LIB) $(OBJS) $(LIBS) -Wl,-soname,$(SONAME)
37
38 $(DEPEND):
39 $(CC) -MM $(OBJS:.o=.c) $(CPPFLAGS) > $@
40
41 install: $(TARGET) install-headers
42 install -m755 b25 $(PREFIX)/bin
43 install -m755 $(TARGET_LIB) $(PREFIX)/lib/$(TARGET_LIB).$(VER)
44 ln -sf $(PREFIX)/lib/$(TARGET_LIB).$(VER) $(PREFIX)/lib/$(TARGET_LIB).$(MAJOR)
45 ln -sf $(PREFIX)/lib/$(TARGET_LIB).$(MAJOR) $(PREFIX)/lib/$(TARGET_LIB)
46 ldconfig
47
48 install-headers:
49 mkdir -p $(DEST_HEADER)
50 install -m644 $(HEADERS) $(DEST_HEADER)
51
52 -include Makefile.dep