forked from frkd-dev/yuvit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile.linux
47 lines (35 loc) · 1.41 KB
/
Makefile.linux
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
include Common.mk
OBJDIR_32 = _linux/32
OBJDIR_64 = _linux/64
SOURCES = $(wildcard *.cpp)
OBJS = $(SOURCES:.cpp=.cpp.o)
OBJS_32 = $(addprefix $(OBJDIR_32)/,$(OBJS))
OBJS_64 = $(addprefix $(OBJDIR_64)/,$(OBJS))
EXEC_32 = $(OBJDIR_32)/$(APPNAME)
EXEC_64 = $(OBJDIR_64)/$(APPNAME)
LIBS = -lstdc++
CPUS = $(shell cat /proc/cpuinfo | grep processor | wc -l)
CXXFLAGS = -Wall -O3 -I FreeImage/Dist -DAPPVERSION=\"$(APPVERSION)\"
default: $(EXEC_32) $(EXEC_64)
$(OBJDIR_32)/%.cpp.o: %.cpp
g++ $(CXXFLAGS) -m32 -o $@ -c $<
$(OBJDIR_64)/%.cpp.o: %.cpp
g++ $(CXXFLAGS) -m64 -o $@ -c $<
$(EXEC_32): FreeImage $(OBJS_32)
g++ -m32 -o $@ $(CXXFLAGS) $(OBJS_32) $(OBJDIR_32)/libfreeimage.a $(LIBS)
$(EXEC_64): FreeImage $(OBJS_64)
g++ -m64 -o $@ $(CXXFLAGS) $(OBJS_64) $(OBJDIR_64)/libfreeimage.a $(LIBS)
FreeImage:
@make --jobs=$(CPUS) -f FreeImage.gnu
clean:
@make -f FreeImage.gnu clean
rm -r $(OBJDIR_32) $(OBJDIR_64)
package: default
@mkdir -p $(OBJDIR_32)/pkg/usr/bin $(OBJDIR_64)/pkg/usr/bin $(OBJDIR_32)/pkg/DEBIAN $(OBJDIR_64)/pkg/DEBIAN
@cp $(EXEC_32) $(OBJDIR_32)/pkg/usr/bin
@cp $(EXEC_64) $(OBJDIR_64)/pkg/usr/bin
@cp packages/control_i386_deb $(OBJDIR_32)/pkg/DEBIAN/control
@cp packages/control_amd64_deb $(OBJDIR_64)/pkg/DEBIAN/control
@fakeroot dpkg -b $(OBJDIR_32)/pkg $(APPNAME)_$(APPVERSION)-1_i386.deb
@fakeroot dpkg -b $(OBJDIR_64)/pkg $(APPNAME)_$(APPVERSION)-1_amd64.deb
.PHONY: default clean FreeImage package