Makefile: Improvements for detached build directory and cross-compiling

This commit is contained in:
Jörg Sommer 2024-08-26 20:29:27 +02:00
parent 83c81d2bfc
commit a5a676dbbd
3 changed files with 11 additions and 15 deletions

View File

@ -28,7 +28,7 @@ install:
$(INSTALL) -m 0644 conserver.cf.man $(DESTDIR)$(mandir)/man5/conserver.cf.5
$(INSTALL) -m 0644 conserver.passwd.man $(DESTDIR)$(mandir)/man5/conserver.passwd.5
$(MKDIR) $(DESTDIR)$(exampledir)
$(INSTALL) -m 0644 conserver.cf $(DESTDIR)$(exampledir)
$(INSTALL) -m 0644 conserver.passwd $(DESTDIR)$(exampledir)
$(INSTALL) -m 0644 $(srcdir)/conserver.cf $(DESTDIR)$(exampledir)
$(INSTALL) -m 0644 $(srcdir)/conserver.passwd $(DESTDIR)$(exampledir)
.PHONY: clean distclean install

View File

@ -25,9 +25,11 @@ CFLAGS = @CFLAGS@
DEFS = @DEFS@ -DSYSCONFDIR=\"$(sysconfdir)\"
CPPFLAGS = -I.. -I$(top_srcdir) -I$(srcdir) $(DEFS) @CPPFLAGS@ @CONSCPPFLAGS@
LDFLAGS = @LDFLAGS@ @CONSLDFLAGS@
LIBS = @LIBS@ @CONSLIBS@
LDLIBS = @LIBS@ @CONSLIBS@
LINK.o = $(LINK.c)
@SET_MAKE@
vpath %.c $(srcdir)
### Makefile rules - no user-servicable parts below
@ -46,13 +48,9 @@ all: $(ALL)
$(CONSERVER_OBJS): $(CONSERVER_HDRS)
conserver: $(CONSERVER_OBJS)
$(CC) $(CFLAGS) $(LDFLAGS) -o conserver $(CONSERVER_OBJS) $(LIBS)
$(LINK.o) $^ $(LOADLIBES) $(LDLIBS) -o $@
convert: convert.o cutil.o
$(CC) $(CFLAGS) $(LDFLAGS) -o convert convert.o cutil.o $(LIBS)
.c.o:
$(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $<
clean:
rm -f *~ *.o $(ALL) core

View File

@ -21,9 +21,11 @@ CFLAGS = @CFLAGS@
DEFS = @DEFS@ -DSYSCONFDIR=\"$(sysconfdir)\"
CPPFLAGS = -I.. -I$(top_srcdir) -I$(srcdir) -I$(top_srcdir)/conserver $(DEFS) @CPPFLAGS@
LDFLAGS = @LDFLAGS@
LIBS = @LIBS@
LDLIBS = @LIBS@
LINK.o = $(LINK.c)
@SET_MAKE@
vpath %.c $(srcdir)
### Makefile rules - no user-servicable parts below
@ -39,14 +41,10 @@ all: $(ALL)
$(CONSOLE_OBJS): $(CONSOLE_HDRS)
console: $(CONSOLE_OBJS)
$(CC) $(CFLAGS) $(LDFLAGS) -o console $(CONSOLE_OBJS) $(LIBS)
console: $(CONSOLE_OBJS) $(LIBS)
../conserver/cutil.o:
( cd ../conserver && $(MAKE) $(MAKE_FLAGS) cutil.o ) || exit 1;
.c.o:
$(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $<
$(MAKE) -C ../conserver $(MAKE_FLAGS) cutil.o
clean:
rm -f *~ *.o $(ALL) core