diff options
author | Andrey Nazarov <skuller@skuller.net> | 2010-09-17 17:23:00 +0400 |
---|---|---|
committer | Andrey Nazarov <skuller@skuller.net> | 2010-09-17 17:23:00 +0400 |
commit | 45e6aff04accfbafeeb27ebe32382dd75ff80939 (patch) | |
tree | ea419dafa77c101473edf0568ffd7494ad3b4ba3 | |
parent | e8918e68192d1a2350d3d930f1c2b5730d38b6df (diff) |
Cleaned up top level Makefile.
Split install/uninstall targets and moved them into ‘build/*.mk’ files.
Parallel and individual builds of main targets are now possible.
-rw-r--r-- | Makefile | 92 | ||||
-rw-r--r-- | build/baseq2.mk | 10 | ||||
-rw-r--r-- | build/q2pro.mk | 23 | ||||
-rw-r--r-- | build/q2proded.mk | 13 | ||||
-rw-r--r-- | build/target.mk | 12 | ||||
-rwxr-xr-x | configure | 8 |
6 files changed, 83 insertions, 75 deletions
@@ -1,81 +1,47 @@ include config.mk -.PHONY: default all binaries clean distclean install strip tags +.PHONY: default all binary strip tags clean distclean default: all -all: binaries +all: binary -binaries: - for t in $(TARGETS) ; do \ - $(MAKE) -C .$$t -f $(SRCDIR)/build/$$t.mk all || exit 1 ; \ - done +%-binary: + $(MAKE) -C .$* -f $(SRCDIR)/build/$*.mk binary -clean: - for t in $(TARGETS) ; do \ - $(MAKE) -C .$$t -f $(SRCDIR)/build/$$t.mk clean ; \ - done +%-strip: + $(MAKE) -C .$* -f $(SRCDIR)/build/$*.mk strip -distclean: clean - for t in $(TARGETS) ; do \ - rm -r .$$t ; \ - done - rm -f config.mk config.h - rm -f tags +%-clean: + $(MAKE) -C .$* -f $(SRCDIR)/build/$*.mk clean -ifdef SINGLEUSER +binary: $(patsubst %,%-binary,$(TARGETS)) -install: - echo "Single user mode configured, can't install" && exit 1 +strip: $(patsubst %,%-strip,$(TARGETS)) -uninstall: - echo "Single user mode configured, can't uninstall" && exit 1 +tags: + ctags $(SRCDIR)/src/*.[ch] $(SRCDIR)/src/baseq2/*.[ch] -else # SINGLEUSER +clean: $(patsubst %,%-clean,$(TARGETS)) -install: - for t in $(EXECUTABLES) ; do \ - install -m 755 -D $$t $(DESTDIR)$(BINDIR)/$$t ; \ - done - for t in $(LIBRARIES) ; do \ - install -m 755 -D $$t $(DESTDIR)$(LIBDIR)/baseq2/$$t ; \ - done - install -m 644 -D $(SRCDIR)/man/q2pro.6 \ - $(DESTDIR)$(MANDIR)/q2pro.6 - install -m 644 -D $(SRCDIR)/man/q2proded.6 \ - $(DESTDIR)$(MANDIR)/q2proded.6 - install -m 644 -D $(SRCDIR)/src/q2pro.menu \ - $(DESTDIR)$(DATADIR)/baseq2/q2pro.menu - install -m 644 -D $(SRCDIR)/src/q2pro.desktop \ - $(DESTDIR)$(APPDIR)/q2pro.desktop - install -m 644 -D $(SRCDIR)/src/q2pro.xpm \ - $(DESTDIR)$(PIXDIR)/q2pro.xpm - install -m 644 -D $(SRCDIR)/src/q2pro.default \ - $(DESTDIR)$(SITECFG) +distclean: clean + rm -rf .q2pro .q2proded .baseq2 + rm -f config.mk config.h + rm -f tags -uninstall: - for t in $(EXECUTABLES) ; do \ - rm -f $(DESTDIR)$(BINDIR)/$$t ; \ - done - for t in $(LIBRARIES) ; do \ - rm -f $(DESTDIR)$(LIBDIR)/baseq2/$$t ; \ - done - rm -f $(DESTDIR)$(MANDIR)/q2pro.6 - rm -f $(DESTDIR)$(MANDIR)/q2proded.6 - rm -f $(DESTDIR)$(DATADIR)/baseq2/q2pro.menu - rm -f $(DESTDIR)$(APPDIR)/q2pro.desktop - rm -f $(DESTDIR)$(PIXDIR)/q2pro.xpm - rm -f $(DESTDIR)$(SITECFG) +ifndef SINGLEUSER +.PHONY: install uninstall -endif # !SINGLEUSER +%-install: + $(MAKE) -C .$* -f $(SRCDIR)/build/$*.mk install -strip: - for t in $(BINARIES) ; do \ - $(STRIP) $$t ; \ - done +%-uninstall: + $(MAKE) -C .$* -f $(SRCDIR)/build/$*.mk uninstall -docs: - $(MAKE) -C doc/wiki +install: $(patsubst %,%-install,$(TARGETS)) + install -m 644 -D $(SRCDIR)/src/q2pro.default \ + $(DESTDIR)$(SITECFG) -tags: - ctags $(SRCDIR)/src/*.[ch] $(SRCDIR)/src/baseq2/*.[ch] +uninstall: $(patsubst %,%-uninstall,$(TARGETS)) + -rm $(DESTDIR)$(SITECFG) +endif diff --git a/build/baseq2.mk b/build/baseq2.mk index 58385fd..db9ffc0 100644 --- a/build/baseq2.mk +++ b/build/baseq2.mk @@ -44,3 +44,13 @@ g_ptrs.c include $(SRCDIR)/build/target.mk +ifndef SINGLEUSER +.PHONY: install uninstall + +install: $(TARGET) + install -m 755 -D $(TARGET) \ + $(DESTDIR)$(LIBDIR)/baseq2/$(GAMELIB) + +uninstall: + -rm $(DESTDIR)$(LIBDIR)/baseq2/$(GAMELIB) +endif diff --git a/build/q2pro.mk b/build/q2pro.mk index 0241865..fda4839 100644 --- a/build/q2pro.mk +++ b/build/q2pro.mk @@ -147,3 +147,26 @@ endif # !MINGW include $(SRCDIR)/build/target.mk +ifndef SINGLEUSER +.PHONY: install uninstall + +install: $(TARGET) + install -m 755 -D $(TARGET) \ + $(DESTDIR)$(BINDIR)/q2pro$(EXESUFFIX) + install -m 644 -D $(SRCDIR)/man/q2pro.6 \ + $(DESTDIR)$(MANDIR)/q2pro.6 + install -m 644 -D $(SRCDIR)/src/q2pro.menu \ + $(DESTDIR)$(DATADIR)/baseq2/q2pro.menu + install -m 644 -D $(SRCDIR)/src/q2pro.desktop \ + $(DESTDIR)$(APPDIR)/q2pro.desktop + install -m 644 -D $(SRCDIR)/src/q2pro.xpm \ + $(DESTDIR)$(PIXDIR)/q2pro.xpm + +uninstall: + -rm $(DESTDIR)$(BINDIR)/q2pro$(EXESUFFIX) + -rm $(DESTDIR)$(MANDIR)/q2pro.6 + -rm $(DESTDIR)$(DATADIR)/baseq2/q2pro.menu + -rm $(DESTDIR)$(APPDIR)/q2pro.desktop + -rm $(DESTDIR)$(PIXDIR)/q2pro.xpm +endif #!SINGLEUSER + diff --git a/build/q2proded.mk b/build/q2proded.mk index 5d7bf84..433fd03 100644 --- a/build/q2proded.mk +++ b/build/q2proded.mk @@ -47,3 +47,16 @@ endif include $(SRCDIR)/build/target.mk +ifndef SINGLEUSER +.PHONY: install uninstall + +install: $(TARGET) + install -m 755 -D $(TARGET) \ + $(DESTDIR)$(BINDIR)/q2proded$(EXESUFFIX) + install -m 644 -D $(SRCDIR)/man/q2proded.6 \ + $(DESTDIR)$(MANDIR)/q2proded.6 + +uninstall: + -rm $(DESTDIR)$(BINDIR)/q2proded$(EXESUFFIX) + -rm $(DESTDIR)$(MANDIR)/q2proded.6 +endif diff --git a/build/target.mk b/build/target.mk index d674245..10f1503 100644 --- a/build/target.mk +++ b/build/target.mk @@ -21,11 +21,11 @@ default: $(TARGET) all: $(TARGET) +binary: $(TARGET) + clean: - @rm -f *.d - @rm -f *.o - @rm -f $(TARGET) - + @rm -f *.d *.o $(TARGET) + .PHONY: clean %.o: %.c @@ -44,5 +44,9 @@ $(TARGET): $(OBJFILES) @echo [LD] $@ @$(CC) -o $@ $^ $(LDFLAGS) +strip: $(TARGET) + @echo [ST] $< + @$(STRIP) $< + -include *.d @@ -48,8 +48,6 @@ help="no" exesuffix="" libsuffix=".so" targets="" -executables="" -libraries="" cpu="" singleuser="no" asmflags="" @@ -428,7 +426,6 @@ CFLAGS="-I\$(OUTDIR) -MF \$*.d -MMD -pipe -ffloat-store $CFLAGS -Wno-strict-alia # determine what needs to be built if [ "$use_client" = "yes" ]; then targets="$targets q2pro" - executables="$executables q2pro$exesuffix" else use_snddma="no" use_openal="no" @@ -447,12 +444,10 @@ fi if [ "$use_server" = "yes" ]; then targets="$targets q2proded" - executables="$executables q2proded$exesuffix" fi if [ "$use_baseq2" = "yes" ]; then targets="$targets baseq2" - libraries="$libraries $gamelib" fi if [ "$use_png" = "yes" ]; then @@ -489,9 +484,6 @@ echo "LDFLAGS=$LDFLAGS" >> $config_mk [ "$use_asm" = "yes" ] && echo "ASMFLAGS=$asmflags" >> $config_mk echo "TARGETS=$targets" >> $config_mk -echo "BINARIES=$executables $libraries" >> $config_mk -echo "EXECUTABLES=$executables" >> $config_mk -echo "LIBRARIES=$libraries" >> $config_mk echo "REVISION=$revision" >> $config_mk echo "#define REVISION $revision" >> $config_h |