-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
43 lines (34 loc) · 1003 Bytes
/
Makefile
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
PREFIX ?= /usr/local
CC = gcc
AR = ar
CFLAGS = -std=gnu99 -fPIC -Wall -Wno-unused-parameter -Wno-unused-function
CFLAGS += -I. -O4 -fno-strict-overflow
APRILTAG_SRCS := $(shell ls *.c common/*.c)
APRILTAG_HEADERS := $(shell ls *.h common/*.h)
APRILTAG_OBJS := $(APRILTAG_SRCS:%.c=%.o)
TARGETS := libapriltag.a libapriltag.so
.PHONY: all
all: $(TARGETS)
@$(MAKE) -C example all
.PHONY: install
install: libapriltag.so
@chmod +x install.sh
@./install.sh $(PREFIX)/lib libapriltag.so
@./install.sh $(PREFIX)/include/apriltag $(APRILTAG_HEADERS)
@sed 's:^prefix=$$:prefix=$(PREFIX):' < apriltag.pc.in > apriltag.pc
@./install.sh $(PREFIX)/lib/pkgconfig apriltag.pc
@rm apriltag.pc
@ldconfig
libapriltag.a: $(APRILTAG_OBJS)
@echo " [$@]"
@$(AR) -cq $@ $(APRILTAG_OBJS)
libapriltag.so: $(APRILTAG_OBJS)
@echo " [$@]"
@$(CC) -fPIC -shared -o $@ $^
%.o: %.c
@echo " $@"
@$(CC) -o $@ -c $< $(CFLAGS)
.PHONY: clean
clean:
@rm -rf *.o common/*.o $(TARGETS)
@$(MAKE) -C example clean