LOGLEVELS := LL_DEBUG,LL_INFO,LL_NOTICE,LL_WARNING,LL_ERROR,LL_CRIT,LL_EMERG
vardir := /var/paraslash
mandir := $(datarootdir)/man/man1
-STRIP := $(CROSS_COMPILE)strip
MKDIR_P := mkdir -p
prefixed_executables := $(addprefix para_, $(executables))
uname_rs := $(shell uname -rs)
cc_version := $(shell $(CC) --version | head -n 1)
GIT_VERSION := $(shell ./GIT-VERSION-GEN git-version.h)
-COPYRIGHT_YEAR := 2017
+COPYRIGHT_YEAR := 2018
ifeq ("$(origin O)", "command line")
build_dir := $(O)
lls_suite_dir := $(build_dir)/lls
lls_m4_dir := m4/lls
test_dir := t
+yy_src_dir = yy
+yy_build_dir = $(build_dir)/yy
# sort removes duplicate words, which is all we need here
all_objs := $(sort $(recv_objs) $(filter_objs) $(client_objs) $(gui_objs) \
$(audiod_objs) $(audioc_objs) $(mixer_objs) $(server_objs) \
$(write_objs) $(afh_objs) $(play_objs))
deps := $(addprefix $(dep_dir)/, $(all_objs:.o=.d))
+deps += $(addprefix $(dep_dir)/, mp.bison.d mp.flex.d)
afh_objs += afh.lsg.o
audioc_objs += audioc.lsg.o
m4_lls_deps := $(addsuffix .m4d, $(suites))
lsg_h := $(addsuffix .lsg.h, $(suites))
+# flex/bison objects and headers are only needed if para_server is built
+ifeq ("$(findstring server, $(executables))", "server")
+ server_objs += mp.flex.o mp.bison.o
+ yy_h := $(yy_build_dir)/mp.bison.h
+endif
+
# now prefix all objects with object dir
recv_objs := $(addprefix $(object_dir)/, $(recv_objs))
filter_objs := $(addprefix $(object_dir)/, $(filter_objs))
autocrap := config.h.in configure
tarball_pfx := $(PACKAGE_TARNAME)-$(GIT_VERSION)
tarball_delete := $(addprefix $(tarball_pfx)/, web .gitignore)
-tarball := $(tarball_pfx).tar.bz2
+tarball := $(tarball_pfx).tar.xz
-.PHONY: all clean clean2 distclean maintainer-clean install man tarball
all: $(prefixed_executables) $(man_pages)
+.PHONY: all mostlyclean clean distclean maintainer-clean install \
+ install-strip man dist tarball
+
man: $(man_pages)
-tarball: $(tarball)
include $(lls_m4_dir)/makefile
include $(test_dir)/makefile.test
+include $(yy_src_dir)/makefile
ifeq ($(findstring clean, $(MAKECMDGOALS)),)
-include $(deps)
-include $(m4_lls_deps)
endif
-$(object_dir) $(man_dir) $(dep_dir) $(m4depdir) $(lls_suite_dir):
+$(object_dir) $(man_dir) $(dep_dir) $(m4depdir) $(lls_suite_dir) \
+ $(yy_build_dir):
$(Q) $(MKDIR_P) $@
CPPFLAGS += -DBINDIR='"$(bindir)"'
CPPFLAGS += -DCC_VERSION='"$(cc_version)"'
CPPFLAGS += -I/usr/local/include
CPPFLAGS += -I$(lls_suite_dir)
+CPPFLAGS += -I$(yy_build_dir)
CPPFLAGS += $(lopsub_cppflags)
STRICT_CFLAGS += -fno-strict-aliasing
STRICT_CFLAGS += -Wdeclaration-after-statement
STRICT_CFLAGS += -Wformat -Wformat-security -Wmissing-format-attribute
-LDFLAGS += $(clock_gettime_ldflags)
-
ifeq ($(uname_s),Linux)
# these cause warnings on *BSD
CPPFLAGS += -Wunused-macros
)
STRICT_CFLAGS += $(call cc-option, -Wformat-signedness)
+STRICT_CFLAGS += $(call cc-option, -Wdiscarded-qualifiers)
# To put more focus on warnings, be less verbose as default
# Use 'make V=1' to see the full commands
$(object_dir)/crypt.o: CPPFLAGS += $(openssl_cppflags)
$(object_dir)/gcrypt.o: CPPFLAGS += $(gcrypt_cppflags)
$(object_dir)/ao_write.o: CPPFLAGS += $(ao_cppflags)
-$(object_dir)/aac_afh.o: CPPFLAGS += $(mp4v2_cppflags)
$(object_dir)/alsa%.o: CPPFLAGS += $(alsa_cppflags)
$(object_dir)/interactive.o \
: CPPFLAGS += $(mad_cppflags)
$(object_dir)/aacdec_filter.o \
-$(object_dir)/aac_common.o \
$(object_dir)/aac_afh.o \
: CPPFLAGS += $(faad_cppflags)
$(object_dir)/compress_filter.o: CFLAGS += -O3
-$(object_dir)/%.o: %.c | $(object_dir) $(dep_dir) $(lsg_h)
+$(object_dir)/%.o: %.c | $(object_dir) $(dep_dir) $(lsg_h) $(yy_h)
@[ -z "$(Q)" ] || echo 'CC $<'
$(Q) $(CC) -c -o $@ -MMD -MF $(dep_dir)/$(*F).d -MT $@ $(CPPFLAGS) \
$(STRICT_CFLAGS) $(CFLAGS) $<
para_recv para_afh para_play para_server: LDFLAGS += $(id3tag_ldflags)
para_write para_play para_audiod \
-: LDFLAGS += $(ao_ldflags) $(pthread_ldflags) $(core_audio_ldflags)
+: LDFLAGS += $(ao_ldflags) $(pthread_ldflags)
para_client para_audioc para_play : LDFLAGS += $(readline_ldflags)
para_server: LDFLAGS += $(osl_ldflags)
para_gui: LDFLAGS += $(curses_ldflags)
$(faad_ldflags) \
$(flac_ldflags)
-para_server \
-para_play \
-para_afh \
-para_recv \
-: LDFLAGS += \
- $(mp4v2_ldflags)
-
para_afh para_recv para_server para_play: LDFLAGS += $(iconv_ldflags)
$(foreach exe,$(executables),$(eval para_$(exe): $$($(exe)_objs)))
@[ -z "$(Q)" ] || echo 'LD $@'
$(Q) $(CC) $^ -o $@ $(LDFLAGS)
-clean:
- @[ -z "$(Q)" ] || echo 'CLEAN'
+mostlyclean:
+ @[ -z "$(Q)" ] || echo 'MOSTLYCLEAN'
$(Q) rm -f para_*
$(Q) rm -rf $(object_dir)
-
-clean2: clean
- @[ -z "$(Q)" ] || echo 'CLEAN2'
+clean: mostlyclean
+ @[ -z "$(Q)" ] || echo 'CLEAN'
$(Q) rm -rf $(build_dir)
-distclean: clean2 test-clean
+distclean: clean
@[ -z "$(Q)" ] || echo 'DISTCLEAN'
$(Q) rm -f Makefile autoscan.log config.status config.log
- $(Q) rm -f GPATH GRTAGS GSYMS GTAGS
-
+ $(Q) rm -f config.h configure config.h.in
maintainer-clean: distclean
@[ -z "$(Q)" ] || echo 'MAINTAINER-CLEAN'
- $(Q) rm -f *.tar.bz2 config.h configure config.h.in
+ $(Q) rm -f *.tar.bz2 *.tar.xz
+ $(Q) rm -f GPATH GRTAGS GSYMS GTAGS
+
+INSTALL ?= install
+INSTALL_PROGRAM ?= $(INSTALL)
+INSTALL_DATA ?= $(INSTALL) -m 644
+ifneq ($(findstring strip, $(MAKECMDGOALS)),)
+ strip_option := -s
+endif
-install: all man
- $(MKDIR_P) $(bindir) $(mandir)
- $(INSTALL) -s --strip-program $(STRIP) -m 755 \
- $(prefixed_executables) $(bindir)
- $(INSTALL) -m 644 $(man_pages) $(mandir)
- $(MKDIR_P) $(vardir) >/dev/null 2>&1 || true # not fatal, so don't complain
+install install-strip: all man
+ $(MKDIR_P) $(DESTDIR)$(bindir) $(DESTDIR)$(mandir)
+ $(INSTALL) $(strip_option) $(prefixed_executables) $(DESTDIR)$(bindir)
+ $(INSTALL_DATA) $(man_pages) $(DESTDIR)$(mandir)
+ $(MKDIR_P) $(DESTDIR)$(vardir) >/dev/null 2>&1 || true # not fatal, so don't complain
-$(tarball):
+$(tarball) dist tarball:
$(Q) rm -rf $(tarball) $(tarball_pfx)
$(Q) git archive --format=tar --prefix=$(tarball_pfx)/ HEAD \
| tar --delete $(tarball_delete) > $(tarball_pfx).tar
$(Q) ./GIT-VERSION-GEN > $(tarball_pfx)/VERSION
$(Q) cp $(autocrap) $(tarball_pfx)
$(Q) tar rf $(tarball_pfx).tar $(tarball_pfx)/*
- $(Q) bzip2 -9 $(tarball_pfx).tar
+ $(Q) xz -9 $(tarball_pfx).tar
$(Q) ls -l $(tarball)
- $(Q) ln -sf $(tarball) paraslash-git.tar.bz2
+ $(Q) ln -sf $(tarball) paraslash-git.tar.xz
$(Q) rm -rf $(tarball_pfx)