2021-08-06 22:28:20 -04:00
|
|
|
# Makefile -- µEMACS
|
|
|
|
# Copyright © 2013-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
|
2021-08-06 22:28:20 -04:00
|
|
|
DEFINES=-DAUTOCONF -DPROGRAM=$(PROGRAM) # -DNDEBUG
|
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
|
|
|
|
2005-05-31 11:50:56 -04:00
|
|
|
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
|
|
|
|
|
|
|
clean:
|
2010-02-26 13:48:56 -05:00
|
|
|
$(E) " CLEAN"
|
2021-08-06 22:28:20 -04:00
|
|
|
$(Q) rm -f $(PROGRAM) depend.mak *.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
|
|
|
|
|
|
|
|
.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-16 00:24:13 -04:00
|
|
|
depend.mak: $(wildcard *.h)
|
2021-07-13 22:10:58 -04:00
|
|
|
$(E) " DEPEND"
|
2021-07-16 00:24:13 -04:00
|
|
|
$(Q) $(CC) $(DEFINES) -MM $(SRCS) > depend.mak
|
2021-07-13 22:10:58 -04:00
|
|
|
|
|
|
|
include depend.mak
|
|
|
|
|
|
|
|
# end of Makefile
|