#The following variables can be set by the user:
#
#DEBUG - set if a debug build is needed
#
ifndef DEBUG
DIRNAME=Release
DEBUGFLAGS=-Os
DEBUGLINKFLAGS=-s
else
DIRNAME=Debug
DEBUGFLAGS=-g
DEBUGLINKFLAGS=
endif
COMMON = ../plugins/common
WIDE = 1
DIRBIT = 32
OBJDIR = ./$(DIRNAME).$(DIRBIT).gcc/obj
EXEDIR = ./$(DIRNAME).$(DIRBIT).gcc
EXENAME = Far.exe
EXEFULLNAME = $(EXEDIR)/$(EXENAME)
FARINCLUDE = ./Include
DEF = far.def
DEPFILE = far.gcc.dep
SRCS = \
CachedWrite.cpp \
cddrv.cpp \
CFileMask.cpp \
chgmmode.cpp \
chgprior.cpp \
clipboard.cpp \
cmdline.cpp \
cmem.cpp \
config.cpp \
constitle.cpp \
copy.cpp \
ctrlobj.cpp \
cvtname.cpp \
datetime.cpp \
delete.cpp \
dialog.cpp \
dirinfo.cpp \
dirmix.cpp \
dizlist.cpp \
dlgedit.cpp \
DList.cpp \
drivemix.cpp \
edit.cpp \
editor.cpp \
eject.cpp \
execute.cpp \
farexcpt.cpp \
farqueue.cpp \
farrtl.cpp \
farwinapi.cpp \
ffolders.cpp \
fileattr.cpp \
fileedit.cpp \
filefilter.cpp \
filefilterparams.cpp \
filelist.cpp \
FileMasksProcessor.cpp \
FileMasksWithExclude.cpp \
fileowner.cpp \
filepanels.cpp \
filestr.cpp \
filetype.cpp \
fileview.cpp \
findfile.cpp \
flink.cpp \
flmodes.cpp \
flplugin.cpp \
flshow.cpp \
flupdate.cpp \
fnparce.cpp \
foldtree.cpp \
frame.cpp \
gettable.cpp \
global.cpp \
grabber.cpp \
headers.cpp \
help.cpp \
hilight.cpp \
history.cpp \
hmenu.cpp \
hotplug.cpp \
imports.cpp \
infolist.cpp \
interf.cpp \
iswind.cpp \
keybar.cpp \
keyboard.cpp \
language.cpp \
local.cpp \
localOEM.cpp \
lockscrn.cpp \
macro.cpp \
main.cpp \
manager.cpp \
menubar.cpp \
message.cpp \
mix.cpp \
mkdir.cpp \
modal.cpp \
namelist.cpp \
network.cpp \
options.cpp \
palette.cpp \
panel.cpp \
panelmix.cpp \
pathmix.cpp \
plist.cpp \
plognmn.cpp \
plugapi.cpp \
PluginA.cpp \
plugins.cpp \
PluginW.cpp \
poscache.cpp \
print.cpp \
processname.cpp \
qview.cpp \
rdrwdsk.cpp \
RefreshFrameManager.cpp \
RegExp.cpp \
registry.cpp \
savefpos.cpp \
savescr.cpp \
scantree.cpp \
scrbuf.cpp \
scrobj.cpp \
scrsaver.cpp \
setattr.cpp \
setcolor.cpp \
stddlg.cpp \
strmix.cpp \
synchro.cpp \
syntax.cpp \
syslog.cpp \
TaskBar.cpp \
TPreRedrawFunc.cpp \
treelist.cpp \
tvar.cpp \
udlist.cpp \
UnicodeString.cpp \
usermenu.cpp \
viewer.cpp \
vmenu.cpp \
xlat.cpp \
hook_wow64.c
UCD_SRCS= \
prmem.c \
CharDistribution.cpp \
JpCntx.cpp \
LangBulgarianModel.cpp \
LangCyrillicModel.cpp \
LangGreekModel.cpp \
LangHebrewModel.cpp \
LangHungarianModel.cpp \
LangThaiModel.cpp \
nsBig5Prober.cpp \
nsCharSetProber.cpp \
nsEscCharsetProber.cpp \
nsEscSM.cpp \
nsEUCJPProber.cpp \
nsEUCKRProber.cpp \
nsEUCTWProber.cpp \
nsGB2312Prober.cpp \
nsHebrewProber.cpp \
nsLatin1Prober.cpp \
nsMBCSGroupProber.cpp \
nsMBCSSM.cpp \
nsSBCharSetProber.cpp \
nsSBCSGroupProber.cpp \
nsSJISProber.cpp \
nsUniversalDetector.cpp \
nsUTF8Prober.cpp \
OBJS = $(patsubst %.cpp,$(OBJDIR)/%.o,$(filter %.cpp,$(SRCS))) $(patsubst %.c,$(OBJDIR)/%.o,$(filter %.c,$(SRCS))) $(OBJDIR)/far.rc.o
UCD_OBJS = $(patsubst %.cpp,$(OBJDIR)/%.o,$(filter %.cpp,$(UCD_SRCS))) $(patsubst %.c,$(OBJDIR)/%.o,$(filter %.c,$(UCD_SRCS)))
MAP = $(patsubst %.exe,%.map,$(EXEFULLNAME))
CXX = g++
CC = gcc
RM = rm -f
RMR = rm -fR
CP = cp -f
M4 = tools/m4 -P -DFARBIT=$(DIRBIT)
GAWK = tools/gawk
MV = mv -f
MKDIR = mkdir -p
WINDRES = windres -D__FARBIT__=$(DIRBIT)
DEFINES = -D FAR_ALPHA_VERSION -D UNICODE -D _UNICODE
CCFLAGS = $(DEBUGFLAGS) -mno-cygwin -pipe $(DEFINES) -funsigned-char -fomit-frame-pointer -fno-exceptions -fno-rtti -Wall -Wno-missing-braces -Wno-unknown-pragmas -Wno-switch -Wno-strict-aliasing
CFLAGS = $(DEBUGFLAGS) -mno-cygwin -pipe $(DEFINES) -funsigned-char -fomit-frame-pointer -fno-exceptions -Wall -Wno-missing-braces -Wno-unknown-pragmas -Wno-switch
LNKFLAGS = -mno-cygwin $(DEBUGLINKFLAGS) -lmpr -lwinspool -lole32 -lsecur32
.PHONY: all
all: dirs lng depfile
@$(MAKE) -f makefile_gcc build
.PHONY: lng
lng: farlang.templ
@echo generating language files
@tools/lng.generator.exe -nc -i lang.ini -ol "$(EXEDIR)" farlang.templ
.PHONY: depfile
depfile:
@$(GAWK) -f ./scripts/mkdep.awk -v compiler=gcc mkdep.list > $(DEPFILE)
.PHONY: dirs
dirs:
@$(MKDIR) $(EXEDIR)
@$(MKDIR) $(OBJDIR)
@$(MKDIR) $(FARINCLUDE)
.PHONY: build
build: $(EXEFULLNAME) $(EXEDIR)/FarEng.hlf $(EXEDIR)/FarRus.hlf $(EXEDIR)/FarHun.hlf $(EXEDIR)/File_id.diz $(FARINCLUDE)/farcolor.hpp $(FARINCLUDE)/farkeys.hpp $(FARINCLUDE)/plugin.hpp $(FARINCLUDE)/PluginW.pas $(FARINCLUDE)/FarColorW.pas $(FARINCLUDE)/FarKeysW.pas
$(EXEFULLNAME): Far.exe.manifest far.rc copyright.inc farversion.inc $(OBJS) $(UCD_OBJS) $(DEF)
@echo linking $@
@$(CXX) -o $@ $(OBJS) $(UCD_OBJS) $(LNKFLAGS) -Xlinker -Map -Xlinker $(MAP)
$(OBJDIR)/hook_wow64.o: hook_wow64.c
@echo compiling $<
@$(CC) $(CFLAGS) -fno-strict-aliasing -c -o $@ $<
$(OBJDIR)/%.o: %.cpp
@echo compiling $<
@$(CXX) $(CCFLAGS) -c -include $(OBJDIR)/headers.hpp -o $@ $<
$(OBJDIR)/headers.hpp.gch: headers.hpp
@echo making precompiled headers
@$(CXX) -x c++-header -c $(CCFLAGS) -o $@ $<
$(OBJS): $(OBJDIR)/headers.hpp.gch
$(OBJDIR)/%.o: ./UCD/%.c
@echo compiling $<
@$(CC) $(CFLAGS) -c -o $@ $<
$(OBJDIR)/%.o: ./UCD/%.cpp
@echo compiling $<
@$(CXX) $(CCFLAGS) -c -o $@ $<
$(OBJDIR)/far.rc.o: far.rc res.hpp Far.ico
@echo compiling resource file
@$(WINDRES) -i $< -o $@
Far.exe.manifest: Far.exe.manifest.m4 farversion.m4 tools.m4 vbuild.m4
@echo generating $@
@$(M4) Far.exe.manifest.m4 > $@
far.rc: far.rc.m4 farversion.m4 tools.m4 vbuild.m4 res.hpp Far.exe.manifest
@echo generating $@
@$(M4) far.rc.m4 > $@
copyright.inc: copyright.inc.m4 farversion.m4 tools.m4 vbuild.m4
@echo generating $@
@$(M4) copyright.inc.m4 | $(GAWK) -f ./scripts/enc.awk > $@
farversion.inc: farversion.inc.m4 farversion.m4 tools.m4 vbuild.m4
@echo generating $@
@$(M4) farversion.inc.m4 > $@
farlang.templ: farlang.templ.m4 farversion.m4 tools.m4 vbuild.m4
@echo generating $@
@$(M4) farlang.templ.m4 > $@
$(EXEDIR)/FarEng.hlf: FarEng.hlf.m4 farversion.m4 tools.m4 vbuild.m4
@echo generating $@
@$(GAWK) -f ./scripts/mkhlf.awk FarEng.hlf.m4 | $(M4) > $@
$(EXEDIR)/FarRus.hlf: FarRus.hlf.m4 farversion.m4 tools.m4 vbuild.m4
@echo generating $@
@$(GAWK) -f ./scripts/mkhlf.awk FarRus.hlf.m4 | $(M4) > $@
$(EXEDIR)/FarHun.hlf: FarHun.hlf.m4 farversion.m4 tools.m4 vbuild.m4
@echo generating $@
@$(GAWK) -f ./scripts/mkhlf.awk FarHun.hlf.m4 | $(M4) > $@
$(EXEDIR)/File_id.diz: File_id.diz.m4 farversion.m4 tools.m4 vbuild.m4
@echo generating $@
@$(M4) File_id.diz.m4 > $@
$(FARINCLUDE)/farcolor.hpp: colors.hpp farversion.m4 tools.m4 vbuild.m4
@echo generating $@
@$(M4) -DINPUT=colors.hpp headers.m4 > $@
$(FARINCLUDE)/farkeys.hpp: keys.hpp farversion.m4 tools.m4 vbuild.m4
@echo generating $@
@$(M4) -DINPUT=keys.hpp headers.m4 > $@
$(FARINCLUDE)/plugin.hpp: plugin.hpp farversion.m4 tools.m4 vbuild.m4
@echo generating $@
@$(M4) -DINPUT=plugin.hpp headers.m4 > $@
$(FARINCLUDE)/PluginW.pas: PluginW.pas farversion.m4 tools.m4 vbuild.m4
@echo generating $@
@$(M4) -DINPUT=PluginW.pas headers.m4 > $@
$(FARINCLUDE)/FarColorW.pas: FarColorW.pas farversion.m4 tools.m4 vbuild.m4
@echo generating $@
@$(M4) -DINPUT=FarColorW.pas headers.m4 > $@
$(FARINCLUDE)/FarKeysW.pas: FarKeysW.pas farversion.m4 tools.m4 vbuild.m4
@echo generating $@
@$(M4) -DINPUT=FarKeysW.pas headers.m4 > $@
@$(CP) changelog $(EXEDIR)
@$(RMR) $(EXEDIR)/obj
ifeq ($(MAKECMDGOALS),build)
include $(DEPFILE)
endif
.PHONY: clean
clean:
@echo cleaning
@$(RM) $(OBJS)
@$(RM) $(UCD_OBJS)
@$(RM) $(DEPFILE)
@$(RM) $(OBJDIR)/headers.hpp.gch
@$(RM) $(EXEFULLNAME) $(MAP)
@$(RM) Far.exe.manifest far.rc copyright.inc farversion.inc
@$(RM) $(EXEDIR)/*.lng
@$(RM) $(EXEDIR)/*.hlf
@$(RM) farlang.templ lang.hpp lang.ini
@$(RM) $(EXEDIR)/*
@$(RMR) $(EXEDIR)
@$(RMR) $(FARINCLUDE)