-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
41 lines (31 loc) · 981 Bytes
/
Makefile
File metadata and controls
41 lines (31 loc) · 981 Bytes
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
# programs
TARGET := lcpan
SRCS := $(wildcard *.c)
OBJS := $(SRCS:.c=.o)
# directories
CURRENT_DIR := $(shell pwd)
CC := gcc
CFLAGS ?= -O3 -Wall -Wextra -Wpedantic
THREAD_FLAGS ?= -pthread
# object files that need lcptools
LCPTOOLS_CXXFLAGS := -I$(CURRENT_DIR)/lcptools/include
LCPTOOLS_LDFLAGS := -L$(CURRENT_DIR)/lcptools/lib -llcptools -Wl,-rpath,$(CURRENT_DIR)/lcptools/lib -lz
$(TARGET): $(OBJS)
$(CC) $(CFLAGS) $(PROF_FLAGS) $(LCPTOOLS_CXXFLAGS) -o $@ $^ $(LCPTOOLS_LDFLAGS) -lm $(THREAD_FLAGS)
@mkdir -p bin
mv $(TARGET) bin
rm *.o
%.o: %.c
$(CC) $(CFLAGS) $(PROF_FLAGS) $(LCPTOOLS_CXXFLAGS) -c $< -o $@ $(THREAD_FLAGS)
install: install-lcptools
@chmod +x lcpan-merge.sh
install-lcptools:
@echo "Installing lcptools"
cd lcptools && \
make install PREFIX=.
clean:
rm -f $(TARGET) $(OBJS)
profile: PROF_FLAGS = -g -fno-omit-frame-pointer -fno-optimize-sibling-calls
profile: clean $(TARGET)
rm *.o
.PHONY: profile install install-lcptools clean $(TARGET)