-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathMakefile
More file actions
75 lines (58 loc) · 1.79 KB
/
Makefile
File metadata and controls
75 lines (58 loc) · 1.79 KB
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
ARCH := $(shell uname -m)
PREFIX = /usr/local
INSTDIR = $(DESTDIR)/$(PREFIX)/bin
DIRS = add2file apps cpanel datetool editor \
exittc filetool flrun \
mirrorpicker mnttool mousetool \
network popask popup services \
stats swapfile tc-install \
tc-wbarconf wallpaper
TARGETS = $(foreach dir, $(DIRS),$(dir)/$(dir))
SRC = $(foreach dir, $(DIRS),$(wildcard $(dir)/*.cxx))
OBJ = $(SRC:.cxx=.o)
.PHONY: all clean install
%.o : %.cxx
$(CXX) -c $(CXXFLAGS) $(CPPFLAGS) $< -o $@
CXXFLAGS += -Os -s -Wall -Wextra
CXXFLAGS += -fno-rtti -fno-exceptions
LDFLAGS += -Wl,-O1 -Wl,-gc-sections
LDFLAGS += -Wl,-as-needed
# Additional flags for x86
ifeq ($(ARCH), i686)
CXXFLAGS += -march=i486 -mtune=i686
ifneq (ldscripts,$(findstring ldscripts, $(shell fltk-config --ldflags)))
LDFLAGS += "-Wl,-T/usr/local/lib/ldscripts/elf_i386.xbn"
endif
endif
# Additional flags for x86_64
ifeq ($(ARCH), x86_64)
CXXFLAGS += -mtune=generic
ifneq (ldscripts,$(findstring ldscripts, $(shell fltk-config --ldflags)))
LDFLAGS += "-Wl,-T/usr/local/lib/ldscripts/elf_x86_64.xbn"
endif
endif
# Additional flags for aarch64
ifeq ($(ARCH), aarch64)
CXXFLAGS += -march=armv8-a+crc -mtune=cortex-a72
ifneq (ldscripts,$(findstring ldscripts, $(shell fltk-config --ldflags)))
LDFLAGS += -z max-page-size=16384
endif
endif
# Additional flags for armhf
ifeq ($(ARCH), armv7l)
CXXFLAGS += -march=armv6zk -mtune=arm1176jzf-s -mfpu=vfp
ifneq (ldscripts,$(findstring ldscripts, $(shell fltk-config --ldflags)))
LDFLAGS +=
endif
endif
CXXFLAGS += $(shell fltk-config --cxxflags | sed 's@-I@-isystem @')
LDFLAGS += $(shell fltk-config --ldflags)
all: $(TARGETS)
$(TARGETS): $(OBJ)
$(CXX) -o $@ $(filter $(dir $@)%.o, $(OBJ)) $(CXXFLAGS) $(LDFLAGS)
sstrip $@
clean:
rm -f $(TARGETS) $(OBJ)
install: all
mkdir -p $(INSTDIR)
cp -a $(TARGETS) $(INSTDIR)