Makefile.unix: Tidy things up.

- Stop the abuse of OBJECTS$N (where N is just a magic number that's been
  incremented each time the line length crossed 80 cols).
- Put WebVTT objects in VTTOBJS
- Put executable objects in EXEOBJS
- Move symbol defs to $(DFLAGS)
- Add $(INCLUDES) to $(CXXFLAGS); stop using it in rules.

Change-Id: I140c8a779f9f42586b7179262690c86801163f89
This commit is contained in:
Tom Finegan 2016-03-17 14:31:26 -07:00
parent 12f6dc34b4
commit f2f87e20ed

View File

@ -1,5 +1,7 @@
CXX := g++ CXX := g++
CXXFLAGS := -W -Wall -g -MMD -MP -D__STDC_CONSTANT_MACROS -D__STDC_LIMIT_MACROS PREDEFINES := -D__STDC_CONSTANT_MACROS -D__STDC_LIMIT_MACROS
INCLUDES := -I.
CXXFLAGS := -W -Wall -g -MMD -MP $(PREDEFINES) $(INCLUDES)
LIBWEBMA := libwebm.a LIBWEBMA := libwebm.a
LIBWEBMSO := libwebm.so LIBWEBMSO := libwebm.so
WEBMOBJS := mkvmuxer.o mkvmuxerutil.o mkvwriter.o WEBMOBJS := mkvmuxer.o mkvmuxerutil.o mkvwriter.o
@ -7,31 +9,31 @@ WEBMOBJS += mkvparser/mkvparser.o mkvparser/mkvreader.o
WEBMOBJS += common/file_util.o common/hdr_util.o WEBMOBJS += common/file_util.o common/hdr_util.o
OBJSA := $(WEBMOBJS:.o=_a.o) OBJSA := $(WEBMOBJS:.o=_a.o)
OBJSSO := $(WEBMOBJS:.o=_so.o) OBJSSO := $(WEBMOBJS:.o=_so.o)
OBJECTS1 := sample.o VTTOBJS := vttreader.o webvttparser.o sample_muxer_metadata.o
OBJECTS2 := sample_muxer.o vttreader.o webvttparser.o sample_muxer_metadata.o EXEOBJS := sample.o sample_muxer.o dumpvtt.o vttdemux.o
OBJECTS3 := dumpvtt.o vttreader.o webvttparser.o
OBJECTS4 := vttdemux.o webvttparser.o
INCLUDES := -I.
DEPS := $(WEBMOBJS:.o=.d) $(OBJECTS1:.o=.d) $(OBJECTS2:.o=.d) DEPS := $(WEBMOBJS:.o=.d) $(OBJECTS1:.o=.d) $(OBJECTS2:.o=.d)
DEPS += $(OBJECTS3:.o=.d) $(OBJECTS4:.o=.d) $(OBJSA:.o=.d) $(OBJSSO:.o=.d) DEPS += $(OBJECTS3:.o=.d) $(OBJECTS4:.o=.d) $(OBJSA:.o=.d) $(OBJSSO:.o=.d)
DEPS += $(VTTOBJS:.o=.d) $(EXEOBJS:.o=.d)
EXES := sample_muxer sample dumpvtt vttdemux EXES := sample_muxer sample dumpvtt vttdemux
CLEAN := $(EXEOBJS) $(VTTOBJS) $(WEBMOBJS) $(OBJSA) $(OBJSSO) $(LIBWEBMA)
CLEAN += $(LIBWEBMSO) $(EXES) $(DEPS)
all: $(EXES) all: $(EXES)
sample: sample.o $(LIBWEBMA) sample: sample.o $(LIBWEBMA)
$(CXX) $^ -o $@ $(CXX) $^ -o $@
sample_muxer: $(OBJECTS2) $(LIBWEBMA) sample_muxer: sample_muxer.o $(VTTOBJS) $(LIBWEBMA)
$(CXX) $^ -o $@ $(CXX) $^ -o $@
dumpvtt: $(OBJECTS3) dumpvtt: dumpvtt.o $(VTTOBJS) $(WEBMOBJS)
$(CXX) $^ -o $@
vttdemux: vttdemux.o $(VTTOBJS) $(LIBWEBMA)
$(CXX) $^ -o $@ $(CXX) $^ -o $@
shared: $(LIBWEBMSO) shared: $(LIBWEBMSO)
vttdemux: $(OBJECTS4) $(LIBWEBMA)
$(CXX) $^ -o $@
libwebm.a: $(OBJSA) libwebm.a: $(OBJSA)
$(AR) rcs $@ $^ $(AR) rcs $@ $^
@ -39,20 +41,20 @@ libwebm.so: $(OBJSSO)
$(CXX) $(CXXFLAGS) -shared $(OBJSSO) -o $(LIBWEBMSO) $(CXX) $(CXXFLAGS) -shared $(OBJSSO) -o $(LIBWEBMSO)
%.o: %.cpp %.o: %.cpp
$(CXX) -c $(CXXFLAGS) $(INCLUDES) $< -o $@ $(CXX) -c $(CXXFLAGS) $< -o $@
%_a.o: %.cpp %_a.o: %.cpp
$(CXX) -c $(CXXFLAGS) $(INCLUDES) $< -o $@ $(CXX) -c $(CXXFLAGS) $< -o $@
%_a.o: %.cc %_a.o: %.cc
$(CXX) -c $(CXXFLAGS) $(INCLUDES) $< -o $@ $(CXX) -c $(CXXFLAGS) $< -o $@
%_so.o: %.cpp %_so.o: %.cpp
$(CXX) -c $(CXXFLAGS) -fPIC $(INCLUDES) $< -o $@ $(CXX) -c $(CXXFLAGS) -fPIC $< -o $@
%_so.o: %.cc %_so.o: %.cc
$(CXX) -c $(CXXFLAGS) -fPIC $(INCLUDES) $< -o $@ $(CXX) -c $(CXXFLAGS) -fPIC $< -o $@
clean: clean:
$(RM) -f $(OBJECTS1) $(OBJECTS2) $(OBJECTS3) $(OBJECTS4) $(OBJSA) $(OBJSSO) $(LIBWEBMA) $(LIBWEBMSO) $(EXES) $(DEPS) Makefile.bak $(RM) -f $(CLEAN) Makefile.bak
ifneq ($(MAKECMDGOALS), clean) ifneq ($(MAKECMDGOALS), clean)
-include $(DEPS) -include $(DEPS)