2000-04-14 05:42:18 -05:00
|
|
|
# Makefile.common -- standard targets and rules
|
|
|
|
# Copyright (C) 2000 Linas Vepstas
|
|
|
|
#
|
|
|
|
# This program is free software; you can redistribute it and/or
|
|
|
|
# modify it under the terms of the GNU General Public License as
|
|
|
|
# published by the Free Software Foundation; either version 2 of
|
|
|
|
# the License, or (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with this program; if not, contact:
|
|
|
|
#
|
|
|
|
# Free Software Foundation Voice: +1-617-542-5942
|
|
|
|
# 59 Temple Place - Suite 330 Fax: +1-617-542-2652
|
|
|
|
# Boston, MA 02111-1307, USA gnu@gnu.org
|
1998-04-21 22:25:34 -05:00
|
|
|
|
|
|
|
# Autoconf notes...
|
|
|
|
# Need to handle -MD there.
|
|
|
|
|
|
|
|
# COMMON_SRCS: have to be compiled separately for all flavors
|
|
|
|
# MOTIF_SRCS: are motif only sources
|
|
|
|
# GNOME_SRCS: are gnome only sources
|
|
|
|
# INDEP_SRCS: are for flavor independent sources (like engine)
|
|
|
|
|
|
|
|
# OBJS is for flavor independent files
|
|
|
|
# GNOME/MOTIF_OBJS is for flavor dependent files
|
|
|
|
|
2000-03-31 03:41:07 -06:00
|
|
|
# Clear all of the default suffix rules. They were causing a great
|
|
|
|
# deal of agony when trying to get the .tmpl rules to work. In
|
|
|
|
# general, we want to take charge of these for now.
|
|
|
|
.SUFFIXES:
|
|
|
|
|
1998-04-21 22:25:34 -05:00
|
|
|
OBJS := $(addprefix obj/,${INDEP_SRCS:.c=.o})
|
|
|
|
GNOME_OBJS := $(addprefix obj/gnome/,${COMMON_SRCS:.c=.o})
|
|
|
|
GNOME_OBJS += $(addprefix obj/gnome/,${GNOME_SRCS:.c=.o})
|
|
|
|
MOTIF_OBJS := $(addprefix obj/motif/,${COMMON_SRCS:.c=.o})
|
|
|
|
MOTIF_OBJS += $(addprefix obj/motif/,${MOTIF_SRCS:.c=.o})
|
1998-09-09 10:10:37 -05:00
|
|
|
QT_OBJS := $(addprefix obj/qt/,${COMMON_SRCS:.c=.o})
|
1998-08-05 23:34:47 -05:00
|
|
|
QT_OBJS += $(addprefix obj/qt/,${QT_SRCS:.cpp=.o})
|
1998-04-21 22:25:34 -05:00
|
|
|
|
2000-05-12 04:47:17 -05:00
|
|
|
CFLAGS += ${DEFS}
|
1999-04-11 00:11:41 -05:00
|
|
|
|
1999-01-20 00:02:12 -06:00
|
|
|
ifdef GNOME_CONFIG_BIN
|
|
|
|
GNOME_CFLAGS += $(shell ${GNOME_CONFIG_BIN} --cflags gnomeui)
|
|
|
|
endif
|
|
|
|
|
2000-04-14 05:42:18 -05:00
|
|
|
ifdef GLIB_CONFIG_BIN
|
|
|
|
GLIB_CFLAGS := $(shell ${GLIB_CONFIG_BIN} --cflags)
|
|
|
|
GLIB_LIBS := $(shell ${GLIB_CONFIG_BIN} --libs)
|
|
|
|
endif
|
|
|
|
|
1998-08-05 23:34:47 -05:00
|
|
|
QT_FLAGS :=
|
1998-04-21 22:25:34 -05:00
|
|
|
|
1999-07-12 23:10:37 -05:00
|
|
|
|
2000-03-31 03:41:07 -06:00
|
|
|
# All c files depend on headers with the same names.
|
1998-04-21 22:25:34 -05:00
|
|
|
%.c : %.h
|
|
|
|
|
|
|
|
# Basically take the output foo.d file and put it in the right
|
|
|
|
# subdirectory, adding a prefix indicating where the file actually
|
|
|
|
# lives (i.e. obj-pic/Foo.cc rather than Foo.cc. This would all be
|
|
|
|
# unnecessary if gcc actually paid attention to the argument to "-o".
|
|
|
|
|
|
|
|
# Note that this cannot handle subdirs in the Makefile dir, so if the
|
|
|
|
# relevant Makefile was src/foo/Makefile, this rule can't handle
|
|
|
|
# src/foo/bar/x.c src/foo/x.c and src/foo/bax/x.c. You'd need another
|
|
|
|
# Makefile in src/foo/bar and src/foo/bax for now.
|
|
|
|
|
|
|
|
define cleanupdeps
|
1998-05-26 00:19:39 -05:00
|
|
|
sed -e "1 s|$(basename $<)\.o|$@|1" $(basename $@).d.tmp > $(basename $@).d
|
|
|
|
rm $(basename $@).d.tmp
|
1998-04-21 22:25:34 -05:00
|
|
|
endef
|
|
|
|
|
|
|
|
# Default rule used for non-flavor dependent files (i.e. all of register)
|
|
|
|
obj/%.o: %.c
|
|
|
|
@if [ ! -e $(dir $@) ]; then mkdir -p $(dir $@); fi
|
1998-05-26 00:19:39 -05:00
|
|
|
$(CC) -Wp,-MD,$(basename $@).d.tmp -c $(CFLAGS) -o $@ $<
|
1998-04-21 22:25:34 -05:00
|
|
|
${cleanupdeps}
|
|
|
|
|
1999-04-11 00:11:41 -05:00
|
|
|
obj/%.o: %.cpp
|
|
|
|
@if [ ! -e $(dir $@) ]; then mkdir -p $(dir $@); fi
|
|
|
|
g++ -Wp,-MD,$(basename $@).d.tmp -c $(CFLAGS) -o $@ $<
|
|
|
|
${cleanupdeps}
|
|
|
|
|
|
|
|
|
1998-04-21 22:25:34 -05:00
|
|
|
obj/motif/%.o: %.c
|
|
|
|
@if [ ! -e $(dir $@) ]; then mkdir -p $(dir $@); fi
|
1999-01-20 00:02:12 -06:00
|
|
|
$(CC) -Wp,-MD,$(basename $@).d.tmp -c $(CFLAGS) ${MOTIF_CFLAGS} -DMOTIF -o $@ $<
|
1998-04-21 22:25:34 -05:00
|
|
|
${cleanupdeps}
|
|
|
|
|
|
|
|
obj/gnome/%.o: %.c
|
|
|
|
@if [ ! -e $(dir $@) ]; then mkdir -p $(dir $@); fi
|
1999-01-20 00:02:12 -06:00
|
|
|
$(CC) -Wp,-MD,$(basename $@).d.tmp -c $(CFLAGS) ${GNOME_CFLAGS} -DGNOME -o $@ $<
|
1998-04-21 22:25:34 -05:00
|
|
|
${cleanupdeps}
|
|
|
|
|
1999-04-11 00:11:41 -05:00
|
|
|
obj/qt/%.o: %.cpp
|
1999-03-28 13:19:49 -06:00
|
|
|
@if [ ! -e $(dir $@) ]; then mkdir -p $(dir $@); fi
|
1999-04-11 00:11:41 -05:00
|
|
|
g++ -Wp,-MD,$(basename $@).d.tmp -c $(CFLAGS) ${QT_CFLAGS} -DKDE -o $@ $<
|
1999-03-28 13:19:49 -06:00
|
|
|
${cleanupdeps}
|
|
|
|
|
1999-04-11 00:11:41 -05:00
|
|
|
obj/qt/%.o: %.c
|
1998-08-05 23:34:47 -05:00
|
|
|
@if [ ! -e $(dir $@) ]; then mkdir -p $(dir $@); fi
|
|
|
|
$(CC) -Wp,-MD,$(basename $@).d.tmp -c $(CFLAGS) ${QT_CFLAGS} -DKDE -o $@ $<
|
|
|
|
${cleanupdeps}
|
|
|
|
|
1998-10-27 23:55:38 -06:00
|
|
|
clean-files:
|
1999-05-29 18:46:49 -05:00
|
|
|
rm -f *~ *.bak \#*
|
1998-04-21 22:25:34 -05:00
|
|
|
rm -rf obj
|
1998-09-09 00:43:16 -05:00
|
|
|
-rm -rf ${TRASH}
|
1998-04-21 22:25:34 -05:00
|
|
|
|
1998-10-27 23:55:38 -06:00
|
|
|
clean: clean-files
|
|
|
|
$(foreach dir,${CLEAN_SUBDIRS},(cd ${dir} && $(MAKE) clean);)
|
|
|
|
|
|
|
|
distclean: clean-files
|
1998-08-02 14:44:42 -05:00
|
|
|
$(foreach dir,${CLEAN_SUBDIRS},(cd ${dir} && $(MAKE) distclean);)
|
1998-10-20 22:42:25 -05:00
|
|
|
rm -f Makefile.bak
|
1998-10-27 23:55:38 -06:00
|
|
|
rm -f $(foreach f,$(wildcard *.in),$(filter-out configure,$(f:.in=)))
|
|
|
|
-rm -rf ${DIST_TRASH}
|
1998-04-21 22:25:34 -05:00
|
|
|
|
1999-07-12 23:10:37 -05:00
|
|
|
dist:
|
|
|
|
$(foreach dir,${CLEAN_SUBDIRS},(cd ${dir} && $(MAKE) dist);)
|
|
|
|
|
|
|
|
.PHONY: clean clean-files dist distclean
|
1998-04-21 22:25:34 -05:00
|
|
|
|
|
|
|
# Get dependencies (if existent).
|
|
|
|
|
|
|
|
-include $(shell if [ -e obj ]; then find obj -name "*.d"; fi) ""
|