forked from vortexntnu/vortex-acoustics
-
Notifications
You must be signed in to change notification settings - Fork 0
/
old_makefile
133 lines (95 loc) · 3.55 KB
/
old_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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
#SOURCES := DSP.c fourier.c hydrophones.c triliteration.c
#SOURCE_DIR := src
#BUILD_DIR := build
#DOX_DIR := dox
#OBJ := $(patsubst %.c,$(BUILD_DIR)/%.o,$(SOURCES))
#OUT := vortex_acoustics
#DRIVER_ARCHIVE := $(BUILD_DIR)/libdriver.a
#DRIVER_SOURCE := hardware.c io.c
#CC := gcc
# CFLAGS := -O0 -g3 -Wall -Werror -std=c11 -I$(SOURCE_DIR)
#CFLAGS := -O0 -g3 -Wall -Wno-unused-variable -Wno-switch -std=c11 -I$(SOURCE_DIR)
#LDFLAGS := -L$(BUILD_DIR) -ldriver -lcomedi
#.DEFAULT_GOAL := $(OUT)
#vortex_acoustics : $(OBJ) #| $(DRIVER_ARCHIVE)
# $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS)
#$(BUILD_DIR) :
# mkdir -p $@/src
#$(BUILD_DIR)/%.o : $(SOURCE_DIR)/%.c | $(BUILD_DIR)
# $(CC) $(CFLAGS) -c $< -o $@
#$(BUILD_DIR)/src/%.o : $(SOURCE_DIR)/src/%.c | $(BUILD_DIR)
# $(CC) $(CFLAGS) -c $< -o $@
#$(DRIVER_ARCHIVE) : $(DRIVER_SOURCE:%.c=$(BUILD_DIR)/driver/%.o)
# ar rcs $@ $^
#.PHONY: clean clean_dox
#clean :
# rm -rf $(BUILD_DIR) $(OUT)
#clean_dox:
# rm -rf $(DOX_DIR)
# The makefile is basicly copy-pasted from
# https://www.partow.net/programming/makefile/index.html
# CXX := -c++
CXX := g++
CC := gcc
# CXXFLAGS := -pedantic-errors -Wall -Wextra -Werror
CPPFLAGS := -pedantic-errors -Wall -Wextra -Werror
# LDFLAGS := -L/usr/lib -lstdc++ -lm
LDFLAGS := -lm
BUILD := ./build
OBJ_DIR := $(BUILD)/objects
APP_DIR := $(BUILD)/apps
TARGET := program
CINCLUDE :=
-IResource/STM32F7xx_HAL_Driver/Src
-IResource/CMSIS/DSP_Lib/Source/BasicMathFunctions
-IResource/CMSIS/DSP_Lib/Source/CommonTables
-IResource/CMSIS/DSP_Lib/Source/ComplexMathFunctions
-IResource/CMSIS/DSP_Lib/Source/ControllerFunctions
-IResource/CMSIS/DSP_Lib/Source/FastMathFunctions
-IResource/CMSIS/DSP_Lib/Source/FilteringFunctions
-IResource/CMSIS/DSP_Lib/Source/MatrixFunctions
-IResource/CMSIS/DSP_Lib/Source/StatisticsFunctions
-IResource/CMSIS/DSP_Lib/Source/SupportFunctions
-IResource/CMSIS/DSP_Lib/Source/TransformFunctions
CXXINCLUDE :=
-ISource
CSRC := \
$(wildcard Resource/STM32F7xx_HAL_Driver/Src/*.c) \
$(wildcard Resource/CMSIS/DSP_Lib/Source/BasicMathFunctions/*.c) \
$(wildcard Resource/CMSIS/DSP_Lib/Source/CommonTables/*.c) \
$(wildcard Resource/CMSIS/DSP_Lib/Source/ComplexMathFunctions/*.c) \
$(wildcard Resource/CMSIS/DSP_Lib/Source/ControllerFunctions/*.c) \
$(wildcard Resource/CMSIS/DSP_Lib/Source/FastMathFunctions/*.c) \
$(wildcard Resource/CMSIS/DSP_Lib/Source/FilteringFunctions/*.c) \
$(wildcard Resource/CMSIS/DSP_Lib/Source/MatrixFunctions/*.c) \
$(wildcard Resource/CMSIS/DSP_Lib/Source/StatisticsFunctions/*.c) \
$(wildcard Resource/CMSIS/DSP_Lib/Source/SupportFunctions/*.c) \
$(wildcard Resource/CMSIS/DSP_Lib/Source/TransformFunctions/*.c) \
CXXSRC :=
$(wildcard Source/*.cpp) \
COBJ := $(CSRC:%.c=$(OBJ_DIR)/%.o)
CXXOBJ := $(CXXSRC:%.cpp=$(OBJ_DIR)/%.o)
all: build $(APP_DIR)/$(TARGET)
$(OBJ_DIR)/%.o: %.c
@mkdir -p $(@D)
$(CC) $(CPPFLAGS) $(CINCLUDE) -c $< -o $@ $(LDFLAGS)
$(APP_DIR)/$(TARGET): $(OBJECTS)
@mkdir -p $(@D)
$(CC) $(CPPFLAGS) -o $(APP_DIR)/$(TARGET) $^ $(LDFLAGS)
$(OBJ_DIR)/%.o: %.cpp
@mkdir -p $(@D)
$(CXX) $(CXXFLAGS) $(CXXINCLUDE) -c $< -o $@ $(LDFLAGS)
$(APP_DIR)/$(TARGET): $(OBJECTS)
@mkdir -p $(@D)
$(CXX) $(CXXFLAGS) -o $(APP_DIR)/$(TARGET) $^ $(LDFLAGS)
.PHONY: all build clean debug release
build:
@mkdir -p $(APP_DIR)
@mkdir -p $(OBJ_DIR)
debug: CPPFLAGS += -DDEBUG -g
debug: all
release: CPPFLAGS += -O2
release: all
clean:
-@rm -rvf $(OBJ_DIR)/*.o
-@rm -rvf $(APP_DIR)/*.o