File: Makefile

package info (click to toggle)
muroard 0.1.14-1
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 420 kB
  • ctags: 424
  • sloc: ansic: 3,645; sh: 505; makefile: 113
file content (118 lines) | stat: -rw-r--r-- 4,101 bytes parent folder | download | duplicates (3)
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
include Makefile.conf

LIBNAME=libmuroard

SOVERSION = 3

PREFIX_CKPORT=$(PREFIX_LIB)/ckport/db/

SLIB_BASE=$(LIBNAME)$(SHARED_SUFFIX)
SLIB=$(SLIB_BASE).$(SOVERSION)
ALIB=$(LIBNAME).a

LIBNAME_BKEND=$(LIBNAME)-backend
SLIB_BKEND_BASE=$(LIBNAME_BKEND)$(SHARED_SUFFIX)
SLIB_BKEND=$(SLIB_BKEND_BASE).$(SOVERSION)
ALIB_BKEND=$(LIBNAME_BKEND).a

BIN=muroard
MANPAGE=$(BIN).1

CKPORTDB=$(LIBNAME).ckport

TARGETS=$(ALIB) $(ALIB_BKEND) $(BIN)

ifeq ($(BUILD_SHARED),true)
TARGETS += $(SLIB) $(SLIB_BKEND)
endif

HEADER=muroard.h clients.h deps.h driver.h dsp.h features.h memmgr.h network.h para.h proto.h streams.h waveform.h callbacks.h cf.h state.h

OBJS_CF=cf_au.o cf_riff_wave.o cf_ogg_vorbis.o
OBJS=muroard.o para.o network.o waveform.o proto.o dsp.o clients.o streams.o memmgr.o $(OBJS_CF)
OBJS_DRIVER=driver.o
OBJS_MAIN=main.o

DEFINES += -DPACKAGE_VERSION="\"$(VERSION)\"" -DDEVICE_VENDOR_ID=$(DEV_VENDOR) -DDEVICE_VENDOR_NAME="\"$(DEV_VENDOR_NAME)\"" -DDEVICE_VENDOR_STRING="\"$(DEV_VENDOR_STRING)\"" -DDISTRIBUTION_VERSION_STRING="\"$(DISTRIBUTION_VERSION_STRING)\"" $(TARGET_MICROCONTROLLER) $(DRIVER_def) $(def_dnet_daemon) $(def_vorbisfile)
CFLAGS  += -Wall $(Wextra) $(fPIC) -g -O2 $(INCPATH) $(DEFINES)
LDFLAGS += -Wall $(Wextra) -g -O2 $(LDPATH)

CONTLIBS = $(lib_vorbisfile)
NETLIBS  = $(lib_wsock32) $(lib_ws2_32) $(lib_dnet_daemon)
LIBS    += $(CONTLIBS) $(NETLIBS) $(DRIVER_LIBS)

all: ${TARGETS}
clean:
	rm -f ${TARGETS} *.o
distclean: clean
	rm -f Makefile.conf config.log

new: clean all

prep-install-dirs:
	mkdir -p '$(DESTDIR)$(PREFIX_LIB)'
	mkdir -p '$(DESTDIR)$(PREFIX_INC)'/muroard
	mkdir -p '$(DESTDIR)$(PREFIX_BIN)'
	mkdir -p '$(DESTDIR)$(PREFIX_MAN)/man1'
	mkdir -p '$(DESTDIR)$(PREFIX_CKPORT)'

install: all prep-install-dirs
ifeq ($(BUILD_SHARED),true)
	cp $(cp_v) $(SLIB)       '$(DESTDIR)$(PREFIX_LIB)'
	cp $(cp_v) $(SLIB_BKEND) '$(DESTDIR)$(PREFIX_LIB)'
endif
	cp $(cp_v) $(ALIB)       '$(DESTDIR)$(PREFIX_LIB)'
	cp $(cp_v) $(ALIB_BKEND) '$(DESTDIR)$(PREFIX_LIB)'
	cp $(cp_v) $(HEADER)     '$(DESTDIR)$(PREFIX_INC)/muroard/'
	cp $(cp_v) $(BIN)        '$(DESTDIR)$(PREFIX_BIN)'
	cp $(cp_v) $(MANPAGE)    '$(DESTDIR)$(PREFIX_MAN)/man1/'
	cp $(cp_v) $(CKPORTDB)   '$(DESTDIR)$(PREFIX_CKPORT)'
