1
0
mirror of https://github.com/rfivet/uemacs.git synced 2024-06-26 11:45:28 +00:00

Reviewed dependencies generation.

This commit is contained in:
Renaud 2022-02-05 10:56:12 +08:00
parent 2befa53c3a
commit f2c53b5b1f

View File

@ -1,5 +1,5 @@
# Makefile -- µEMACS # Makefile -- µEMACS
# Copyright © 2013-2021 Renaud Fivet # Copyright © 2013-2022 Renaud Fivet
# Make the build silent by default # Make the build silent by default
V = V =
@ -15,7 +15,7 @@ export E Q
PROGRAM=ue PROGRAM=ue
CC=gcc CC=cc
WARNINGS=-pedantic -Wall -Wextra -Wstrict-prototypes -Wno-unused-parameter WARNINGS=-pedantic -Wall -Wextra -Wstrict-prototypes -Wno-unused-parameter
CFLAGS=-O2 $(WARNINGS) CFLAGS=-O2 $(WARNINGS)
LDFLAGS=-s LDFLAGS=-s
@ -26,15 +26,14 @@ BINDIR=/usr/bin
LIBDIR=/usr/lib LIBDIR=/usr/lib
SRCS = $(sort $(wildcard *.c)) SRCS = $(sort $(wildcard *.c))
OBJS = $(SRCS:.c=.o)
$(PROGRAM): $(OBJS) $(PROGRAM): $(SRCS:.c=.o)
$(E) " LINK " $@ $(E) " LINK " $@
$(Q) $(CC) $(LDFLAGS) -o $@ $(OBJS) $(LIBS) $(Q) $(CC) $(LDFLAGS) -o $@ $+ $(LIBS)
clean: clean:
$(E) " CLEAN" $(E) " CLEAN"
$(Q) rm -f $(PROGRAM) depend.mak *.o $(Q) rm -f $(PROGRAM) *.dep *.o
install: $(PROGRAM) install: $(PROGRAM)
strip $(PROGRAM) strip $(PROGRAM)
@ -45,13 +44,15 @@ install: $(PROGRAM)
chmod 644 ${LIBDIR}/emacs.hlp ${LIBDIR}/.emacsrc chmod 644 ${LIBDIR}/emacs.hlp ${LIBDIR}/.emacsrc
.c.o: .c.o:
$(E) " CC " $@ $(E) " CC " $@
$(Q) ${CC} ${CFLAGS} ${DEFINES} -c $*.c $(Q) $(CC) $(CFLAGS) $(DEFINES) -c $*.c
depend.mak: $(wildcard *.h) %.dep: %.c
$(E) " DEPEND" $(E) " DEPEND" $@
$(Q) $(CC) $(DEFINES) -MM $(SRCS) > depend.mak $(Q) $(CC) $(DEFINES) -MM $< > $@
include depend.mak ifneq ($(MAKECMDGOALS),clean)
include $(SRCS:.c=.dep)
endif
# end of Makefile # end of Makefile