-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
97 lines (71 loc) · 1.95 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
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
CC=gcc
CXX=g++
RM= /bin/rm -vf
PYTHON=python3
ARCH=UNDEFINED
PWD=pwd
CDR=$(shell pwd)
EDCFLAGS:=$(CFLAGS)
EDLDFLAGS:=$(LDFLAGS)
EDDEBUG:=$(DEBUG)
ifeq ($(ARCH),UNDEFINED)
ARCH=$(shell uname -m)
endif
UNAME_S := $(shell uname -s)
CXXFLAGS:= -I include/ -I drivers/ -I include/imgui -I ./ -Wall -O2 -fpermissive
LIBS =
ifeq ($(UNAME_S), Linux) #LINUX
ECHO_MESSAGE = "Linux"
LIBS += -lGL `pkg-config --static --libs glfw3`
CXXFLAGS += `pkg-config --cflags glfw3`
CFLAGS = $(CXXFLAGS)
endif
ifeq ($(UNAME_S), Darwin) #APPLE
ECHO_MESSAGE = "Mac OS X"
LIBS += -framework OpenGL -framework Cocoa -framework IOKit -framework CoreVideo
LIBS += -L/usr/local/lib -L/opt/local/lib
#LIBS += -lglfw3
LIBS += -lglfw
CXXFLAGS += -I/usr/local/include -I/opt/local/include
CFLAGS = $(CXXFLAGS)
endif
EDCFLAGS:= -Wall -std=gnu11 -DUCAM_DEBUG $(EDCFLAGS)
EDLDFLAGS:= -lm -lpthread $(EDLDFLAGS)
LIBS += -lm -lpthread -ljpeg
all: EDCFLAGS:= -O2 $(EDCFLAGS)
test_ucam: EDCFLAGS:= -Os -DUNIT_TEST $(EDCFLAGS)
BUILDDRV=drivers/shserial/shserial.o \
drivers/gpiodev/gpiodev.o
BUILDGUIBASE=drivers/imgui_backends/imgui_impl_glfw.o \
drivers/imgui_backends/imgui_impl_opengl2.o \
src/imgui.o \
src/imgui_demo.o \
src/imgui_draw.o \
src/imgui_widgets.o
BUILDGUI= $(BUILDGUIBASE) \
src/guimain.o
BUILDOBJS=$(BUILDDRV) \
src/ucam.o
UCAMTARGET=ucam_tester.out
GUITARGET=main.out
all: $(GUITARGET)
@echo Finished building $(GUITARGET) for $(ECHO_MESSAGE)
sudo ./$(GUITARGET)
test_ucam: $(UCAMTARGET)
$(GUITARGET): $(BUILDOBJS) $(BUILDGUI)
$(CXX) $(BUILDOBJS) $(BUILDGUI) -o $(GUITARGET) $(CXXFLAGS) $(LIBS)
$(UCAMTARGET): $(BUILDOBJS)
$(CC) $(BUILDOBJS) $(EDCFLAGS) -Iinclude/ -Idrivers/ -I./ $(LINKOPTIONS) -o $@ \
$(EDLDFLAGS)
%.o: %.c
$(CC) $(EDCFLAGS) $(EDDEBUG) -Iinclude/ -Idrivers/ -I./ -o $@ -c $<
%.o: %.cpp
$(CXX) $(CXXFLAGS) -o $@ -c $<
.PHONY: clean
clean:
$(RM) $(BUILDOBJS)
$(RM) src/guimain.o
$(RM) $(UCAMTARGET)
$(RM) $(GUITARGET)
spotless: clean
$(RM) $(BUILDGUI)