2010-12-05 20:12:42 +01:00
|
|
|
# *** THERE ARE NO USER-EDITABLE ITEMS HERE. ***
|
2010-12-14 19:53:17 +01:00
|
|
|
#
|
|
|
|
# TODO:
|
|
|
|
# * Allow variables to be overridden on the CL.
|
2010-12-05 20:12:42 +01:00
|
|
|
|
|
|
|
.PHONY: all install clean subdirs $(SUBDIRS)
|
2013-05-03 03:07:00 +02:00
|
|
|
all: subdirs $(PROGRAM)
|
2011-12-22 22:20:34 +01:00
|
|
|
.DEFAULT_GOAL := all
|
2010-12-05 20:12:42 +01:00
|
|
|
|
2013-05-03 03:07:00 +02:00
|
|
|
ifneq (no, $(BUILD_LIB))
|
|
|
|
all: $(LIB) $(LIB_SHARED)
|
|
|
|
endif
|
|
|
|
|
2010-12-05 20:12:42 +01:00
|
|
|
OBJ = $(addsuffix .o, $(basename $(SRC)))
|
|
|
|
DEP = $(addsuffix .d, $(basename $(SRC)))
|
|
|
|
|
|
|
|
###################
|
|
|
|
# PLATFORM SPECIFIC
|
|
|
|
###################
|
|
|
|
|
|
|
|
ifeq (yes, $(BUILD_DARWIN))
|
2014-01-03 01:25:23 +01:00
|
|
|
CFLAGS += -mmacosx-version-min=10.7 -gfull
|
|
|
|
CXXFLAGS += -mmacosx-version-min=10.7 -gfull
|
|
|
|
LDFLAGS += -mmacosx-version-min=10.7 -Wl,-dead_strip
|
2010-12-05 20:12:42 +01:00
|
|
|
LIB_SHARED_LINK = $(LIB_SHARED_LINK_OSX)
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
|
|
###########
|
|
|
|
# LIBRARIES
|
|
|
|
###########
|
|
|
|
$(LIB) : $(OBJ)
|
|
|
|
$(BIN_AR) cru $@ $(OBJ)
|
|
|
|
$(BIN_RANLIB) $@
|
|
|
|
|
|
|
|
ifdef LIB_SHARED
|
|
|
|
LIB_SHARED_FULL = $(LIB_SHARED).$(LIB_VERSION)
|
|
|
|
$(LIB_SHARED) : $(OBJ)
|
2011-12-22 22:24:40 +01:00
|
|
|
$(BIN_CXX) $(LIB_SHARED_LINK) $(LDFLAGS) $(OBJ) $(LIBS) -o $(LIB_SHARED_FULL)
|
Merge the dynamic menu, hotkey and toolbar branch to trunk. This doesn't include Windows support as vs2008 was being a major pain. This involves revisions r4921:4950, r4961:5002, r5005:5006, r5008:5056, r5062:5065, r5072, r5081:5082, r5087, r5096:5110, r5124:5125. Updates #1258.
Originally committed to SVN as r5126.
2011-01-05 14:00:46 +01:00
|
|
|
$(BIN_LN) -sf $(LIB_SHARED_FULL) $(LIB_SHARED)
|
2010-12-05 20:12:42 +01:00
|
|
|
|
|
|
|
CLEANFILES+= $(LIB_SHARED_FULL)
|
|
|
|
endif
|
|
|
|
|
|
|
|
##########
|
|
|
|
# PROGRAMS
|
|
|
|
##########
|
|
|
|
$(PROGRAM): $(OBJ)
|
2011-12-22 22:24:40 +01:00
|
|
|
$(BIN_CXX) -o $@ $(LDFLAGS) $(OBJ) $(LIBS)
|
2010-12-05 20:12:42 +01:00
|
|
|
|
|
|
|
##########
|
|
|
|
# CLEANING
|
|
|
|
##########
|
|
|
|
clean: $(SUBDIRS)
|
|
|
|
$(BIN_RM) -f $(OBJ) $(CLEANFILES) $(LIB) $(LIB_SHARED) $(PROGRAM)
|
2012-01-08 02:03:53 +01:00
|
|
|
ifdef PRECOMPILED_HEADER_NAME
|
|
|
|
$(BIN_RM) -f $(PRECOMPILED_HEADER_NAME).gch
|
|
|
|
endif
|
|
|
|
|
|
|
|
mostlyclean: $(SUBDIRS)
|
|
|
|
$(BIN_RM) -f $(OBJ) $(CLEANFILES) $(LIB) $(LIB_SHARED) $(PROGRAM)
|
2010-12-05 20:12:42 +01:00
|
|
|
|
|
|
|
distclean: clean
|
|
|
|
$(BIN_RM) -rf $(DISTCLEANFILES) $(DEP)
|
|
|
|
ifdef PRECOMPILED_HEADER_NAME
|
|
|
|
$(BIN_RM) -f $(PRECOMPILED_HEADER_NAME).gch
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
|
|
#########
|
|
|
|
# INSTALL
|
|
|
|
#########
|
|
|
|
ifeq (install, $(MAKECMDGOALS))
|
2012-08-19 23:33:50 +02:00
|
|
|
INSTALL_LIB=$(addprefix $(P_LIB)/, $(LIB_SHARED) $(LIB_SHARED_FULL))
|
2010-12-05 20:12:42 +01:00
|
|
|
endif
|
|
|
|
|
2012-01-10 21:56:15 +01:00
|
|
|
BIN_SINSTALL=$(BIN_INSTALL)
|
|
|
|
|
2010-12-05 20:12:42 +01:00
|
|
|
install: $(SUBDIRS) install-share install-program install-lib
|
|
|
|
|
2012-01-08 02:03:59 +01:00
|
|
|
install-strip:
|
|
|
|
$(MAKE) BIN_SINSTALL='$(BIN_INSTALL) -s' install
|
|
|
|
|
2010-12-05 20:12:42 +01:00
|
|
|
install-program:
|
|
|
|
ifdef PROGRAM_INSTALL
|
2012-01-08 02:03:45 +01:00
|
|
|
@$(BIN_MKDIR) -p $(DESTDIR)$(P_BINDIR)
|
2012-01-10 21:56:15 +01:00
|
|
|
@$(BIN_SINSTALL) $(PROGRAM) $(DESTDIR)$(P_BINDIR)/$(PROGRAM)
|
2010-12-05 20:12:42 +01:00
|
|
|
endif
|
|
|
|
|
|
|
|
install-lib:
|
|
|
|
ifdef LIB_SHARED_INSTALL
|
2012-01-08 02:03:45 +01:00
|
|
|
$(BIN_MKDIR) -p $(DESTDIR)$(P_LIB)
|
2012-01-10 21:56:15 +01:00
|
|
|
$(BIN_SINSTALL) $(LIB_SHARED_FULL) $(DESTDIR)$(P_LIB)/$(LIB_SHARED_FULL)
|
2012-01-08 02:03:45 +01:00
|
|
|
$(BIN_LN) -sf $(LIB_SHARED_FULL) $(DESTDIR)$(P_LIB)/$(LIB_SHARED)
|
2010-12-05 20:12:42 +01:00
|
|
|
endif
|
|
|
|
|
|
|
|
install-share:
|
|
|
|
ifdef DATA_SHARE
|
2012-01-08 02:03:45 +01:00
|
|
|
@$(BIN_MKDIR) -p $(addprefix $(DESTDIR)$(P_DATA)/, $(dir $(DATA_SHARE)))
|
2010-12-05 20:12:42 +01:00
|
|
|
@for i in $(DATA_SHARE); do \
|
2012-01-08 02:03:45 +01:00
|
|
|
$(BIN_ECHO) "$(BIN_INSTALL) $$i $(DESTDIR)$(P_DATA)/$$i"; \
|
|
|
|
$(BIN_INSTALL) $$i $(DESTDIR)$(P_DATA)/$$i; \
|
2010-12-05 20:12:42 +01:00
|
|
|
done
|
|
|
|
endif
|
|
|
|
ifdef DATA_SHARE_DOC
|
2012-01-08 02:03:45 +01:00
|
|
|
@$(BIN_MKDIR) -p $(addprefix $(DESTDIR)$(P_DOC)/, $(dir $(DATA_SHARE_DOC)))
|
2010-12-05 20:12:42 +01:00
|
|
|
@for i in $(DATA_SHARE_DOC); do \
|
2012-01-08 02:03:45 +01:00
|
|
|
$(BIN_ECHO) "$(BIN_INSTALL) $$i $(DESTDIR)$(P_DOC)/$$i"; \
|
|
|
|
$(BIN_INSTALL) $$i $(DESTDIR)$(P_DOC)/$$i; \
|
2010-12-05 20:12:42 +01:00
|
|
|
done
|
|
|
|
endif
|
|
|
|
|
|
|
|
##############
|
|
|
|
# DISTRIBUTION
|
|
|
|
##############
|
2012-01-14 19:46:49 +01:00
|
|
|
dist: distdir
|
|
|
|
@$(BIN_TAR) chf - --posix "$(PACKAGE_TARNAME)" | $(BIN_GZIP) -c > "$(PACKAGE_TARNAME).tar.gz"
|
|
|
|
@rm -rf $(PACKAGE_TARNAME)
|
|
|
|
|
2010-12-05 20:12:42 +01:00
|
|
|
distdir:
|
|
|
|
@if ! test -f packages/distfile/distfile.sh; then \
|
|
|
|
echo "Please run this from the parent directory."; \
|
|
|
|
exit 1; \
|
|
|
|
fi
|
2012-01-14 19:46:49 +01:00
|
|
|
@${SHELL} packages/distfile/distfile.sh $(MAKE) $(PACKAGE_TARNAME)
|
2010-12-05 20:12:42 +01:00
|
|
|
|
|
|
|
distfiles: $(SUBDIRS)
|
2012-01-14 19:46:43 +01:00
|
|
|
@for i in $(SRC) $(HEADER) $(PO) $(EXTRA_DIST); do \
|
2010-12-05 20:12:42 +01:00
|
|
|
echo $(CURDIR)/$$i; \
|
|
|
|
done
|
|
|
|
|
|
|
|
|
|
|
|
########################
|
|
|
|
# SUBDIRECTORY TRAVERSAL
|
|
|
|
########################
|
|
|
|
subdirs: $(SUBDIRS)
|
|
|
|
|
|
|
|
$(SUBDIRS):
|
|
|
|
$(MAKE) -C $@ $(MAKECMDGOALS)
|
|
|
|
|
|
|
|
# Set relations to ensure dependencies are built before their targets during parallel builds.
|
2014-03-11 17:47:53 +01:00
|
|
|
automation: libaegisub vendor/lua
|
|
|
|
src: vendor/universalchardet vendor/lua tools libaegisub
|
2010-12-05 20:12:42 +01:00
|
|
|
tests: libaegisub
|
2013-12-24 21:41:42 +01:00
|
|
|
tools: libaegisub
|
2010-12-05 20:12:42 +01:00
|
|
|
reporter: src
|
|
|
|
|
2011-12-22 22:20:34 +01:00
|
|
|
$(OBJ): $(GLOBAL_DEPS)
|
2010-12-05 20:12:42 +01:00
|
|
|
|
2012-05-26 22:16:02 +02:00
|
|
|
OBJCXXFLAGS := $(CXXFLAGS)
|
|
|
|
|
2010-12-05 20:12:42 +01:00
|
|
|
####################
|
|
|
|
# PRECOMPILED HEADER
|
|
|
|
####################
|
2014-04-16 04:33:37 +02:00
|
|
|
ifdef PRECOMPILED_HEADER_NAME
|
|
|
|
ifeq (yes, $(PRECOMPILED_HEADER))
|
2012-06-23 19:22:08 +02:00
|
|
|
CXXFLAGS += -include $(PRECOMPILED_HEADER_NAME) $(PCHFLAGS)
|
2010-12-05 20:12:42 +01:00
|
|
|
# This hack is required until we can use the 'private' keyword (gmake 3.82) to avoid all the
|
|
|
|
# per-object CXXFLAGS being triggered by the ($OBJ) line.
|
|
|
|
CXXFLAGS_GNU_MAKE_SUCKS := $(CXXFLAGS)
|
|
|
|
$(OBJ): | $(PRECOMPILED_HEADER_NAME).gch
|
|
|
|
$(PRECOMPILED_HEADER_NAME).gch: CXXFLAGS = $(CXXFLAGS_GNU_MAKE_SUCKS)
|
2012-12-06 03:46:25 +01:00
|
|
|
$(PRECOMPILED_HEADER_NAME).gch: $(PRECOMPILED_HEADER_NAME)
|
2014-04-16 04:33:37 +02:00
|
|
|
else
|
|
|
|
CXXFLAGS += -include acconf.h
|
2010-12-05 20:12:42 +01:00
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
|
|
########
|
|
|
|
# CCACHE
|
|
|
|
########
|
|
|
|
ifeq (yes, $(CCACHE_ENABLE))
|
|
|
|
CXX_ENV = $(CCACHE_ENV)
|
|
|
|
BIN_CC := ccache $(BIN_CC)
|
|
|
|
BIN_CXX := ccache $(BIN_CXX)
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
|
|
##################
|
|
|
|
# TRANSFORM RULES
|
|
|
|
##################
|
|
|
|
.SUFFIXES:
|
2012-05-26 22:16:02 +02:00
|
|
|
.SUFFIXES: .o .c .cpp .cxx .mm
|
2010-12-05 20:12:42 +01:00
|
|
|
|
|
|
|
%.o: %.c
|
2011-12-22 22:21:20 +01:00
|
|
|
$(CXX_ENV) $(BIN_CC) $(CFLAGS_DEP) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
|
2010-12-05 20:12:42 +01:00
|
|
|
|
|
|
|
%.o: %.cpp
|
|
|
|
$(CXX_ENV) $(BIN_CXX) $(CFLAGS_DEP) $(CPPFLAGS) $(CXXFLAGS) -c -o $@ $<
|
|
|
|
|
|
|
|
%.o: %.cxx
|
|
|
|
$(CXX_ENV) $(BIN_CXX) $(CFLAGS_DEP) $(CPPFLAGS) $(CXXFLAGS) -c -o $@ $<
|
|
|
|
|
2012-11-07 16:36:31 +01:00
|
|
|
%.o: %.cc
|
|
|
|
$(CXX_ENV) $(BIN_CXX) $(CFLAGS_DEP) $(CPPFLAGS) $(CXXFLAGS) -c -o $@ $<
|
|
|
|
|
2012-05-26 22:16:02 +02:00
|
|
|
%.o: %.mm
|
|
|
|
$(CXX_ENV) $(BIN_CXX) $(CFLAGS_DEP) $(CPPFLAGS) $(OBJCXXFLAGS) -c -o $@ $<
|
|
|
|
|
2010-12-05 20:12:42 +01:00
|
|
|
$(PRECOMPILED_HEADER_NAME).gch: $(PRECOMPILED_HEADER_NAME)
|
2012-02-20 19:22:25 +01:00
|
|
|
$(CXX_ENV) $(BIN_CXX) $(CPPFLAGS) $(CXXFLAGS) -x c++-header $<
|
2010-12-05 20:12:42 +01:00
|
|
|
|
|
|
|
|
|
|
|
-include ($DEP)
|
|
|
|
.SUFFIXES:
|