-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.tmp
106 lines (75 loc) · 2.37 KB
/
Makefile.tmp
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
# This is a general use makefile for librobotcontrol projects written in C.
# Just change the target name to match your main source code filename.
MACHINE := blue
TARGET = bluebot
# compiler and linker binaries
ifdef ($(MACHINE),blue)
CC := gcc
LINKER := gcc
endif
ifeq ($(MACHINE),not_blue)
CC := /opt/gcc-linaro-arm-linux-gnueabihf-4.8-2014.03_linux/bin/arm-linux-gnueabihf-gcc
LINKER := /opt/gcc-linaro-arm-linux-gnueabihf-4.8-2014.03_linux/bin/arm-linux-gnueabihf-gcc
endif
# compiler and linker flags
ifeq ($(MACHINE),blue)
WFLAGS := -Wall -Wextra -Werror=float-equal -Wuninitialized -Wunused-variable -Wdouble-promotion
CFLAGS := -g -c -Wall
LDFLAGS := -pthread -lm -lrt -l:librobotcontrol.so.1
SOURCES := $(wildcard *.c)
INCLUDES := $(wildcard *.h)
OBJECTS := $(SOURCES:$%.c=$%.o)
prefix := /usr/local
RM := rm -f
INSTALL := install -m 4755
INSTALLDIR := install -d -m 755
SYMLINK := ln -s -f
SYMLINKDIR := /etc/robotcontrol
SYMLINKNAME := link_to_startup_program
endif
ifeq ($(MACHINE),not_blue)
INCDIR := ./librobotcontrol-master/library/include
WFLAGS := -Wall -Wextra -Werror=float-equal -Wuninitialized -Wunused-variable -Wdouble-promotion
CFLAGS := -g -c -Wall -I $(INCDIR)
LDFLAGS := -pthread -lm -lrt -l:librobotcontrol.so.1
SOURCES := $(wildcard *.c)
INCLUDES := $(wildcard *.h)
OBJECTS := $(SOURCES:$%.c=$%.o)
prefix := /usr/local
RM := rm -f
INSTALL := install -m 4755
INSTALLDIR := install -d -m 755
SYMLINK := ln -s -f
SYMLINKDIR := /etc/robotcontrol
SYMLINKNAME := link_to_startup_program
endif
# linking Objects
$(TARGET): $(OBJECTS)
@$(LINKER) -o $@ $(OBJECTS) $(LDFLAGS)
@echo "Made: $@"
# compiling command
$(OBJECTS): %.o : %.c $(INCLUDES)
@$(CC) $(CFLAGS) $(WFLAGS) $(DEBUGFLAG) $< -o $@
@echo "Compiled: $@"
all: $(TARGET)
debug:
$(MAKE) $(MAKEFILE) DEBUGFLAG="-g -D DEBUG"
@echo " "
@echo "$(TARGET) Make Debug Complete"
@echo " "
install:
@$(MAKE) --no-print-directory
@$(INSTALLDIR) $(DESTDIR)$(prefix)/bin
@$(INSTALL) $(TARGET) $(DESTDIR)$(prefix)/bin
@echo "$(TARGET) Install Complete"
clean:
@$(RM) $(OBJECTS)
@$(RM) $(TARGET)
@echo "$(TARGET) Clean Complete"
uninstall:
@$(RM) $(DESTDIR)$(prefix)/bin/$(TARGET)
@echo "$(TARGET) Uninstall Complete"
runonboot:
@$(MAKE) install --no-print-directory
@$(SYMLINK) $(DESTDIR)$(prefix)/bin/$(TARGET) $(SYMLINKDIR)/$(SYMLINKNAME)
@echo "$(TARGET) Set to Run on Boot"