aboutsummaryrefslogtreecommitdiff
path: root/flow-native/Makefile
blob: 0a64190127d554aea03b62d5665aad4cb0b3b1e0 (plain) (blame)
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
# Build native binaries for flow.
# ===============================
# This makefile is intended for linux based systems.

# Include common settings
include common.mk

# Name of library to build
LIB=lib$(NAME).so

# soname of library
SONAME=$(LIB).$(MAJOR)

# Actual file name of library
TARGET=$(SONAME).$(MINOR).$(MICRO)

# Linux-specific linker flags
LDFLAGS+=-shared -Wl,-soname,$(SONAME)

# All final products that should be installed
PRODUCTS=$(TARGET) $(SONAME) $(LIB)


# Build library and all appropriate links
all: $(PRODUCTS)

# Build actual library
$(TARGET): $(OBJECTS)
	$(CC) $(LDFLAGS) -o $@ $^

# Create soname link
$(SONAME): $(TARGET)
	ln -s $< $@

# Create dev link
$(LIB): $(SONAME)
	ln -s $< $@

# Compile objects
%.o: %.c
	$(CC) $(CFLAGS) $(addprefix -I, $(INCLUDES)) -o $@ -c $<

# Install resulting artifacts
install: all
	@for product in $(PRODUCTS); do cp -P -t $(DESTDIR)/$(PREFIX)/lib $${product}; done

# Uninstall resulting artifacts
uninstall:
	@for product in $(PRODUCTS); do rm $(DESTDIR)/$(PREFIX)/lib/$${product}; done

# Clean build
clean:
	rm -f posix/*.o
	rm -f posix/*.so
	rm -f *.o
	$(foreach product, $(PRODUCTS), rm -f $(product);)

.PHONY: clean install uninstall