File: Makefile

package info (click to toggle)
zh-autoconvert 0.3.16-5
  • links: PTS, VCS
  • area: main
  • in suites: buster, sid
  • size: 3,612 kB
  • sloc: ansic: 28,053; perl: 264; makefile: 84; python: 9
file content (27 lines) | stat: -rw-r--r-- 1,113 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
CC ?= gcc
CFLAGS := -O2 -Wall -g -D_REENTRANT $(CFLAGS)
INCLUDES += -I../include
SHARED_LIB=libhz.so
SHARED_LIB_MAJOR=$(SHARED_LIB).0
SHARED_LIB_MINOR=$(SHARED_LIB_MAJOR).0
OBJS=b2g.o b2u.o g2u.o hz2gb.o b2g_tables.o b2u_tables.o g2u_tables.o io.o unicode.o judge.o judge3.o gbpercent.o b5percent.o search.o 
STATIC_OBJS=b2g.static.o b2u.static.o g2u.static.o hz2gb.static.o b2g_tables.static.o b2u_tables.static.o g2u_tables.static.o io.static.o unicode.static.o judge.static.o judge3.static.o gbpercent.static.o b5percent.static.o search.static.o 

%.o:%.c
	$(CC) -fPIC $(INCLUDES) $(CPPFLAGS) $(CFLAGS) -c $<

%.static.o:%.c
	$(CC) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) -c $< -o $*.static.o

all: share-lib static-lib

share-lib: $(OBJS)
	$(CC) -fPIC -shared -Wl,-soname,$(SHARED_LIB_MAJOR) -o ../lib/$(SHARED_LIB_MINOR)  $(OBJS) -ldl $(LDFLAGS)
	rm -f ../lib/$(SHARED_LIB_MAJOR)
	rm -f ../lib/$(SHARED_LIB)
	cd ../lib;ln -s $(SHARED_LIB_MINOR) $(SHARED_LIB_MAJOR)
	cd ../lib;ln -s $(SHARED_LIB_MAJOR) $(SHARED_LIB)
static-lib: $(STATIC_OBJS)
	ar rs  ../lib/libhz.a $(STATIC_OBJS)
clean:
	rm -f *.o *~ ../lib/lib*