forked from keirf/disk-utilities
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
76 lines (64 loc) · 1.97 KB
/
Makefile
File metadata and controls
76 lines (64 loc) · 1.97 KB
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
ROOT := ..
include $(ROOT)/Rules.mk
SRCS := $(wildcard *.c)
OBJS := $(patsubst %.c,%.o,$(SRCS))
PICOBJS := $(patsubst %.o,%.opic,$(OBJS))
MAJOR_VERSION := 0
MINOR_VERSION := 0
# base name of the shared library name
SOLIB_PFX := libdisk
ifeq ($(PLATFORM),osx)
SOLIB := $(SOLIB_PFX).dylib
SONAME := $(SOLIB_PFX).$(MAJOR_VERSION).dylib
SOVERS := $(SOLIB_PFX).$(MAJOR_VERSION).$(MINOR_VERSION).dylib
LDFLAGS ?= -dynamiclib -install_name $(SONAME)
endif
ifeq ($(PLATFORM),linux)
SOLIB := $(SOLIB_PFX).so
SONAME := $(SOLIB_PFX).so.$(MAJOR_VERSION)
SOVERS := $(SOLIB_PFX).so.$(MAJOR_VERSION).$(MINOR_VERSION)
LDFLAGS ?= -Wl,-h,$(SONAME) -shared
endif
ifeq ($(PLATFORM),win32)
SOLIB := $(SOLIB_PFX).dll
SONAME := $(SOLIB_PFX).$(MAJOR_VERSION).dll
SOVERS := $(SOLIB_PFX).$(MAJOR_VERSION).$(MINOR_VERSION).dll
LDFLAGS ?= -Wl,-h,$(SONAME) -shared
endif
LIBS :=
LIBS-$(caps) := -ldl
LIBS += $(LIBS-y)
all:
ifneq ($(SHARED_LIB),n)
$(MAKE) -C stream streams.apic
$(MAKE) -C container containers.apic
$(MAKE) -C format formats.apic
$(MAKE) $(SOVERS)
else
$(MAKE) -C stream streams.o
$(MAKE) -C container containers.o
$(MAKE) -C format formats.o
$(MAKE) libdisk.a
endif
libdisk.a: $(OBJS) stream/streams.o container/containers.o format/formats.o
$(AR) rcs $@ $^
$(SOVERS): $(PICOBJS) stream/streams.apic container/containers.apic \
format/formats.apic
$(CC) $(LDFLAGS) -o $(SOVERS) $^ $(LIBS)
# strip -x $(SOVERS)
ln -sf $(SOVERS) $(SONAME)
ln -sf $(SONAME) $(SOLIB)
install: all
$(INSTALL_DIR) $(LIBDIR)
$(INSTALL_PROG) $(SOVERS) $(LIBDIR)
ln -sf $(SOVERS) $(LIBDIR)/$(SONAME)
ln -sf $(SONAME) $(LIBDIR)/$(SOLIB)
$(INSTALL_DIR) $(INCLUDEDIR)/libdisk
$(INSTALL_DATA) include/libdisk/disk.h $(INCLUDEDIR)/libdisk
$(INSTALL_DATA) include/libdisk/stream.h $(INCLUDEDIR)/libdisk
$(INSTALL_DATA) include/libdisk/util.h $(INCLUDEDIR)/libdisk
$(INSTALL_DATA) include/libdisk/track_types.h $(INCLUDEDIR)/libdisk
clean::
$(MAKE) -C stream clean
$(MAKE) -C container clean
$(MAKE) -C format clean