aboutsummaryrefslogtreecommitdiff
path: root/test/example/Makefile
blob: a21ba063d942930dff5572941adc2159d433c14b (plain)
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
# Copyright (c) 2013, Linaro Limited
# All rights reserved.
#
# SPDX-License-Identifier:     BSD-3-Clause

ODP_ROOT = ../..
ODP_APP  = odp_example

CFLAGS  += -I.

include $(ODP_ROOT)/Makefile.inc

LDFLAGS += -lrt
LDFLAGS += $(EXTRA_CFLAGS)

OBJS     =
OBJS    += $(OBJ_DIR)/odp_example.o

DEPS     = $(OBJS:.o=.d)

.PHONY: all
all: $(OBJ_DIR) $(ODP_APP)

-include $(DEPS)

$(OBJ_DIR):
	mkdir $(OBJ_DIR)

$(LIB):
	@echo Building $@
	$(MAKE) -C $(ODP_LIB) libs

#
# Compile rules
#
$(OBJ_DIR)/%.o: %.c
	@echo Compiling $<
	$(CC) -c -MD $(CFLAGS) -o $@ $<

#
# Link rule
#
$(ODP_APP): $(LIB) $(OBJS)
	$(CC) $(LDFLAGS) $(OBJS) $(LIB) -o $@

.PHONY: libs
libs:
	$(MAKE) -C $(ODP_LIB) libs

.PHONY: docs
docs:
	$(MAKE) -C $(ODP_LIB) docs

.PHONY: clean
clean:
	rm -rf $(OBJ_DIR)
	rm -f $(ODP_APP)
	$(MAKE) -C $(ODP_LIB) clean

.PHONY: install
install:
	install -d $(DESTDIR)$(prefix)/usr/local/share/odp
	install -m 0755 $(ODP_APP) $(DESTDIR)$(prefix)/usr/local/share/odp/