forked from matrefeytontias/nKaruga
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile.linux_static
36 lines (30 loc) · 1004 Bytes
/
Makefile.linux_static
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
CC = gcc
CXX = g++
LD = g++
SDL_CONFIG = ./buildscript/final/bin/sdl2-config
CFLAGS = -Ofast -fdata-sections -ffunction-sections `$(SDL_CONFIG) --cflags` -DHOMEDIR
CXXFLAGS = $(CFLAGS) -std=c++11 -fno-exceptions -fno-rtti
LDFLAGS =-static-libgcc -static-libstdc++
LDFLAGS += -L./buildscript/final/lib -lSDL2 -lSDL2_mixer
LDFLAGS += -lX11 -lXext -lXcursor -lXinerama -lXi -lXrandr -lXss -lXxf86vm
LDFLAGS += -lxcb -lXau -lXrender -lXcursor -lXdmcp -lpthread -lrt -ldl
LDFLAGS += -lm -Wl,--as-needed,--gc-sections -flto -s
LDFLAGS += -pthread -ldl
EXE = nKaruga
DIRECTORIES = ./src
OBJS = $(patsubst %.c, %.o, $(shell find $(DIRECTORIES) -name \*.c))
OBJS += $(patsubst %.cpp, %.o, $(shell find $(DIRECTORIES) -name \*.cpp))
#
all: $(EXE).elf
%.o: %.c
@echo Compiling $<...
@$(CC) $(CFLAGS) -c $< -o $@
%.o: %.cpp
@echo Compiling $<...
@$(CXX) $(CXXFLAGS) -c $< -o $@
$(EXE).elf: $(OBJS)
+$(LD) $^ -o $@ $(CXXFLAGS) $(LDFLAGS)
.PHONY: clean
clean:
rm -f `find . -name \*.o`
rm -f $(EXE).elf