aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksey Veresov <aleksey@veresov.pro>2020-03-21 00:14:53 +0300
committerAleksey Veresov <aleksey@veresov.pro>2020-03-21 00:14:53 +0300
commit339ae11aae1d23edd5bed4ab9c6b1a72dd998a66 (patch)
treef377eae9f47b5859755d2977fcc7f7c1f7c87486
parent8acbd33a82d2c13e70eb17447bc6abfd86cf9512 (diff)
downloadmagi-339ae11aae1d23edd5bed4ab9c6b1a72dd998a66.tar
magi-339ae11aae1d23edd5bed4ab9c6b1a72dd998a66.tar.xz
magi-339ae11aae1d23edd5bed4ab9c6b1a72dd998a66.zip
[magi]
-rw-r--r--Makefile34
1 files changed, 10 insertions, 24 deletions
diff --git a/Makefile b/Makefile
index fc0cdac..d8abf44 100644
--- a/Makefile
+++ b/Makefile
@@ -50,49 +50,35 @@ SRCFLAGS = $(CFLAGS) -I$(INCLUDE)/magi
EXAFLAGS = $(CFLAGS) -I$(INCLUDE)
LFLAGS = -static -L$(BUILD) -lmagi
-# Build directories:
-BUILDIRS = $(BUILD) $(BUILD)/$(SRCDIR) $(BUILD)/$(EXADIR)
-
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# Targets
-.PHONY: default examples clean clean-nontarget clean-deps clean-all
+.PHONY: default examples clean
-default: $(TARGET)
+default: $(BUILD)/$(SRCDIR) $(TARGET)
-examples: $(EXAMPLES)
+examples: default $(BUILD)/$(EXADIR) $(EXAMPLES)
-clean: clean-nontarget
- rm -f $(TARGET)
-clean-nontarget: clean-deps
- rm -f $(OBJ) $(EXAMPLES)
-clean-deps:
- rm -f $(DEPS)
-clean-all:
- rm -rf $(BUILD)
+clean:
+ rm -f $(TARGET) $(OBJ) $(EXAMPLES) $(DEPS)
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# Compilation
-# No product should be in case of cleaning:
-ifneq (clean,$(MAKECMDGOAL))
+# Including dependency files:
+-include $(DEPS)
# Packing object files into library:
$(TARGET): $(OBJ)
ar -rcs $@ $^
# Compile object files from corresponding source:
-$(BUILD)/%.o: %.c $(BUILDIRS)
+$(BUILD)/%.o: %.c
$(CC) $(SRCFLAGS) -c $< -o $@
# Compile executables from corresponding sources and library:
-$(BUILD)/%: %.c $(TARGET) $(BUILDIRS)
+$(BUILD)/%: %.c $(TARGET)
$(CC) $(EXAFLAGS) $< $(LFLAGS) -o $@
-$(BUILDIRS):
+$(BUILD)/$(SRCDIR) $(BUILD)/$(EXADIR):
mkdir -p $@
-
-
-# Including dependency files:
--include $(DEPS)
-endif