95a46c5577
Signed-off-by: Nico Schottelius <nico@ikn.schottelius.org>
181 lines
5.3 KiB
Makefile
181 lines
5.3 KiB
Makefile
# -*-makefile-*- (gpm/src)
|
|
#
|
|
# Copyright 1994,1997 rubini@linux.it
|
|
# Copyright 1997 dickey@clark.net
|
|
# Copyright (C) 1998 Ian Zimmerman <itz@rahul.net>
|
|
# Copyright (C) 2001,2002 Nico Schottelius <nico-gpm@schottelius.org>
|
|
#
|
|
|
|
srcdir = @srcdir@
|
|
top_builddir = ..
|
|
|
|
include $(top_builddir)/Makefile.include
|
|
|
|
# Main portion: regular build rules
|
|
MICESRC = mice.c twiddler.c synaptics.c @EVDEV_SRCS@
|
|
|
|
GSRC = main.c gpm.c gpn.c special.c startup.c server_tools.c console.c \
|
|
selection.c client.c optparser.c $(MICESRC)
|
|
|
|
GOBJ = $(GSRC:.c=.o) report.o
|
|
|
|
LSRC = lib/liblow.c lib/libhigh.c lib/libxtra.c lib/report-lib.c lib/tools.c
|
|
|
|
LOBJ = $(LSRC:.c=.o) @CURSES_OBJS@
|
|
|
|
PICS = $(LOBJ:.o=.lo)
|
|
|
|
HDRS = gpm.h gpmInt.h twiddler.h synaptics.h message.h
|
|
|
|
PSRC = prog/mev.c prog/hltest.c prog/mouse-test.c prog/disable-paste.c
|
|
|
|
POBJ = $(PSRC:.c=.o) prog/gpm-root.o
|
|
|
|
PROG = $(POBJ:.o=)
|
|
|
|
SRCS = $(GSRC) $(LSRC) $(PSRC) report.c
|
|
|
|
DEFS = @DEFS@
|
|
|
|
STRIP = -s
|
|
|
|
### BUILD PROCESS
|
|
|
|
# allow CFLAGS to be overriden from make command line
|
|
# ideally one would never have to write this rule again, but the GNU
|
|
# makefile standards are at cross-purposes: CFLAGS is reserved for
|
|
# user-overridable flags, but it's also all the implicit rule looks at.
|
|
|
|
# the prog rules are not very clean...
|
|
prog/%.o: prog/%.c
|
|
$(CC) @CPPFLAGS@ $(CPPFLAGS) @CFLAGS@ $(CFLAGS) -c -o $@ $<
|
|
|
|
prog/%: prog/%.o
|
|
$(CC) @LDFLAGS@ $(LDFLAGS) -o $@ $^ @LIBS@ $(LIBS)
|
|
|
|
%.o: %.c
|
|
$(CC) @CPPFLAGS@ $(CPPFLAGS) @CFLAGS@ $(CFLAGS) -c -o $@ $<
|
|
|
|
%.lo: %.c
|
|
$(CC) @CPPFLAGS@ $(CPPFLAGS) @PICFLAGS@ @CFLAGS@ $(CFLAGS) -c -o $@ $<
|
|
|
|
%: %.o
|
|
$(CC) @LDFLAGS@ $(LDFLAGS) -o $@ $^ @LIBS@ $(LIBS)
|
|
|
|
# old, unused, but good rule [dependings]
|
|
#%.d: $(srcdir)/%.c
|
|
# $(SHELL) -ec '$(CC) -M $(GPMCPPFLAGS) $(CPPFLAGS) $< \
|
|
# | $(SED) '\''s/\($*\)\.o\([ :]*\)/\1.o \1.lo\2/g'\'' > $(DEPDIR)/$@'
|
|
|
|
ifeq (@SHLIB@,)
|
|
LINK_LIB := lib/libgpm.a
|
|
else
|
|
LINK_LIB := @SHLIB@
|
|
endif
|
|
|
|
# Do it all!
|
|
all: gpm @SHLIB@ lib/libgpm.a $(PROG)
|
|
|
|
gpm: $(GOBJ)
|
|
$(CC) @LDFLAGS@ $(LDFLAGS) -o $@ $^ @LIBS@ @LIBM@ $(LIBS)
|
|
|
|
prog/mouse-test: prog/mouse-test.o
|
|
$(CC) @LDFLAGS@ $(LDFLAGS) -o $@ $^ @LIBS@ @LIBM@ $(LIBS)
|
|
|
|
subdirs-exist:
|
|
# make links in subdirectories
|
|
-@for cfiledirs in prog lib; do $(MKDIR) $$cfiledirs; \
|
|
cd $$cfiledirs; for cfiles in `echo $(srcdir)/$$cfiledirs/*.c`; \
|
|
do if ! test -e "$$cfiles" ; then $(LN_S) $$cfiles; fi; done; cd ..; done
|
|
|
|
# make links in srcdir
|
|
-@for cfiles in `echo $(srcdir)/*.c`; do if ! test -e "$$cfiles" ; then \
|
|
$(LN_S) $$cfiles; fi; done
|
|
|
|
# execute only once
|
|
touch $@
|
|
|
|
# construct dependings of sourcefiles and link sourcefiles
|
|
$(DEPFILE) dep: subdirs-exist prog/gpm-root.c
|
|
# cleanup
|
|
echo "" > "$(DEPFILE)"
|
|
# create dependencies
|
|
for DEPS in `echo *.c lib/*.c prog/*.c`; do \
|
|
$(CC) -I. -I $(srcdir) -M @CPPFLAGS@ $(CPPFLAGS) $$DEPS | \
|
|
$(SED) 's/^\(.*\)\.o\([ :]+\)/\1.o \1.lo\2/g' >> $(DEPFILE) ; done
|
|
# $(SED) 's/^\(.*\)\.o\([ :]*\)/\1.o \1.lo\2/g' >> $(DEPFILE) ; done
|
|
# $(SED) 's/\($*\)\.o\([ :]*\)/\1.o \1.lo\2/g' >> $(DEPFILE) ; done
|
|
|
|
### INSTALL
|
|
check: all
|
|
installdirs:
|
|
|
|
install: check
|
|
$(INSTALL_PROGRAM) gpm $(sbindir)/gpm
|
|
$(INSTALL_DATA) -m 644 lib/libgpm.a $(libdir)/libgpm.a
|
|
$(INSTALL_DATA) -m 644 $(srcdir)/headers/gpm.h $(includedir)/gpm.h
|
|
# POSIX requires the range of a for loop be nonempty and Bash
|
|
# 2.x goes along; unfortunately that means an additional
|
|
# headache in cases like this
|
|
if test "x@SHLIB@" != "x" ; then \
|
|
$(INSTALL_DATA) -m 644 lib/libgpm.so.@abi_full@ $(libdir)/libgpm.so.@abi_full@ ;\
|
|
cd $(libdir) && $(LN_S) -f libgpm.so.@abi_full@ libgpm.so ;\
|
|
echo "WARNING: We installed a lib, you should now call ldconfig" ; \
|
|
echo "f.i.: ldconfig -n -l $(libdir)/libgpm.so.@abi_full@" ;\
|
|
echo "Or to update everything just type ldconfig"; \
|
|
fi
|
|
|
|
# prog/
|
|
for i in $(PROG); do \
|
|
$(INSTALL_PROGRAM) $$i $(bindir)/`echo $$i | sed 's,prog/,,'` ;\
|
|
done
|
|
|
|
install-strip:
|
|
$(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) $(STRIP)' install
|
|
|
|
# Note: this leaves around /usr/lib/libgpm.so.1 and /usr/lib/libgpm.so.1.nn
|
|
# This is probably the right thing, because programs may be linked to it
|
|
uninstall:
|
|
rm -f $(bindir)/mev $(bindir)/gpm-root $(bindir)/disable-paste \
|
|
$(sbindir)/gpm $(libdir)/libgpm.a $(libdir)/libgpm.so $(includedir)/gpm.h
|
|
for i in $(PROG); do \
|
|
rm -f $(bindir)/$$i ;\
|
|
done
|
|
|
|
# cleaning up section
|
|
|
|
clean:
|
|
rm -f gpm lib/libgpm.a lib/libgpm.so lib/libgpm.so.@abi_full@ $(RDEPS)
|
|
rm -f core *~ $(GOBJ) $(LOBJ) $(POBJ) $(PICS) gpm-root.c $(DEPFILE)
|
|
rm -f $(PROG) $(POBJ) prog/gpm-root.c
|
|
|
|
distclean: clean
|
|
rm -f headers/config.h headers/config.h.in Makefile subdirs-exist $(DEPFILE)
|
|
|
|
# Configure & unconfigure
|
|
|
|
# Subdirectory prog/
|
|
prog/gpm-root.c: $(srcdir)/prog/gpm-root.y
|
|
$(YACC) $(YFLAGS) $< && mv y.tab.c prog/gpm-root.c
|
|
|
|
# gpm-root needs an own rule, because gpm-root.c is not in $(srcdir)
|
|
prog/gpm-root: prog/gpm-root.c
|
|
$(CC) -I. @CPPFLAGS@ $(CPPFLAGS) @CFLAGS@ $(CFLAGS) -c -o $@.o $<
|
|
$(CC) @LDFLAGS@ $(LDFLAGS) -o $@ $@.o @LIBS@ $(LIBS) $(LINK_LIB)
|
|
|
|
prog/mouse-test: $(MICESRC:.c=.o) console.o optparser.o
|
|
|
|
$(PROG): @SHLIB@ lib/libgpm.a
|
|
|
|
# Subdirectory lib/
|
|
lib/libgpm.a: $(LOBJ)
|
|
$(AR) rc lib/libgpm.a $(LOBJ)
|
|
$(RANLIB) lib/libgpm.a
|
|
|
|
lib/libgpm.so.@abi_full@: $(PICS)
|
|
$(CC) @SOLDFLAGS@libgpm.so.@abi_lev@ \
|
|
@LDFLAGS@ $(LDFLAGS) -o lib/libgpm.so.@abi_full@ $^ @LIBS@ @SHARED_LIBS@ $(LIBS)
|
|
lib/libgpm.so: lib/libgpm.so.@abi_full@
|
|
$(LN_S) -f libgpm.so.@abi_full@ lib/libgpm.so
|
|
|
|
include $(DEPFILE)
|