From 2c2a1036762415e43d215cd2a31e664ee3e0277c Mon Sep 17 00:00:00 2001
From: mpc <mpc>
Date: Mon, 9 Aug 2004 09:39:20 +0000
Subject: [PATCH] Some more Makefile updates

---
 apps/sam/c/Makefile.common            |  3 +--
 apps/sam/c/examples/Makefile          | 34 ---------------------------
 apps/sam/c/examples/Makefile.common   | 20 ++++++++++++++++
 apps/sam/c/examples/Makefile.mingw    | 16 +++----------
 apps/sam/c/examples/Makefile.posix    | 24 +++++++++++++++++++
 apps/sam/c/examples/i2p-ping/Makefile |  7 +++---
 6 files changed, 52 insertions(+), 52 deletions(-)
 delete mode 100644 apps/sam/c/examples/Makefile
 create mode 100644 apps/sam/c/examples/Makefile.common
 create mode 100644 apps/sam/c/examples/Makefile.posix

diff --git a/apps/sam/c/Makefile.common b/apps/sam/c/Makefile.common
index 4668d1d376..a8b2a1a725 100644
--- a/apps/sam/c/Makefile.common
+++ b/apps/sam/c/Makefile.common
@@ -2,7 +2,6 @@
 # This Makefile contains instructions common to all platforms
 #
 
-
 #
 # Build rules
 #
@@ -23,4 +22,4 @@ libsam: $(OBJS)
 #
 
 clean:
-	-$(RM) -f $(LIBDIR)/libsam.a $(OBJDIR)/* .depend
+	-$(RM) -f $(LIBDIR)/libsam.a $(OBJDIR)/*.o .depend
diff --git a/apps/sam/c/examples/Makefile b/apps/sam/c/examples/Makefile
deleted file mode 100644
index f1546f2ecb..0000000000
--- a/apps/sam/c/examples/Makefile
+++ /dev/null
@@ -1,34 +0,0 @@
-#
-# This Makefile is compatible with GNU Make
-#
-
-#
-# Programs
-#
-
-CC = gcc
-
-#
-# Flags
-#
-
-CFLAGS = -g -O2 -pipe -std=c99 -Wall
-CFLAGS += -I../inc -L../lib
-LIBS = -lsam
-
-#
-# Build rules
-#
-
-all: warhammer-dgram
-
-warhammer-dgram: warhammer-dgram.c
-	$(CC) $(CFLAGS) -o warhammer-dgram.o -c warhammer-dgram.c
-	$(CC) $(CFLAGS) -o warhammer-dgram warhammer-dgram.o $(LIBS)
-
-#
-# Cleanup rules
-#
-
-clean:
-	-rm -f *.o *.exe warhammer-dgram
diff --git a/apps/sam/c/examples/Makefile.common b/apps/sam/c/examples/Makefile.common
new file mode 100644
index 0000000000..98c7f26db8
--- /dev/null
+++ b/apps/sam/c/examples/Makefile.common
@@ -0,0 +1,20 @@
+#
+# This Makefile contains instructions common to all platforms
+#
+
+#
+# Build rules
+#
+
+all: clean warhammer-dgram
+
+warhammer-dgram: warhammer-dgram.c
+	$(CC) $(CFLAGS) -o warhammer-dgram.o -c warhammer-dgram.c
+	$(CC) $(CFLAGS) -o warhammer-dgram warhammer-dgram.o $(LIBS)
+
+#
+# Cleanup rules
+#
+
+clean:
+	-$(RM) -f warhammer-dgram *.exe *.o
diff --git a/apps/sam/c/examples/Makefile.mingw b/apps/sam/c/examples/Makefile.mingw
index 6bbc6cdcb8..ddf9f10c3e 100644
--- a/apps/sam/c/examples/Makefile.mingw
+++ b/apps/sam/c/examples/Makefile.mingw
@@ -7,6 +7,7 @@
 #
 
 CC = C:\Dev-Cpp\bin\gcc
+RM = C:\Dev-Cpp\bin\rm
 
 #
 # Flags
@@ -18,18 +19,7 @@ CFLAGS += -I../inc -L../lib
 LIBS = -lsam -lwsock32
 
 #
-# Build rules
+# Include the make instructions common to all platforms
 #
 
-all: warhammer-dgram
-
-warhammer-dgram:
-	$(CC) $(CFLAGS) -o warhammer-dgram.o -c warhammer-dgram.c
-	$(CC) $(CFLAGS) -o warhammer-dgram warhammer-dgram.o $(LIBS)
-
-#
-# Cleanup rules
-#
-
-clean:
-	-rm -f *.o *.exe warhammer-dgram
+include Makefile.common
diff --git a/apps/sam/c/examples/Makefile.posix b/apps/sam/c/examples/Makefile.posix
new file mode 100644
index 0000000000..5f153e745c
--- /dev/null
+++ b/apps/sam/c/examples/Makefile.posix
@@ -0,0 +1,24 @@
+#
+# This Makefile is compatible with GNU Make and should work on POSIX systems
+#
+
+#
+# Programs
+#
+
+CC = gcc
+RM = rm
+
+#
+# Flags
+#
+
+CFLAGS = -g -O2 -pipe -std=c99 -Wall
+CFLAGS += -I../inc -L../lib
+LIBS = -lsam
+
+#
+# Include the make instructions common to all platforms
+#
+
+include Makefile.common
diff --git a/apps/sam/c/examples/i2p-ping/Makefile b/apps/sam/c/examples/i2p-ping/Makefile
index ff4be71a96..b1ce9ddb96 100644
--- a/apps/sam/c/examples/i2p-ping/Makefile
+++ b/apps/sam/c/examples/i2p-ping/Makefile
@@ -1,5 +1,5 @@
 #
-# This Makefile is compatible with GNU Make
+# This Makefile is compatible with GNU Make and should work on POSIX systems
 #
 
 #
@@ -8,6 +8,7 @@
 
 CC = gcc
 INSTALL = install
+RM = rm
 
 #
 # Flags
@@ -21,7 +22,7 @@ LIBS = -lsam
 # Build rules
 #
 
-all: i2p-ping
+all: clean i2p-ping
 
 i2p-ping: i2p-ping.c
 	$(CC) $(CFLAGS) -o i2p-ping.o -c i2p-ping.c
@@ -35,4 +36,4 @@ install: i2p-ping
 #
 
 clean:
-	-rm -f *.o *.exe i2p-ping
+	-$(RM) -f i2p-ping *.o
-- 
GitLab