Skip to content

Commit

Permalink
Reviewed dependencies generation.
Browse files Browse the repository at this point in the history
  • Loading branch information
rfivet committed Feb 5, 2022
1 parent 2befa53 commit f2c53b5
Showing 1 changed file with 14 additions and 13 deletions.
27 changes: 14 additions & 13 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Makefile -- µEMACS
# Copyright © 2013-2021 Renaud Fivet
# Copyright © 2013-2022 Renaud Fivet

# Make the build silent by default
V =
Expand All @@ -15,7 +15,7 @@ export E Q

PROGRAM=ue

CC=gcc
CC=cc
WARNINGS=-pedantic -Wall -Wextra -Wstrict-prototypes -Wno-unused-parameter
CFLAGS=-O2 $(WARNINGS)
LDFLAGS=-s
Expand All @@ -26,15 +26,14 @@ BINDIR=/usr/bin
LIBDIR=/usr/lib

SRCS = $(sort $(wildcard *.c))
OBJS = $(SRCS:.c=.o)

$(PROGRAM): $(OBJS)
$(E) " LINK " $@
$(Q) $(CC) $(LDFLAGS) -o $@ $(OBJS) $(LIBS)
$(PROGRAM): $(SRCS:.c=.o)
$(E) " LINK " $@
$(Q) $(CC) $(LDFLAGS) -o $@ $+ $(LIBS)

clean:
$(E) " CLEAN"
$(Q) rm -f $(PROGRAM) depend.mak *.o
$(Q) rm -f $(PROGRAM) *.dep *.o

install: $(PROGRAM)
strip $(PROGRAM)
Expand All @@ -45,13 +44,15 @@ install: $(PROGRAM)
chmod 644 ${LIBDIR}/emacs.hlp ${LIBDIR}/.emacsrc

.c.o:
$(E) " CC " $@
$(Q) ${CC} ${CFLAGS} ${DEFINES} -c $*.c
$(E) " CC " $@
$(Q) $(CC) $(CFLAGS) $(DEFINES) -c $*.c

depend.mak: $(wildcard *.h)
$(E) " DEPEND"
$(Q) $(CC) $(DEFINES) -MM $(SRCS) > depend.mak
%.dep: %.c
$(E) " DEPEND" $@
$(Q) $(CC) $(DEFINES) -MM $< > $@

include depend.mak
ifneq ($(MAKECMDGOALS),clean)
include $(SRCS:.c=.dep)
endif

# end of Makefile

0 comments on commit f2c53b5

Please sign in to comment.