ifeq ($(BUILD_SHARED),true)
	ln -fs $(SLIB)       '$(DESTDIR)$(PREFIX_LIB)'/$(SLIB_BASE)
	ln -fs $(SLIB_BKEND) '$(DESTDIR)$(PREFIX_LIB)'/$(SLIB_BKEND_BASE)
endif

semi-install: all prep-install-dirs
ifeq ($(BUILD_SHARED),true)
	ln -fs `pwd`/$(SLIB)       '$(DESTDIR)$(PREFIX_LIB)'
	ln -fs `pwd`/$(SLIB_BKEND) '$(DESTDIR)$(PREFIX_LIB)'
endif
	ln -fs `pwd`/$(ALIB)       '$(DESTDIR)$(PREFIX_LIB)'
	ln -fs `pwd`/$(ALIB_BKEND) '$(DESTDIR)$(PREFIX_LIB)'
	set -e; for i in $(HEADER); do ln -fs `pwd`/$$i '$(DESTDIR)$(PREFIX_INC)/muroard/'; done
	ln -fs `pwd`/$(BIN)        '$(DESTDIR)$(PREFIX_BIN)'
	ln -fs `pwd`/$(MANPAGE)    '$(DESTDIR)$(PREFIX_MAN)/man1/'
	ln -fs `pwd`/$(CKPORTDB)   '$(DESTDIR)$(PREFIX_CKPORT)'
ifeq ($(BUILD_SHARED),true)
	ln -fs $(SLIB)       '$(DESTDIR)$(PREFIX_LIB)'/$(SLIB_BASE)
	ln -fs $(SLIB_BKEND) '$(DESTDIR)$(PREFIX_LIB)'/$(SLIB_BKEND_BASE)
endif

uninstall:
	rm -f  '$(DESTDIR)$(PREFIX_LIB)'/$(SLIB)
	rm -f  '$(DESTDIR)$(PREFIX_LIB)'/$(ALIB)
	rm -f  '$(DESTDIR)$(PREFIX_LIB)'/$(SLIB_BKEND)
	rm -f  '$(DESTDIR)$(PREFIX_LIB)'/$(ALIB_BKEND)
	rm -fr '$(DESTDIR)$(PREFIX_INC)/muroard/'
	rm -f  '$(DESTDIR)$(PREFIX_LIB)'/$(SLIB_BASE)
	rm -f  '$(DESTDIR)$(PREFIX_LIB)'/$(SLIB_BKEND_BASE)
	rm -f  '$(DESTDIR)$(PREFIX_BIN)'/$(BIN)
	rm -f  '$(DESTDIR)$(PREFIX_MAN)'/man1/$(MANPAGE)
	rm -f  '$(DESTDIR)$(PREFIX_CKPORT)'/$(CKPORTDB)

muroard: $(OBJS) $(OBJS_DRIVER) $(OBJS_MAIN)
	${CC} ${LDFLAGS} -o muroard $(OBJS) $(OBJS_DRIVER) $(OBJS_MAIN) ${LIBS}

$(SLIB): ${OBJS}
	${CC} ${LDFLAGS} $(SHARED) -Wl,-soname,$(SLIB) -o $(SLIB) ${OBJS} ${LIBS}
$(ALIB): ${OBJS}
	${AR} cru $(ALIB) ${OBJS}
	${RANLIB} $(ALIB)

$(SLIB_BKEND): ${OBJS_DRIVER}
	${CC} ${LDFLAGS} $(SHARED) -Wl,-soname,$(SLIB_BKEND) -o $(SLIB_BKEND) ${OBJS_DRIVER} $(DRIVER_LIBS)
$(ALIB_BKEND): ${OBJS_DRIVER}
	${AR} cru $(ALIB_BKEND) ${OBJS_DRIVER}
	${RANLIB} $(ALIB_BKEND)

driver.o: driver.c driver_*.c