2010-12-05 20:12:42 +01:00
|
|
|
# *** THERE ARE NO USER-EDITABLE ITEMS HERE. ***
|
2010-12-14 19:53:17 +01:00
|
|
|
#
|
|
|
|
# TODO:
|
|
|
|
# * DESTDIR= support for make install.
|
|
|
|
# * Allow variables to be overridden on the CL.
|
2010-12-05 20:12:42 +01:00
|
|
|
|
|
|
|
.PHONY: all install clean subdirs $(SUBDIRS)
|
|
|
|
all: subdirs $(LIB) $(LIB_SHARED) $(PROGRAM)
|
2011-12-22 22:20:34 +01:00
|
|
|
.DEFAULT_GOAL := all
|
2010-12-05 20:12:42 +01:00
|
|
|
|
|
|
|
OBJ = $(addsuffix .o, $(basename $(SRC)))
|
|
|
|
DEP = $(addsuffix .d, $(basename $(SRC)))
|
|
|
|
|
|
|
|
###################
|
|
|
|
# PLATFORM SPECIFIC
|
|
|
|
###################
|
|
|
|
|
|
|
|
ifeq (yes, $(BUILD_DARWIN))
|
|
|
|
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-02-03 19:09:08 +01:00
|
|
|
$(BIN_CXX) $(LIB_SHARED_LINK) $(LDFLAGS) $(OBJ) $(LDFLAGS_POST) -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)
|
|
|
|
$(BIN_CXX) -o $@ $(LDFLAGS) $(OBJ) $(LDFLAGS_POST)
|
|
|
|
|
|
|
|
|
|
|
|
##########
|
|
|
|
# CLEANING
|
|
|
|
##########
|
|
|
|
clean: $(SUBDIRS)
|
|
|
|
$(BIN_RM) -f $(OBJ) $(CLEANFILES) $(LIB) $(LIB_SHARED) $(PROGRAM)
|
|
|
|
|
|
|
|
distclean: clean
|
|
|
|
$(BIN_RM) -rf $(DISTCLEANFILES) $(DEP)
|
|
|
|
ifdef PRECOMPILED_HEADER_NAME
|
|
|
|
$(BIN_RM) -f $(PRECOMPILED_HEADER_NAME).gch
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
|
|
#########
|
|
|
|
# INSTALL
|
|
|
|
#########
|
|
|
|
ifeq (install, $(MAKECMDGOALS))
|
|
|
|
INSTALL_LIB = $(addprefix $(P_LIB)/, $(LIB_SHARED) $(LIB_SHARED_FULL))
|
|
|
|
endif
|
|
|
|
|
|
|
|
install: $(SUBDIRS) install-share install-program install-lib
|
|
|
|
|
|
|
|
install-program:
|
|
|
|
ifdef PROGRAM_INSTALL
|
|
|
|
@$(BIN_MKDIR) -p $(P_BINDIR)
|
|
|
|
@$(BIN_INSTALL) $(PROGRAM) $(P_BINDIR)/$(PROGRAM)
|
|
|
|
endif
|
|
|
|
|
|
|
|
install-lib:
|
|
|
|
ifdef LIB_SHARED_INSTALL
|
|
|
|
$(BIN_MKDIR) -p $(P_LIB)
|
|
|
|
$(BIN_INSTALL) $(LIB_SHARED_FULL) $(P_LIB)/$(LIB_SHARED_FULL)
|
2010-12-14 22:02:20 +01:00
|
|
|
$(BIN_LN) -sf $(LIB_SHARED_FULL) $(P_LIB)/$(LIB_SHARED)
|
2010-12-05 20:12:42 +01:00
|
|
|
endif
|
|
|
|
|
|
|
|
install-share:
|
|
|
|
ifdef DATA_SHARE
|
|
|
|
@$(BIN_MKDIR) -p $(addprefix $(P_DATA)/, $(dir $(DATA_SHARE)))
|
|
|
|
@for i in $(DATA_SHARE); do \
|
|
|
|
$(BIN_ECHO) "$(BIN_INSTALL) $$i $(P_DATA)/$$i"; \
|
|
|
|
$(BIN_INSTALL) $$i $(P_DATA)/$$i; \
|
|
|
|
done
|
|
|
|
endif
|
|
|
|
ifdef DATA_SHARE_DOC
|
|
|
|
@$(BIN_MKDIR) -p $(addprefix $(P_DOC)/, $(dir $(DATA_SHARE_DOC)))
|
|
|
|
@for i in $(DATA_SHARE_DOC); do \
|
|
|
|
$(BIN_ECHO) "$(BIN_INSTALL) $$i $(P_DOC)/$$i"; \
|
|
|
|
$(BIN_INSTALL) $$i $(P_DOC)/$$i; \
|
|
|
|
done
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
##############
|
|
|
|
# DISTRIBUTION
|
|
|
|
##############
|
|
|
|
distdir:
|
|
|
|
@if ! test -f packages/distfile/distfile.sh; then \
|
|
|
|
echo "Please run this from the parent directory."; \
|
|
|
|
exit 1; \
|
|
|
|
fi
|
|
|
|
${SHELL} packages/distfile/distfile.sh
|
|
|
|
|
|
|
|
distfiles: $(SUBDIRS)
|
|
|
|
@for i in $(SRC) $(HEADER) $(EXTRA_DIST); do \
|
|
|
|
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.
|
2011-07-16 05:36:28 +02:00
|
|
|
src: universalchardet tools libaegisub
|
2010-12-05 20:12:42 +01:00
|
|
|
tests: libaegisub
|
|
|
|
reporter: src
|
|
|
|
|
2011-12-22 22:20:34 +01:00
|
|
|
$(OBJ): $(GLOBAL_DEPS)
|
2010-12-05 20:12:42 +01:00
|
|
|
|
|
|
|
####################
|
|
|
|
# PRECOMPILED HEADER
|
|
|
|
####################
|
|
|
|
ifeq (yes, $(PRECOMPILED_HEADER))
|
|
|
|
ifdef PRECOMPILED_HEADER_NAME
|
|
|
|
CXXFLAGS += -include $(PRECOMPILED_HEADER_NAME) -Winvalid-pch -fpch-deps -fpch-preprocess
|
|
|
|
# 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)
|
|
|
|
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:
|
|
|
|
.SUFFIXES: .o .c .cpp .cxx
|
|
|
|
|
|
|
|
%.o: %.c
|
2011-07-27 00:24:26 +02:00
|
|
|
$(CXX_ENV) $(BIN_CC) $(CFLAGS_DEP) $(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 $@ $<
|
|
|
|
|
|
|
|
$(PRECOMPILED_HEADER_NAME).gch: $(PRECOMPILED_HEADER_NAME)
|
|
|
|
$(CXX_ENV) $(BIN_CXX) $(CXXFLAGS) $(DEBUG_FLAGS) $<
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-include ($DEP)
|
|
|
|
.SUFFIXES:
|