Added a better way to include build rules in the Makefile

Cleaned up dependencies on generating SDL_revision.h
Fixed 'make install' if you are not building from a Mercurial repository
This commit is contained in:
Sam Lantinga 2011-02-18 11:19:34 -08:00
parent 3afe890b1f
commit e81d8928b6
4 changed files with 32 additions and 43 deletions

View file

@ -108,15 +108,12 @@ Makefile.in:;
$(objects):
$(SHELL) $(auxdir)/mkinstalldirs $@
# To make sure parallel builds will not fail
include/SDL_revision.h: update-revision
update-revision:
$(SHELL) $(auxdir)/updaterev.sh
.PHONY: all update-revision install install-bin install-hdrs install-lib install-data uninstall uninstall-bin uninstall-hdrs uninstall-lib uninstall-data clean distclean dist $(OBJECTS:.lo=.d)
.PHONY: all install install-bin install-hdrs install-lib install-data uninstall uninstall-bin uninstall-hdrs uninstall-lib uninstall-data clean distclean dist $(OBJECTS:.lo=.d)
$(objects)/$(TARGET): update-revision $(OBJECTS) $(VERSION_OBJECTS)
$(objects)/$(TARGET): $(OBJECTS) $(VERSION_OBJECTS)
$(LIBTOOL) --mode=link $(CC) -o $@ $(OBJECTS) $(VERSION_OBJECTS) $(LDFLAGS) $(EXTRA_LDFLAGS) $(LT_LDFLAGS)
$(objects)/$(SDLMAIN_TARGET): $(SDLMAIN_OBJECTS)
@ -127,13 +124,18 @@ install: all install-bin install-hdrs install-lib install-data
install-bin:
$(SHELL) $(auxdir)/mkinstalldirs $(DESTDIR)$(bindir)
$(INSTALL) -m 755 sdl-config $(DESTDIR)$(bindir)/sdl-config
install-hdrs: include/SDL_revision.h
install-hdrs: update-revision
$(SHELL) $(auxdir)/mkinstalldirs $(DESTDIR)$(includedir)/SDL
for file in $(HDRS); do \
$(INSTALL) -m 644 $(srcdir)/include/$$file $(DESTDIR)$(includedir)/SDL/$$file; \
done
$(INSTALL) -m 644 include/SDL_config.h $(DESTDIR)$(includedir)/SDL/SDL_config.h
$(INSTALL) -m 644 include/SDL_revision.h $(DESTDIR)$(includedir)/SDL/SDL_revision.h
if test -f include/SDL_revision.h; then \
$(INSTALL) -m 644 include/SDL_revision.h $(DESTDIR)$(includedir)/SDL/SDL_revision.h; \
else \
$(INSTALL) -m 644 $(srcdir)/include/SDL_revision.h $(DESTDIR)$(includedir)/SDL/SDL_revision.h; \
fi
install-lib: $(objects) $(objects)/$(TARGET) $(objects)/$(SDLMAIN_TARGET)
$(SHELL) $(auxdir)/mkinstalldirs $(DESTDIR)$(libdir)
$(LIBTOOL) --mode=install $(INSTALL) $(objects)/$(TARGET) $(DESTDIR)$(libdir)/$(TARGET)
@ -167,7 +169,7 @@ clean:
if test -f test/Makefile; then (cd test; $(MAKE) $@); fi
distclean: clean
rm -f Makefile sdl-config
rm -f Makefile Makefile.rules sdl-config
rm -f SDL.qpg
rm -f config.status config.cache config.log libtool
rm -rf $(srcdir)/autom4te*