From d067e2dc0d67e92739754ddf83b794e19d248eae Mon Sep 17 00:00:00 2001 From: Renaud Fivet Date: Wed, 14 Jul 2021 10:10:58 +0800 Subject: [PATCH] make source and make depend implicitly done. --- Makefile | 136 ++++++++----------------------------------------------- 1 file changed, 19 insertions(+), 117 deletions(-) diff --git a/Makefile b/Makefile index 27e9b52..fa3bdca 100644 --- a/Makefile +++ b/Makefile @@ -1,10 +1,5 @@ -# Makefile for uEMACS, updated 03 Nov 2020 10:22:37 - -SRC=basic.c bind.c bindable.c buffer.c display.c ebind.c eval.c exec.c execute.c file.c fileio.c flook.c input.c isearch.c line.c lock.c main.c mlout.c names.c pklock.c posix.c random.c region.c search.c spawn.c tcap.c termio.c utf8.c util.c window.c word.c wrapper.c -OBJ=basic.o bind.o bindable.o buffer.o display.o ebind.o eval.o exec.o execute.o file.o fileio.o flook.o input.o isearch.o line.o lock.o main.o mlout.o names.o pklock.o posix.o random.o region.o search.o spawn.o tcap.o termio.o utf8.o util.o window.o word.o wrapper.o -HDR=basic.h bind.h bindable.h buffer.h defines.h display.h ebind.h estruct.h eval.h exec.h execute.h file.h fileio.h flook.h input.h isa.h isearch.h line.h lock.h mlout.h names.h pklock.h random.h region.h retcode.h search.h spawn.h terminal.h termio.h utf8.h util.h version.h window.h word.h wrapper.h - -# DO NOT ADD OR MODIFY ANY LINES ABOVE THIS -- make source creates them +# Makefile -- uEMACS +# Copyright (c) 2014-2021 Renaud Fivet # Make the build silent by default V = @@ -32,13 +27,13 @@ LDFLAGS=-s LIBS=-lcurses DEFINES=-DAUTOCONF -DPROGRAM=$(PROGRAM) ifeq ($(uname_S),Linux) - DEFINES:= $(DEFINES) -DPOSIX -DUSG + DEFINES += -DPOSIX -DUSG else ifeq ($(uname_S),CYGWIN) - DEFINES:= $(DEFINES) -DCYGWIN -DSYSV + DEFINES += -DCYGWIN -DSYSV else ifeq ($(uname_S),MSYS) - DEFINES:= $(DEFINES) -DCYGWIN -DSYSV + DEFINES += -DCYGWIN -DSYSV else ifeq ($(uname_S),NetBSD) - DEFINES:= $(DEFINES) -DPOSIX -DBSD=1 + DEFINES += -DPOSIX -DBSD=1 else $(error $(uname_S) needs configuration) endif @@ -50,7 +45,6 @@ endif # DEFINES=-DAUTOCONF -DPOSIX -DSYSV -D_DARWIN_C_SOURCE -D_BSD_SOURCE -D_SVID_SOURCE -D_XOPEN_SOURCE=600 #endif -#DEFINES=-DAUTOCONF #LIBS=-ltermcap # BSD #LIBS=-lcurses # SYSV #LIBS=-ltermlib @@ -59,19 +53,22 @@ LFLAGS=-hbx BINDIR=/usr/bin LIBDIR=/usr/lib -$(PROGRAM): $(OBJ) +SRCS = $(sort $(wildcard *.c)) +OBJS = $(SRCS:.c=.o) + +$(PROGRAM): $(OBJS) $(E) " LINK " $@ - $(Q) $(CC) $(LDFLAGS) -o $@ $(OBJ) $(LIBS) + $(Q) $(CC) $(LDFLAGS) -o $@ $(OBJS) $(LIBS) SPARSE=sparse SPARSE_FLAGS=-D__LITTLE_ENDIAN__ -D__x86_64__ -D__linux__ -D__unix__ sparse: - $(SPARSE) $(SPARSE_FLAGS) $(DEFINES) $(SRC) + $(SPARSE) $(SPARSE_FLAGS) $(DEFINES) $(SRCS) clean: $(E) " CLEAN" - $(Q) rm -f $(PROGRAM) core lintout makeout tags Makefile.bak *.o + $(Q) rm -f $(PROGRAM) core lintout makeout tags *.o install: $(PROGRAM) strip $(PROGRAM) @@ -87,7 +84,7 @@ lint: ${SRC} cat lintout splint: - splint -weak $(DEFINES) $(SRC) -booltype boolean -booltrue TRUE -boolfalse FALSE +posixlib +matchanyintegral + splint -weak $(DEFINES) $(SRCS) -booltype boolean -booltrue TRUE -boolfalse FALSE +posixlib +matchanyintegral errs: @rm -f makeout @@ -97,109 +94,14 @@ tags: ${SRC} @rm -f tags ctags ${SRC} -source: - @mv Makefile Makefile.bak - @echo "# Makefile for uEMACS, updated `date`" >Makefile - @echo '' >>Makefile -#Sorted - @echo SRC=`ls *.c` >>Makefile - @echo OBJ=`ls *.c | sed s/c$$/o/` >>Makefile - @echo HDR=`ls *.h` >>Makefile -#UnSorted -# @echo SRC=$(wildcard *.c) >>Makefile -# @echo OBJ=$(patsubst %.c,%.o,$(wildcard *.c)) >>Makefile -# @echo HDR=$(wildcard *.h) >>Makefile - @echo '' >>Makefile - @sed -n -e '/^# DO NOT ADD OR MODIFY/,$$p' Makefile.bak >> Makefile - -depend: ${SRC} - @mv Makefile Makefile.bak - @sed -n -e '1,/^# DO NOT DELETE THIS LINE/p' Makefile.bak > Makefile - @echo "# Updated `date`" >> Makefile - @echo >> Makefile - @for i in ${SRC}; do\ - $(CC) ${DEFINES} -MM $$i ; done >> Makefile - @echo '' >>Makefile - @echo '# DEPENDENCIES MUST END AT END OF FILE' >>Makefile - @echo '# IF YOU PUT STUFF HERE IT WILL GO AWAY' >>Makefile - @echo '# see make depend above' >>Makefile - .c.o: $(E) " CC " $@ $(Q) ${CC} ${CFLAGS} ${DEFINES} -c $*.c -# DO NOT DELETE THIS LINE -- make depend uses it -# Updated 03 Nov 2020 10:29:47 +depend.mak: $(SRCS) + $(E) " DEPEND" + $(Q) $(CC) $(DEFINES) -MM $+ > depend.mak -basic.o: basic.c basic.h retcode.h input.h bind.h mlout.h random.h \ - terminal.h defines.h utf8.h window.h buffer.h line.h -bind.o: bind.c bind.h estruct.h bindable.h buffer.h line.h retcode.h \ - utf8.h display.h ebind.h exec.h file.h flook.h input.h names.h util.h \ - window.h defines.h -bindable.o: bindable.c bindable.h defines.h buffer.h line.h retcode.h \ - utf8.h display.h estruct.h file.h input.h bind.h lock.h mlout.h \ - terminal.h -buffer.o: buffer.c buffer.h line.h retcode.h utf8.h defines.h estruct.h \ - file.h input.h bind.h mlout.h util.h window.h -display.o: display.c display.h estruct.h utf8.h buffer.h line.h retcode.h \ - input.h bind.h termio.h terminal.h defines.h version.h wrapper.h \ - window.h -ebind.o: ebind.c ebind.h basic.h retcode.h bind.h estruct.h bindable.h \ - buffer.h line.h utf8.h eval.h exec.h file.h isearch.h random.h region.h \ - search.h spawn.h window.h defines.h word.h -eval.o: eval.c eval.h basic.h retcode.h bind.h buffer.h line.h utf8.h \ - display.h estruct.h exec.h execute.h flook.h input.h random.h search.h \ - terminal.h defines.h termio.h util.h version.h window.h -exec.o: exec.c exec.h retcode.h buffer.h line.h utf8.h bind.h display.h \ - estruct.h eval.h file.h flook.h input.h random.h util.h window.h \ - defines.h -execute.o: execute.c execute.h estruct.h bind.h random.h retcode.h \ - display.h utf8.h file.h buffer.h line.h input.h mlout.h search.h \ - terminal.h defines.h window.h -file.o: file.c file.h buffer.h line.h retcode.h utf8.h defines.h \ - display.h estruct.h execute.h fileio.h input.h bind.h lock.h mlout.h \ - util.h window.h -fileio.o: fileio.c fileio.h defines.h retcode.h utf8.h -flook.o: flook.c flook.h retcode.h defines.h fileio.h -input.o: input.c input.h bind.h estruct.h bindable.h display.h utf8.h \ - exec.h retcode.h isa.h names.h terminal.h defines.h wrapper.h -isearch.o: isearch.c isearch.h basic.h retcode.h buffer.h line.h utf8.h \ - display.h estruct.h exec.h input.h bind.h search.h terminal.h defines.h \ - util.h window.h -line.o: line.c line.h retcode.h utf8.h buffer.h estruct.h mlout.h \ - window.h defines.h -lock.o: lock.c estruct.h lock.h -main.o: main.c estruct.h basic.h retcode.h bind.h bindable.h buffer.h \ - line.h utf8.h display.h eval.h execute.h file.h lock.h mlout.h random.h \ - search.h terminal.h defines.h termio.h util.h version.h window.h -mlout.o: mlout.c mlout.h -names.o: names.c names.h basic.h retcode.h bind.h bindable.h buffer.h \ - line.h utf8.h display.h estruct.h eval.h exec.h file.h isearch.h \ - region.h random.h search.h spawn.h window.h defines.h word.h -pklock.o: pklock.c estruct.h pklock.h -posix.o: posix.c -random.o: random.c random.h retcode.h basic.h buffer.h line.h utf8.h \ - display.h estruct.h execute.h input.h bind.h search.h terminal.h \ - defines.h window.h -region.o: region.c region.h line.h retcode.h utf8.h buffer.h estruct.h \ - mlout.h random.h window.h defines.h -search.o: search.c search.h line.h retcode.h utf8.h basic.h buffer.h \ - display.h estruct.h input.h bind.h isa.h mlout.h terminal.h defines.h \ - util.h window.h -spawn.o: spawn.c spawn.h defines.h buffer.h line.h retcode.h utf8.h \ - display.h estruct.h exec.h file.h flook.h input.h bind.h terminal.h \ - window.h -tcap.o: tcap.c terminal.h defines.h retcode.h utf8.h display.h estruct.h \ - termio.h -termio.o: termio.c termio.h utf8.h estruct.h retcode.h -utf8.o: utf8.c utf8.h -util.o: util.c util.h -window.o: window.c window.h defines.h buffer.h line.h retcode.h utf8.h \ - basic.h display.h estruct.h execute.h terminal.h wrapper.h -word.o: word.c word.h basic.h retcode.h buffer.h line.h utf8.h estruct.h \ - isa.h mlout.h random.h region.h window.h defines.h -wrapper.o: wrapper.c wrapper.h +include depend.mak -# DEPENDENCIES MUST END AT END OF FILE -# IF YOU PUT STUFF HERE IT WILL GO AWAY -# see make depend above +# end of Makefile