aboutsummaryrefslogtreecommitdiff
path: root/rules.mk
diff options
context:
space:
mode:
Diffstat (limited to 'rules.mk')
-rw-r--r--rules.mk44
1 files changed, 44 insertions, 0 deletions
diff --git a/rules.mk b/rules.mk
new file mode 100644
index 0000000..cc495d6
--- /dev/null
+++ b/rules.mk
@@ -0,0 +1,44 @@
+# Standard housekeeping
+.PHONY: all clean install
+.SUFFIXES:
+.SUFFIXES: .c .o
+
+all: targets
+
+# Targets & array of sources & intermediates
+SRCS :=
+OBJS :=
+DEPS :=
+
+LIBS :=
+BINS :=
+
+# Iterate through directory tree
+DIR := src
+include $(DIR)/rules.mk
+# ... (repeat)
+
+# Generic rules
+%.a: %.o
+ $(ARCHIVE)
+
+$(OBJ_DIR)/%.o: $(SRC_DIR)/%.c
+ $(COMPILE)
+
+%: %.o
+ $(LINK)
+
+$(OBJ_DIR)/%: $(SRC_DIR)/%.c
+ $(COMPLNK)
+
+.PHONY: targets
+targets: $(LIBS) $(BINS)
+
+.PHONY: clean
+clean:
+ rm $(OBJS) $(DEPS)
+ rm $(LIBS) $(BINS)
+
+.PHONY: install
+install: targets
+ echo "TODO"