forked from OnionIoT/omega2-ctrl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
makefile
65 lines (47 loc) · 1.28 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
# main compiler
CXX := g++
CC := gcc
# CXX := clang --analyze # and comment out the linker last line for sanity
# define the directories
SRCDIR := src
INCDIR := include
BUILDDIR := build
BINDIR := bin
LIBDIR := lib
# define common variables
SRCEXT := c
SOURCES := $(shell find $(SRCDIR) -type f -iname "*.$(SRCEXT)" )
OBJECTS := $(patsubst $(SRCDIR)/%,$(BUILDDIR)/%,$(SOURCES:.$(SRCEXT)=.o))
# flags
CFLAGS := -g -lz # -Wall
INC := $(shell find $(INCDIR) -maxdepth 1 -type d -exec echo -I {} \;)
# define specific binaries to create
APP0 := omega2-ctrl
TARGET := $(BINDIR)/$(APP0)
all: info $(TARGET)
$(TARGET): $(OBJECTS)
@mkdir -p $(BINDIR)
@echo " Linking..."
$(CC) $^ $(CFLAGS) $(LDFLAGS) -o $(TARGET) $(LIB)
# generic: build any object file required
$(BUILDDIR)/%.o: $(SRCDIR)/%.$(SRCEXT)
@mkdir -p $(dir $@)
$(CC) $(CFLAGS) $(INC) -c -o $@ $<
clean:
@echo " Cleaning...";
$(RM) -r $(BUILDDIR) $(BINDIR) $(LIB0_TARGET)
info:
@echo "CC: $(CC)"
@echo "CFLAGS: $(CFLAGS)"
@echo "LDFLAGS: $(LDFLAGS)"
@echo "LIB: $(LIB)"
@echo "INC: $(INC)"
@echo "SOURCES: $(SOURCES)"
@echo "OBJECTS: $(OBJECTS)"
# Tests
tester:
$(CC) $(CFLAGS) test/tester.cpp $(INC) $(LIB) -o bin/tester
# Spikes
#ticket:
# $(CXX) $(CXXFLAGS) spikes/ticket.cpp $(INC) $(LIB) -o bin/ticket
.PHONY: clean