2021-07-13 22:10:58 -04:00
|
|
|
# Makefile -- uEMACS
|
|
|
|
# Copyright (c) 2014-2021 Renaud Fivet
|
2005-05-31 11:50:56 -04:00
|
|
|
|
2010-02-26 13:48:56 -05:00
|
|
|
# Make the build silent by default
|
|
|
|
V =
|
|
|
|
|
|
|
|
ifeq ($(strip $(V)),)
|
|
|
|
E = @echo
|
|
|
|
Q = @
|
|
|
|
else
|
|
|
|
E = @\#
|
|
|
|
Q =
|
|
|
|
endif
|
|
|
|
export E Q
|
|
|
|
|
2010-08-25 03:35:55 -04:00
|
|
|
uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not')
|
2015-02-11 02:19:11 -05:00
|
|
|
# for windows based target, insure we strip the variant part
|
2020-11-01 22:31:24 -05:00
|
|
|
# CYGWIN_NT-6.1, CYGWIN_NT-6.1-WOW, CYGWIN_NT-6.1-WOW64, MSYS_NT-10.0-19042
|
2015-02-11 02:19:11 -05:00
|
|
|
uname_S := $(shell sh -c 'echo $(uname_S) | sed s/_.*$$//')
|
2010-08-25 03:35:55 -04:00
|
|
|
|
2013-05-16 21:21:59 -04:00
|
|
|
PROGRAM=ue
|
2010-08-29 06:08:13 -04:00
|
|
|
|
2005-05-31 11:50:56 -04:00
|
|
|
CC=gcc
|
2020-06-16 02:09:44 -04:00
|
|
|
WARNINGS=-pedantic -Wall -Wextra -Wstrict-prototypes -Wno-unused-parameter
|
2010-02-27 05:38:24 -05:00
|
|
|
CFLAGS=-O2 $(WARNINGS)
|
2021-02-22 22:30:28 -05:00
|
|
|
LDFLAGS=-s
|
2020-11-01 22:31:24 -05:00
|
|
|
LIBS=-lcurses
|
|
|
|
DEFINES=-DAUTOCONF -DPROGRAM=$(PROGRAM)
|
2010-08-25 03:35:55 -04:00
|
|
|
ifeq ($(uname_S),Linux)
|
2021-07-13 22:10:58 -04:00
|
|
|
DEFINES += -DPOSIX -DUSG
|
2020-10-30 02:12:45 -04:00
|
|
|
else ifeq ($(uname_S),CYGWIN)
|
2021-07-13 22:10:58 -04:00
|
|
|
DEFINES += -DCYGWIN -DSYSV
|
2020-10-30 02:12:45 -04:00
|
|
|
else ifeq ($(uname_S),MSYS)
|
2021-07-13 22:10:58 -04:00
|
|
|
DEFINES += -DCYGWIN -DSYSV
|
2020-10-30 02:12:45 -04:00
|
|
|
else ifeq ($(uname_S),NetBSD)
|
2021-07-13 22:10:58 -04:00
|
|
|
DEFINES += -DPOSIX -DBSD=1
|
2020-10-30 02:12:45 -04:00
|
|
|
else
|
|
|
|
$(error $(uname_S) needs configuration)
|
2020-06-16 02:09:44 -04:00
|
|
|
endif
|
2020-10-30 02:12:45 -04:00
|
|
|
|
|
|
|
#ifeq ($(uname_S),FreeBSD)
|
|
|
|
# DEFINES=-DAUTOCONF -DPOSIX -DSYSV -D_FREEBSD_C_SOURCE -D_BSD_SOURCE -D_SVID_SOURCE -D_XOPEN_SOURCE=600
|
|
|
|
#endif
|
|
|
|
#ifeq ($(uname_S),Darwin)
|
|
|
|
# DEFINES=-DAUTOCONF -DPOSIX -DSYSV -D_DARWIN_C_SOURCE -D_BSD_SOURCE -D_SVID_SOURCE -D_XOPEN_SOURCE=600
|
|
|
|
#endif
|
|
|
|
|
2005-05-31 11:50:56 -04:00
|
|
|
#LIBS=-ltermcap # BSD
|
2014-06-18 02:59:40 -04:00
|
|
|
#LIBS=-lcurses # SYSV
|
2005-05-31 11:50:56 -04:00
|
|
|
#LIBS=-ltermlib
|
2009-07-15 11:42:47 -04:00
|
|
|
#LIBS=-L/usr/lib/termcap -ltermcap
|
2005-05-31 11:50:56 -04:00
|
|
|
LFLAGS=-hbx
|
|
|
|
BINDIR=/usr/bin
|
|
|
|
LIBDIR=/usr/lib
|
|
|
|
|
2021-07-13 22:10:58 -04:00
|
|
|
SRCS = $(sort $(wildcard *.c))
|
|
|
|
OBJS = $(SRCS:.c=.o)
|
|
|
|
|
|
|
|
$(PROGRAM): $(OBJS)
|
2010-02-26 13:48:56 -05:00
|
|
|
$(E) " LINK " $@
|
2021-07-13 22:10:58 -04:00
|
|
|
$(Q) $(CC) $(LDFLAGS) -o $@ $(OBJS) $(LIBS)
|
2005-05-31 11:50:56 -04:00
|
|
|
|
2005-09-30 18:28:37 -04:00
|
|
|
SPARSE=sparse
|
2006-11-19 14:28:19 -05:00
|
|
|
SPARSE_FLAGS=-D__LITTLE_ENDIAN__ -D__x86_64__ -D__linux__ -D__unix__
|
2005-09-30 18:28:37 -04:00
|
|
|
|
|
|
|
sparse:
|
2021-07-13 22:10:58 -04:00
|
|
|
$(SPARSE) $(SPARSE_FLAGS) $(DEFINES) $(SRCS)
|
2005-09-30 18:28:37 -04:00
|
|
|
|
2005-05-31 11:50:56 -04:00
|
|
|
clean:
|
2010-02-26 13:48:56 -05:00
|
|
|
$(E) " CLEAN"
|
2021-07-13 22:10:58 -04:00
|
|
|
$(Q) rm -f $(PROGRAM) core lintout makeout tags *.o
|
2005-05-31 11:50:56 -04:00
|
|
|
|
2010-08-29 06:08:13 -04:00
|
|
|
install: $(PROGRAM)
|
|
|
|
strip $(PROGRAM)
|
2013-05-16 21:21:59 -04:00
|
|
|
cp $(PROGRAM) ${BINDIR}
|
2005-05-31 11:50:56 -04:00
|
|
|
cp emacs.hlp ${LIBDIR}
|
|
|
|
cp emacs.rc ${LIBDIR}/.emacsrc
|
2013-05-16 21:21:59 -04:00
|
|
|
chmod 755 ${BINDIR}/$(PROGRAM)
|
2005-05-31 11:50:56 -04:00
|
|
|
chmod 644 ${LIBDIR}/emacs.hlp ${LIBDIR}/.emacsrc
|
|
|
|
|
|
|
|
lint: ${SRC}
|
|
|
|
@rm -f lintout
|
|
|
|
lint ${LFLAGS} ${SRC} >lintout
|
|
|
|
cat lintout
|
|
|
|
|
2015-02-16 00:41:59 -05:00
|
|
|
splint:
|
2021-07-13 22:10:58 -04:00
|
|
|
splint -weak $(DEFINES) $(SRCS) -booltype boolean -booltrue TRUE -boolfalse FALSE +posixlib +matchanyintegral
|
2015-02-16 00:41:59 -05:00
|
|
|
|
2005-05-31 11:50:56 -04:00
|
|
|
errs:
|
|
|
|
@rm -f makeout
|
2019-08-06 22:05:25 -04:00
|
|
|
make $(PROGRAM) >makeout 2>&1
|
2005-05-31 11:50:56 -04:00
|
|
|
|
|
|
|
tags: ${SRC}
|
|
|
|
@rm -f tags
|
|
|
|
ctags ${SRC}
|
|
|
|
|
|
|
|
.c.o:
|
2010-02-26 13:48:56 -05:00
|
|
|
$(E) " CC " $@
|
|
|
|
$(Q) ${CC} ${CFLAGS} ${DEFINES} -c $*.c
|
2005-05-31 11:50:56 -04:00
|
|
|
|
2021-07-13 22:10:58 -04:00
|
|
|
depend.mak: $(SRCS)
|
|
|
|
$(E) " DEPEND"
|
|
|
|
$(Q) $(CC) $(DEFINES) -MM $+ > depend.mak
|
|
|
|
|
|
|
|
include depend.mak
|
|
|
|
|
|
|
|
# end of Makefile
|