Skip to content

Instantly share code, notes, and snippets.

@postwait
Created March 20, 2020 16:56
Show Gist options
  • Save postwait/1617c783ae5afcf61048d881e5fdbb69 to your computer and use it in GitHub Desktop.
Save postwait/1617c783ae5afcf61048d881e5fdbb69 to your computer and use it in GitHub Desktop.
.SUFFIXES: .c .cpp .lo .mo .xml .xmlh
Q=
ifeq ($(V),)
Q=@
endif
MAKE?=gmake
DISPLACE?=../
CC=@CC@
CXX=@CXX@
MODULELD=@MODULELD@
MODULECC=@MODULECC@
MODULECXX=@CXX@
MODULESHCFLAGS=@MODULESHCFLAGS@
MODULESHLDFLAGS=@MODULESHLDFLAGS@
MTEVCONFIG=@MTEVCONFIG@
PERL=@PERL@
COPTIMIZE=@COPTIMIZE@
TOPSRCDIR=$(DISPLACE)@top_srcdir@
CPPFLAGS=-I$(TOPSRCDIR)/src -I$(TOPSRCDIR)/src/libsnowth @CPPFLAGS@
CFLAGS=@CFLAGS@
SHLDFLAGS=@SHLDFLAGS@
SHCFLAGS=@SHCFLAGS@
CXXFLAGS_GLOBAL=@CXXFLAGS@
CXXFLAGS=$(CXXFLAGS_GLOBAL) -D__STDC_LIMIT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_CONSTANT_MACROS -std=c++11
MODULESHCXXFLAGS=-fPIC $(CXXFLAGS)
LDFLAGS=@LDFLAGS@
LOCAL_LIBPATHS=-L$(srcdir)/libsnowth
AR=@AR@
RANLIB=@RANLIB@
SHLIBEXT=@SHLIBEXT@
MODULEEXT=@MODULEEXT@
LIBS=@lmdb_LIBS@ -lnoit @LIBS@
ROLLLIBS=@LIBS@ -lnoit -lsnowth
INSTALL=@INSTALL@
XML2H=$(TOPSRCDIR)/buildtools/xml2h
top_srcdir=$(TOPSRCDIR)
DTRACEOBJ=@DTRACEOBJ@
DEPFLAGS=@DEPFLAGS@
CTFCONVERT=@CTFCONVERT@
CTFMERGE=@CTFMERGE@
FLATCC=@FLATCC@
prefix=@prefix@
includedir=${prefix}/include
exec_prefix=@exec_prefix@
libexecdir=@libexecdir@
orig_prefix=@prefix@
orig_includedir=${prefix}/include
orig_exec_prefix=@exec_prefix@
orig_libexecdir=@libexecdir@
all: $(MODULES) $(EXTRA_ALL)
$(Q)test -n "$(MODULES)" || $(MAKE) error
error:
$(Q)echo "this is a makefile for inclusion, run make in the appropriate subdirectory."
$(Q)false
%.mo: %.cpp
$(Q)$(MODULECXX) $(CPPFLAGS) $(MODULESHCXXFLAGS) -c $< -o $@
@echo "- compiling $<"
%.mo: %.c
$(Q)$(MODULECC) $(CPPFLAGS) $(MODULESHCFLAGS) -c $< -o $@
@echo "- compiling $<"
.xml.xmlh:
$(Q)$(XML2H) `echo $< | sed -e 's/\.xml$$//;'`_xml_description < $< > $@
define install-module
$(top_srcdir)/buildtools/mkinstalldirs $(DESTDIR)$(libexecdir)
$(top_srcdir)/buildtools/mkinstalldirs $(DESTDIR)$(includedir)
for mod in $(MODULES); do \
$(INSTALL) -m 0755 $$mod $(DESTDIR)$(libexecdir)/`echo $$mod | sed -e 's#.*/##;'` ; \
done
for hdr in $(HEADERS); do \
$(INSTALL) -m 0755 $$hdr $(DESTDIR)$(includedir)/`echo $$hdr | sed -e 's#.*/##;'` ; \
done
endef
define backup-module
for mod in $(MODULES); do \
cp $(DESTDIR)$(libexecdir)/`echo $$mod | sed -e 's#.*/##;'` $(top_srcdir)/backed_up_install/modules/`echo $$mod | sed -e 's#.*/##;'` ; \
done
for hdr in $(HEADERS); do \
cp $(DESTDIR)$(includedir)/`echo $$hdr | sed -e 's#.*/##;'` $(top_srcdir)/backed_up_install/modules/`echo $$hdr | sed -e 's#.*/##;'` ; \
done
endef
define restore-module
for mod in $(MODULES); do \
$(INSTALL) -m 0755 $(top_srcdir)/backed_up_install/modules/`echo $$mod | sed -e 's#.*/##;'` $(DESTDIR)$(libexecdir)/`echo $$mod | sed -e 's#.*/##;'` ; \
done
for hdr in $(HEADERS); do \
$(INSTALL) -m 0755 $(top_srcdir)/backed_up_install/modules/`echo $$hdr | sed -e 's#.*/##;'` $(DESTDIR)$(includedir)/`echo $$hdr | sed -e 's#.*/##;'` ; \
done
endef
install: $(MODULES)
$(install-module)
backup:
$(backup-module)
restore:
$(restore-module)
clean:
rm -f *.mo *.so *.xmlh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment