X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=blobdiff_plain;f=Makefile.real;h=7d4eff4fe2eaecc99fb83627a154b9c1672118ca;hp=5df27bad934a58f04b4b6407e868e8898ded4002;hb=HEAD;hpb=6bded356ec89b1344049ff702e6c6babaeccd439 diff --git a/Makefile.real b/Makefile.real index 5df27bad..bd2bd9d9 100644 --- a/Makefile.real +++ b/Makefile.real @@ -6,8 +6,11 @@ MAKEFLAGS += -Rr ifeq ("$(origin CC)", "default") CC := cc endif +.ONESHELL: +.SHELLFLAGS := -ec LOGLEVELS := LL_DEBUG,LL_INFO,LL_NOTICE,LL_WARNING,LL_ERROR,LL_CRIT,LL_EMERG +SEVERITIES := \"debug\",\"info\",\"notice\",\"warning\",\"error\",\"crit\",\"emerg\" vardir := /var/paraslash mandir := $(datarootdir)/man/man1 MKDIR_P := mkdir -p @@ -18,7 +21,7 @@ uname_s := $(shell uname -s 2>/dev/null || echo "UNKNOWN_OS") uname_rs := $(shell uname -rs) cc_version := $(shell $(CC) --version | head -n 1) GIT_VERSION := $(shell ./GIT-VERSION-GEN git-version.h) -COPYRIGHT_YEAR := 2019 +COPYRIGHT_YEAR := 2024 ifeq ("$(origin O)", "command line") build_dir := $(O) @@ -53,6 +56,7 @@ gui_objs += gui.lsg.o play_objs += $(addsuffix _cmd.lsg.o, recv filter play write) play.lsg.o recv_objs += recv_cmd.lsg.o recv.lsg.o server_objs += server_cmd.lsg.o server.lsg.o +upgrade_db_objs += upgrade_db.lsg.o write_objs += write_cmd.lsg.o write.lsg.o cmd_suites := $(addsuffix _cmd, audiod server play recv filter write) @@ -75,6 +79,7 @@ audiod_objs := $(addprefix $(object_dir)/, $(audiod_objs)) audioc_objs := $(addprefix $(object_dir)/, $(audioc_objs)) mixer_objs := $(addprefix $(object_dir)/, $(mixer_objs)) server_objs := $(addprefix $(object_dir)/, $(server_objs)) +upgrade_db_objs := $(addprefix $(object_dir)/, $(upgrade_db_objs)) write_objs := $(addprefix $(object_dir)/, $(write_objs)) afh_objs := $(addprefix $(object_dir)/, $(afh_objs)) play_objs := $(addprefix $(object_dir)/, $(play_objs)) @@ -102,19 +107,22 @@ endif $(object_dir) $(man_dir) $(dep_dir) $(m4depdir) $(lls_suite_dir) \ $(yy_build_dir): - $(Q) $(MKDIR_P) $@ + @$(MKDIR_P) $@ CPPFLAGS += -DBINDIR='"$(bindir)"' CPPFLAGS += -DCOPYRIGHT_YEAR='"$(COPYRIGHT_YEAR)"' CPPFLAGS += -DBUILD_DATE='"$(build_date)"' CPPFLAGS += -DLOGLEVELS='$(LOGLEVELS)' +CPPFLAGS += -DSEVERITIES=$(SEVERITIES) CPPFLAGS += -DUNAME_RS='"$(uname_rs)"' CPPFLAGS += -DCC_VERSION='"$(cc_version)"' CPPFLAGS += -I$(lls_suite_dir) CPPFLAGS += -I$(yy_build_dir) CPPFLAGS += $(lopsub_cppflags) +CPPFLAGS += -Wunused-macros STRICT_CFLAGS += -fno-strict-aliasing +STRICT_CFLAGS += -ftrapv STRICT_CFLAGS += -g STRICT_CFLAGS += -Os STRICT_CFLAGS += -Wundef -W -Wuninitialized @@ -126,15 +134,20 @@ STRICT_CFLAGS += -Wredundant-decls STRICT_CFLAGS += -Wno-sign-compare -Wno-unknown-pragmas STRICT_CFLAGS += -Wdeclaration-after-statement STRICT_CFLAGS += -Wformat -Wformat-security -Wmissing-format-attribute +STRICT_CFLAGS += -fdata-sections -ffunction-sections +STRICT_CFLAGS += -Wstrict-prototypes +STRICT_CFLAGS += -Wshadow + +LDFLAGS += -Wl,--gc-sections + +ifeq ($(ENABLE_UBSAN), yes) + STRICT_CFLAGS += -fsanitize=undefined + LDFLAGS += -lubsan +endif ifeq ($(uname_s),Linux) # these cause warnings on *BSD - CPPFLAGS += -Wunused-macros - STRICT_CFLAGS += -fdata-sections -ffunction-sections - STRICT_CFLAGS += -Wstrict-prototypes - STRICT_CFLAGS += -Wshadow STRICT_CFLAGS += -Wunused -Wall - LDFLAGS += -Wl,--gc-sections endif cc-option = $(shell \ @@ -144,13 +157,14 @@ cc-option = $(shell \ STRICT_CFLAGS += $(call cc-option, -Wformat-signedness) STRICT_CFLAGS += $(call cc-option, -Wdiscarded-qualifiers) +STRICT_CFLAGS += $(call cc-option, -Wsuggest-attribute=malloc) # To put more focus on warnings, be less verbose as default # Use 'make V=1' to see the full commands ifeq ("$(origin V)", "command line") - Q := + SAY = else - Q := @ + SAY = @echo '$(strip $(1))' endif audiod_commands := $(addprefix $(lls_suite_dir)/, \ @@ -177,85 +191,60 @@ $(man_dir)/para_write.1: all_commands := $(write_commands) $(man_dir)/para_%.1: $(lls_suite_dir)/%.lsg.man \ $(lls_m4_dir)/copyright.m4 | $(man_dir) - @[ -z "$(Q)" ] || echo 'LLSMAN $<' - $(Q) cat $< $(all_commands) > $@ - $(Q) $(M4) -D COPYRIGHT_YEAR=$(COPYRIGHT_YEAR) $(lls_m4_dir)/copyright.m4 >> $@ + $(call SAY, LLSMAN $<) + cat $< $(all_commands) > $@ + $(M4) -D COPYRIGHT_YEAR=$(COPYRIGHT_YEAR) $(lls_m4_dir)/copyright.m4 >> $@ $(object_dir)/%.o: %.c | $(object_dir) -$(object_dir)/opus%.o: CPPFLAGS += $(opus_cppflags) -$(object_dir)/gui.o $(object_dir)/gui%.o \ -: CPPFLAGS += $(curses_cppflags) -$(object_dir)/spx%.o: CPPFLAGS += $(speex_cppflags) -$(object_dir)/flac%.o: CPPFLAGS += $(flac_cppflags) - -$(object_dir)/mp3_afh.o: CPPFLAGS += $(id3tag_cppflags) -$(object_dir)/openssl.o: CPPFLAGS += $(openssl_cppflags) -$(object_dir)/gcrypt.o: CPPFLAGS += $(gcrypt_cppflags) -$(object_dir)/ao_write.o: CPPFLAGS += $(ao_cppflags) -$(object_dir)/alsa%.o: CPPFLAGS += $(alsa_cppflags) - -$(object_dir)/interactive.o \ -: CPPFLAGS += $(readline_cppflags) - -$(object_dir)/resample_filter.o \ -: CPPFLAGS += $(samplerate_cppflags) - -$(object_dir)/oss_write.o \ -: CPPFLAGS += $(oss_cppflags) - -$(object_dir)/ao_write.o \ -: CPPFLAGS += $(ao_cppflags) $(pthread_cppflags) - -$(object_dir)/mp3dec_filter.o \ -: CPPFLAGS += $(mad_cppflags) - -$(object_dir)/aacdec_filter.o \ -$(object_dir)/aac_afh.o \ -: CPPFLAGS += $(faad_cppflags) - -$(object_dir)/ogg_afh.o \ -$(object_dir)/oggdec_filter.o \ -: CPPFLAGS += $(vorbis_cppflags) - -$(object_dir)/spx_common.o \ -$(object_dir)/spxdec_filter.o \ -$(object_dir)/spx_afh.o \ -$(object_dir)/oggdec_filter.o \ -$(object_dir)/ogg_afh.o \ -$(object_dir)/ogg_afh_common.o \ -$(object_dir)/opus%.o \ -: CPPFLAGS += $(ogg_cppflags) - -$(object_dir)/afs.o \ -$(object_dir)/aft.o \ -$(object_dir)/attribute.o \ -$(object_dir)/blob.o \ -$(object_dir)/mood.o \ -$(object_dir)/playlist.o \ -$(object_dir)/score.o \ -$(object_dir)/server.o \ -$(object_dir)/vss.o \ -$(object_dir)/command.o \ -$(object_dir)/http_send.o \ -$(object_dir)/dccp_send.o \ -$(object_dir)/udp_send.o \ -$(object_dir)/send_common.o \ -$(object_dir)/mm.o \ -: CPPFLAGS += $(osl_cppflags) - -$(object_dir)/compress_filter.o: CFLAGS += -O3 +OD = $(addsuffix .d, $(addprefix $(dep_dir)/, $(1))) \ + $(addsuffix .o, $(addprefix $(object_dir)/, $(1))) + +$(call OD, opus%): CPPFLAGS += $(opus_cppflags) +$(call OD, gui gui%): CPPFLAGS += $(curses_cppflags) +$(call OD, spx%): CPPFLAGS += $(speex_cppflags) +$(call OD, flac%): CPPFLAGS += $(flac_cppflags) +$(call OD, mp3_afh): CPPFLAGS += $(id3tag_cppflags) +$(call OD, openssl): CPPFLAGS += $(openssl_cppflags) +$(call OD, gcrypt): CPPFLAGS += $(gcrypt_cppflags) +$(call OD, ao_write): CPPFLAGS += $(ao_cppflags) +$(call OD, alsa%): CPPFLAGS += $(alsa_cppflags) +$(call OD, interactive): CPPFLAGS += $(readline_cppflags) +$(call OD, resample_filter): CPPFLAGS += $(samplerate_cppflags) +$(call OD, oss_write): CPPFLAGS += $(oss_cppflags) +$(call OD, ao_write): CPPFLAGS += $(ao_cppflags) $(pthread_cppflags) +$(call OD, mp3dec_filter): CPPFLAGS += $(mad_cppflags) +$(call OD, aacdec_filter aac_afh): CPPFLAGS += $(faad_cppflags) +$(call OD, ogg_afh oggdec_filter): CPPFLAGS += $(vorbis_cppflags) +$(call OD, spx_common spxdec_filter spx_afh oggdec_filter ogg_afh \ + ogg_afh_common opus%): CPPFLAGS += $(ogg_cppflags) +$(call OD, afs aft attribute blob mood playlist score server vss command \ + http_send dccp_send udp_send send_common mm.o): \ + CPPFLAGS += $(osl_cppflags) + +$(call OD, compress_filter): CFLAGS += -O3 +$(call OD, openssl): CFLAGS += -Wno-deprecated-declarations $(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) $< +define CC_CMD + $(call SAY, CC $<) + $(CC) -c -o $(object_dir)/$(*F).o -MMD -MF \ + $(dep_dir)/$(*F).d -MT $(object_dir)/$(*F).o \ + $(CPPFLAGS) $(STRICT_CFLAGS) $(CFLAGS) $< +endef +CC_PREREQUISITES := %.c | $(object_dir) $(dep_dir) $(lsg_h) $(yy_h) +# These two have the same prerequisites and the same recipe. There should be a +# better way to write this. +$(object_dir)/%.o: $(CC_PREREQUISITES) + $(CC_CMD) +$(dep_dir)/%.d: $(CC_PREREQUISITES) + $(CC_CMD) para_recv para_afh para_play para_server: LDFLAGS += $(id3tag_ldflags) para_write para_play para_audiod \ : LDFLAGS += $(ao_ldflags) $(pthread_ldflags) para_client para_audioc para_play : LDFLAGS += $(readline_ldflags) -para_server: LDFLAGS += $(osl_ldflags) +para_server para_upgrade_db: LDFLAGS += $(osl_ldflags) para_gui: LDFLAGS += $(curses_ldflags) para_server \ para_client \ @@ -292,6 +281,7 @@ para_gui \ para_play \ para_recv \ para_server \ +para_upgrade_db \ para_write \ : LDFLAGS += $(lopsub_ldflags) @@ -313,24 +303,24 @@ para_afh para_recv para_server para_play: LDFLAGS += $(iconv_ldflags) $(foreach exe,$(executables),$(eval para_$(exe): $$($(exe)_objs))) $(prefixed_executables): - @[ -z "$(Q)" ] || echo 'LD $@' - $(Q) $(CC) $^ -o $@ $(LDFLAGS) + $(call SAY, LD $@) + $(CC) $^ -o $@ $(LDFLAGS) mostlyclean: - @[ -z "$(Q)" ] || echo 'MOSTLYCLEAN' - $(Q) rm -f para_* - $(Q) rm -rf $(object_dir) + $(call SAY, MOSTLYCLEAN) + rm -f para_* + rm -rf $(object_dir) clean: mostlyclean - @[ -z "$(Q)" ] || echo 'CLEAN' - $(Q) rm -rf $(build_dir) + $(call SAY, CLEAN) + rm -rf $(build_dir) distclean: clean - @[ -z "$(Q)" ] || echo 'DISTCLEAN' - $(Q) rm -f Makefile autoscan.log config.status config.log - $(Q) rm -f config.h configure config.h.in -maintainer-clean: distclean - @[ -z "$(Q)" ] || echo 'MAINTAINER-CLEAN' - $(Q) rm -f *.tar.bz2 *.tar.xz - $(Q) rm -f GPATH GRTAGS GSYMS GTAGS + $(call SAY, DISTCLEAN) + rm -f Makefile autoscan.log config.status config.log + rm -f config.h configure config.h.in +maintainer-clean: distclean test-clean + $(call SAY, MAINTAINER-CLEAN) + rm -f *.tar.bz2 *.tar.xz + rm -f GPATH GRTAGS GSYMS GTAGS INSTALL ?= install INSTALL_PROGRAM ?= $(INSTALL) @@ -346,14 +336,15 @@ install install-strip: all man $(MKDIR_P) $(DESTDIR)$(vardir) >/dev/null 2>&1 || true # not fatal, so don't complain $(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) $(MKDIR_P) $(tarball_pfx) - $(Q) ./GIT-VERSION-GEN > $(tarball_pfx)/VERSION - $(Q) cp $(autocrap) $(tarball_pfx) - $(Q) tar rf $(tarball_pfx).tar $(tarball_pfx)/* - $(Q) xz -9 $(tarball_pfx).tar - $(Q) ls -l $(tarball) - $(Q) ln -sf $(tarball) paraslash-git.tar.xz - $(Q) rm -rf $(tarball_pfx) + $(call SAY, DIST) + rm -rf $(tarball) $(tarball_pfx) + git archive --format=tar --prefix=$(tarball_pfx)/ HEAD \ + | tar --delete $(tarball_delete) > $(tarball_pfx).tar + $(MKDIR_P) $(tarball_pfx) + ./GIT-VERSION-GEN > $(tarball_pfx)/VERSION + cp $(autocrap) $(tarball_pfx) + tar rf $(tarball_pfx).tar $(tarball_pfx)/* + xz -9 $(tarball_pfx).tar + ls -l $(tarball) + ln -sf $(tarball) paraslash-git.tar.xz + rm -rf $(tarball_pfx)