commit 325e4254910db7a99415af2283478300632c245a
parent 49fa8cec5a252cbf835af351f86175ad0a7d2e0a
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Wed, 23 Oct 2024 15:12:29 +0200
build/cmd: Simplify the Makefile
Just change the name of the files and use default rules.
Diffstat:
10 files changed, 8 insertions(+), 34 deletions(-)
diff --git a/scripts/rules.mk b/scripts/rules.mk
@@ -46,6 +46,7 @@ PROJ_CPPFLAGS =\
$(MORE_CPPFLAGS)
PROJ_CFLAGS =\
+ $(PROJ_CPPFLAGS)\
$(MORE_CFLAGS)\
$(HOST_CFLAGS)\
$(SYS_CFLAGS)\
@@ -111,7 +112,7 @@ $(DIRS) DUMMY : FORCE
.ms .1 .2 .3 .4 .5 .6 .7\
.c:
- $(CC) $(PROJ_CPPFLAGS) $(PROJ_CFLAGS) -o $@ $<
+ $(CC) $(PROJ_CFLAGS) $(PROJ_LDFLAGS) -o $@ $< $(PROJ_LDLIBS)
.s.o:
$(AS) $(PROJ_ASFLAGS) $< -o $@
@@ -120,10 +121,10 @@ $(DIRS) DUMMY : FORCE
$(AS) $(PROJ_ASFLAGS) $< -o $@
.c.o:
- $(CC) $(PROJ_CPPFLAGS) $(PROJ_CFLAGS) -o $@ -c $<
+ $(CC) $(PROJ_CFLAGS) -o $@ -c $<
.c.s:
- $(CC) $(PROJ_CPPFLAGS) $(PROJ_CFLAGS) -S -o $@ $<
+ $(CC) $(PROJ_CFLAGS) -S -o $@ $<
.c.i:
$(CPP) $(PROJ_CPPFLAGS) -o $@ $<
diff --git a/src/cmd/Makefile b/src/cmd/Makefile
@@ -19,38 +19,11 @@ TARGET =\
scc-objcopy\
scc-addr2line\
-all: $(TARGET) $(DIRS)
-
-scc-nm: nm.o $(LIBMACH) $(LIBSCC)
- $(CC) $(PROJ_LDFLAGS) nm.o -lmach -lscc $(PROJ_LDLIBS) -o $@
- cp $@ $(BINDIR)
-
-scc-strip: strip.o $(LIBMACH) $(LIBSCC)
- $(CC) $(PROJ_LDFLAGS) strip.o -lmach -lscc $(PROJ_LDLIBS) -o $@
- cp $@ $(BINDIR)
-
-scc-size: size.o $(LIBMACH) $(LIBSCC)
- $(CC) $(PROJ_LDFLAGS) size.o -lmach -lscc $(PROJ_LDLIBS) -o $@
- cp $@ $(BINDIR)
+MORE_LDLIBS = -lmach -lscc
-scc-ranlib: ranlib.o $(LIBMACH) $(LIBSCC)
- $(CC) $(PROJ_LDFLAGS) ranlib.o -lmach -lscc $(PROJ_LDLIBS) -o $@
- cp $@ $(BINDIR)
-
-scc-objdump: objdump.o $(LIBMACH)
- $(CC) $(PROJ_LDFLAGS) objdump.o -lmach $(PROJ_LDLIBS) -o $@
- cp $@ $(BINDIR)
-
-scc-objcopy: objcopy.o $(LIBMACH)
- $(CC) $(PROJ_LDFLAGS) objcopy.o -lmach $(PROJ_LDLIBS) -o $@
- cp $@ $(BINDIR)
-
-scc-addr2line: addr2line.o $(LIBMACH) $(LIBSCC)
- $(CC) $(PROJ_LDFLAGS) addr2line.o -lmach -lscc $(PROJ_LDLIBS) -o $@
- cp $@ $(BINDIR)
+all: $(TARGET) $(DIRS)
+ @cp $(TARGET) $(BINDIR)
-scc-ar: ar.o $(LIBSCC)
- $(CC) $(PROJ_LDFLAGS) ar.o $(PROJ_LDLIBS) -lscc -o $@
- cp $@ $(BINDIR)
+$(TARGET): $(LIBMACH) $(LIBSCC)
include deps.mk
diff --git a/src/cmd/addr2line.c b/src/cmd/scc-addr2line.c
diff --git a/src/cmd/ar.c b/src/cmd/scc-ar.c
diff --git a/src/cmd/nm.c b/src/cmd/scc-nm.c
diff --git a/src/cmd/objcopy.c b/src/cmd/scc-objcopy.c
diff --git a/src/cmd/objdump.c b/src/cmd/scc-objdump.c
diff --git a/src/cmd/ranlib.c b/src/cmd/scc-ranlib.c
diff --git a/src/cmd/size.c b/src/cmd/scc-size.c
diff --git a/src/cmd/strip.c b/src/cmd/scc-strip.c