forked from c4ev3/EV3-API
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
45 lines (37 loc) · 1.27 KB
/
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
44
45
## Copyright (c) 2015 Ahmad Fatoum
CROSS_COMPILE ?= C:/CSLite/bin/arm-none-linux-gnueabi-
PREFIX ?= $(CROSS_COMPILE)
DESTDIR ?= $(CURDIR)
CC = $(PREFIX)gcc
AR = $(PREFIX)ar
SED = sed
MKDIR = mkdir -p
INSTALL = cp
RM = rm -rf
SRCS = $(wildcard API/*.c contrib/**/*.c)
OBJS = $(patsubst %.c,%.o,$(SRCS))
CFLAGS += -fno-strict-aliasing -fwrapv
CFLAGS += -Wall -Wextra -Wpointer-sign -Wno-unused-parameter
CFLAGS += -D_GNU_SOURCE=1
.DEFAULT: libev3api.a
libev3api.a: $(OBJS)
$(AR) rcs $@ $^
%.o: %.c
$(CC) -Os $(CFLAGS) -isystem. -c $< -o $@
libev3api.pc: libev3api.pc.in
$(SED) -e "s+@PREFIX@+$(DESTDIR)+" $< > $@
install: libev3api.a libev3api.pc
$(MKDIR) $(DESTDIR)/lib $(DESTDIR)/share/pkgconfig $(DESTDIR)/include/ev3api
$(INSTALL) libev3api.a $(DESTDIR)/lib/
$(INSTALL) *.h $(DESTDIR)/include/ev3api/
$(INSTALL) libev3api.pc $(DESTDIR)/share/pkgconfig/
uninstall:
$(RM) $(DESTDIR)/lib/libev3api.pc $(DESTDIR)/share/pkgconfig/libev3api.pc $(DESTDIR)/include/ev3api
example:
echo 'int main(void) { return EV3IsInitialized() == 1; }' | $(CC) -xc $(CFLAGS) - -L. -lev3api -I. -oexample -include ev3.h
#ifeq ($(OS),Windows_NT)
#RM = del /Q
#endif
.PHONY: clean install uninstall
clean:
$(RM) API/*.o contrib/**/*.o *.a *.d example