1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
|
From: YOKOTA Hiroshi <yokota.hgml@gmail.com>
Date: Mon, 23 Dec 2024 22:12:09 +0900
Subject: Tweak makefile
Forwarded: not-needed
* Sort input files to deterministic build
* Use Debian specific build flags
---
makefile | 26 ++++++++++++++------------
1 file changed, 14 insertions(+), 12 deletions(-)
diff --git a/makefile b/makefile
index fd5fe84..5971656 100644
--- a/makefile
+++ b/makefile
@@ -1,22 +1,24 @@
+# -*- mode: makefile-gmake -*-
#
# Makefile for Asmc
#
-.PHONY: asmc
+.PHONY: all clean distclean
-all: asmc clean
+SRCS = $(sort $(wildcard src/*.s))
+OBJS = $(SRCS:.s=.o)
+TARGET = asmc
-asmc:
- gcc -c src/*.s && gcc -Wl,-pie,-z,now,-z,noexecstack -s -o $@ *.o
+all: $(TARGET)
-clean:
- rm -f *.o
+%.o: %.s
+ $(CC) $(CPPFLAGS) $(CFLAGS) $(ASFLAGS) -c -o $@ $<
-distclean:
- rm -f *.o asmc
+$(TARGET): $(OBJS)
+ $(CC) $(LDFLAGS) -Wl,-pie,-z,now,-z,noexecstack -o $@ $^
-install:
- sudo install ./asmc /usr/bin
+clean:
+ $(RM) $(OBJS)
-uninstall:
- sudo rm -f /usr/bin/asmc
+distclean: clean
+ $(RM) $(TARGET)
|