mirror of
https://github.com/Gnucash/gnucash.git
synced 2024-11-23 09:26:27 -06:00
65efb0f943
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@1133 57a11ea4-9604-0410-9ed3-97b8803252fd
88 lines
2.8 KiB
Makefile
88 lines
2.8 KiB
Makefile
### -*-makefile-*- #################################################
|
|
## Makefile.common
|
|
##
|
|
## standard targets and rules
|
|
####################################################################
|
|
|
|
# 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
|
|
|
|
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})
|
|
QT_OBJS := $(addprefix obj/qt/,${COMMON_SRCS:.c=.o})
|
|
QT_OBJS += $(addprefix obj/qt/,${QT_SRCS:.cpp=.o})
|
|
|
|
GTK_CFLAGS := $(shell gtk-config --cflags)
|
|
QT_FLAGS :=
|
|
|
|
%.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
|
|
sed -e "1 s|$(basename $<)\.o|$@|1" $(basename $@).d.tmp > $(basename $@).d
|
|
rm $(basename $@).d.tmp
|
|
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
|
|
$(CC) -Wp,-MD,$(basename $@).d.tmp -c $(CFLAGS) -o $@ $<
|
|
${cleanupdeps}
|
|
|
|
obj/motif/%.o: %.c
|
|
@if [ ! -e $(dir $@) ]; then mkdir -p $(dir $@); fi
|
|
$(CC) -Wp,-MD,$(basename $@).d.tmp -c $(CFLAGS) -DMOTIF -o $@ $<
|
|
${cleanupdeps}
|
|
|
|
obj/gnome/%.o: %.c
|
|
@if [ ! -e $(dir $@) ]; then mkdir -p $(dir $@); fi
|
|
$(CC) -Wp,-MD,$(basename $@).d.tmp -c $(CFLAGS) ${GTK_CFLAGS} -DGNOME -o $@ $<
|
|
${cleanupdeps}
|
|
|
|
obj/qt/%.o: %.cpp
|
|
@if [ ! -e $(dir $@) ]; then mkdir -p $(dir $@); fi
|
|
$(CC) -Wp,-MD,$(basename $@).d.tmp -c $(CFLAGS) ${QT_CFLAGS} -DKDE -o $@ $<
|
|
${cleanupdeps}
|
|
|
|
clean:
|
|
$(foreach dir,${CLEAN_SUBDIRS},(cd ${dir} && $(MAKE) clean);)
|
|
rm -f *~ *.bak \#* $(TRASH)
|
|
rm -rf obj
|
|
-rm -rf ${TRASH}
|
|
|
|
distclean:
|
|
$(foreach dir,${CLEAN_SUBDIRS},(cd ${dir} && $(MAKE) distclean);)
|
|
rm -f *~ *.bak \#* $(TRASH)
|
|
rm -rf obj
|
|
rm -f Makefile Makefile.bak config.h
|
|
|
|
.PHONY: clean distclean
|
|
|
|
# Get dependencies (if existent).
|
|
|
|
-include $(shell if [ -e obj ]; then find obj -name "*.d"; fi) ""
|
|
|
|
# Local Variables:
|
|
# tab-width: 2
|
|
# End:
|