summaryrefslogtreecommitdiff
path: root/Makefile
blob: 0b4aefd9b693522f98c614a15440617e12a79803 (plain)
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
134
135
APPNAME     = FreeFileSync
prefix      = /usr
BINDIR      = $(DESTDIR)$(prefix)/bin
SHAREDIR    = $(DESTDIR)$(prefix)/share
APPSHAREDIR = $(SHAREDIR)/$(APPNAME)

COMMON_COMPILE_FLAGS = -Wall -pipe `pkg-config --cflags gtk+-2.0` -O3 -pthread -std=gnu++0x -DNDEBUG -DwxUSE_UNICODE -DFFS_LINUX -DZEN_PLATFORM_OTHER -DWXINTL_NO_GETTEXT_MACRO -I./shared
COMMON_LINK_FLAGS  = -O3 -pthread

#default build
FFS_CPPFLAGS = $(COMMON_COMPILE_FLAGS) `wx-config --cxxflags --debug=no --unicode=yes`
LINKFLAGS    = $(COMMON_LINK_FLAGS) `wx-config --libs --debug=no --unicode=yes` -lboost_thread

#static build used for precompiled release
ifeq ($(BUILD),release)
FFS_CPPFLAGS = $(COMMON_COMPILE_FLAGS) `wx-config --cxxflags --debug=no --unicode=yes --static=yes`
LINKFLAGS    = $(COMMON_LINK_FLAGS) `wx-config --libs --debug=no --unicode=yes --static=yes` /usr/local/lib/libboost_thread.a
endif
#####################################################################################################


#support for GTKMM
FFS_CPPFLAGS += `pkg-config --cflags gtkmm-2.4`
LINKFLAGS += `pkg-config --libs gtkmm-2.4`

#support for SELinux (optional)
SELINUX_EXISTING=$(shell pkg-config --exists libselinux && echo YES)
ifeq ($(SELINUX_EXISTING),YES)
FFS_CPPFLAGS += `pkg-config --cflags libselinux ` -DHAVE_SELINUX
LINKFLAGS    += `pkg-config --libs libselinux`
endif

#support for Ubuntu Unity (optional)
UNITY_EXISTING=$(shell pkg-config --exists unity && echo YES)
ifeq ($(UNITY_EXISTING),YES)
FFS_CPPFLAGS += `pkg-config --cflags unity` -DHAVE_UBUNTU_UNITY
LINKFLAGS    += `pkg-config --libs unity`
endif

FILE_LIST=              #internal list of all *.cpp files needed for compilation
FILE_LIST+=structures.cpp
FILE_LIST+=algorithm.cpp
FILE_LIST+=comparison.cpp
FILE_LIST+=synchronization.cpp
FILE_LIST+=file_hierarchy.cpp
FILE_LIST+=application.cpp
FILE_LIST+=ui/gui_generated.cpp
FILE_LIST+=shared/util.cpp
FILE_LIST+=ui/grid_view.cpp
FILE_LIST+=ui/main_dlg.cpp
FILE_LIST+=ui/batch_config.cpp
FILE_LIST+=ui/sync_cfg.cpp
FILE_LIST+=ui/check_version.cpp
FILE_LIST+=ui/batch_status_handler.cpp
FILE_LIST+=ui/gui_status_handler.cpp
FILE_LIST+=ui/tray_icon.cpp
FILE_LIST+=ui/search.cpp
FILE_LIST+=ui/switch_to_gui.cpp
FILE_LIST+=ui/msg_popup.cpp
FILE_LIST+=ui/progress_indicator.cpp
FILE_LIST+=library/parallel_scan.cpp
FILE_LIST+=library/custom_grid.cpp
FILE_LIST+=library/error_log.cpp
FILE_LIST+=library/status_handler.cpp
FILE_LIST+=library/resources.cpp
FILE_LIST+=ui/small_dlgs.cpp
FILE_LIST+=library/process_xml.cpp
FILE_LIST+=library/icon_buffer.cpp
FILE_LIST+=library/statistics.cpp
FILE_LIST+=library/hard_filter.cpp
FILE_LIST+=library/binary.cpp
FILE_LIST+=library/db_file.cpp
FILE_LIST+=library/dir_lock.cpp
FILE_LIST+=shared/i18n.cpp
FILE_LIST+=shared/localization.cpp
FILE_LIST+=shared/file_io.cpp
FILE_LIST+=shared/taskbar.cpp
FILE_LIST+=shared/dir_name.cpp
FILE_LIST+=shared/guid.cpp
FILE_LIST+=shared/xml_base.cpp
FILE_LIST+=shared/last_error.cpp
FILE_LIST+=shared/custom_tooltip.cpp
FILE_LIST+=shared/file_handling.cpp
FILE_LIST+=shared/resolve_path.cpp
FILE_LIST+=shared/file_traverser.cpp
FILE_LIST+=shared/standard_paths.cpp
FILE_LIST+=shared/zstring.cpp
FILE_LIST+=shared/app_main.cpp
FILE_LIST+=shared/custom_button.cpp
FILE_LIST+=shared/toggle_button.cpp
FILE_LIST+=shared/folder_history_box.cpp
FILE_LIST+=shared/serialize.cpp
FILE_LIST+=shared/file_id.cpp
FILE_LIST+=shared/recycler.cpp
FILE_LIST+=shared/help_provider.cpp

#list of all *.o files
OBJECT_LIST=$(foreach file, $(FILE_LIST), OBJ/FFS_Release_GCC_Make/$(subst .cpp,.o,$(notdir $(file))))

#build list of all dependencies
DEP_LIST=$(foreach file, $(FILE_LIST), $(subst .cpp,.dep,$(file)))


all: FreeFileSync

init: 
	if [ ! -d ./OBJ ]; then mkdir OBJ; fi
	if [ ! -d ./OBJ/FFS_Release_GCC_Make ]; then mkdir OBJ/FFS_Release_GCC_Make; fi

%.dep : %.cpp 
#strip path information
	g++ $(FFS_CPPFLAGS) -c $< -o OBJ/FFS_Release_GCC_Make/$(subst .cpp,.o,$(notdir $<))

FreeFileSync: init $(DEP_LIST)
#respect linker order: wxWidgets libraries last
	g++ -o ./BUILD/$(APPNAME) $(OBJECT_LIST) $(LINKFLAGS)

clean:
	rm -rf OBJ/FFS_Release_GCC_Make
	rm -f BUILD/$(APPNAME)

install:
	if [ ! -d $(BINDIR) ]; then mkdir -p $(BINDIR); fi
	if [ ! -d $(APPSHAREDIR) ]; then mkdir -p $(APPSHAREDIR); fi

	cp BUILD/$(APPNAME) $(BINDIR)
	cp -R BUILD/Languages/ \
	BUILD/Help/ \
	BUILD/Compare_Complete.wav \
	BUILD/Sync_Complete.wav \
	BUILD/Resources.zip \
	BUILD/Changelog.txt \
	BUILD/License.txt \
	BUILD/styles.rc \
	$(APPSHAREDIR)
bgstack15