diff options
| author | Ada Christine <adachristine18@gmail.com> | 2021-03-17 12:38:27 +0000 |
|---|---|---|
| committer | Ada Christine <adachristine18@gmail.com> | 2021-03-17 12:38:27 +0000 |
| commit | 53ca88735db910c746d6190cca39fcd70d66b650 (patch) | |
| tree | ab0da3a88009f0ddf0e6e2634d0962c364393203 /rules.mk | |
initial commit
Diffstat (limited to 'rules.mk')
| -rw-r--r-- | rules.mk | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/rules.mk b/rules.mk new file mode 100644 index 0000000..be255ba --- /dev/null +++ b/rules.mk @@ -0,0 +1,41 @@ +# vim: ft=make:nowrap:ts=4:sw=4 +OBJCOPY.info = $(info $$(OBJCOPY) $< $@) + +LINK.os = $(LD) $(LDFLAGS) $(LIBDIRS) -T $(LDSCRIPT) $(filter %.o, $^) $(LOADLIBES) -o $@ + +LINK.info = $(info $$(LD) $@) + +COMPILE.c = $(CC) $(CPPFLAGS) $(CFLAGS) -c $< -o $@ + +COMPILE.S = $(CC) $(CPPFLAGS) $(ASFLAGS) -c $< -o $@ + +COMPILE.cpp = $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $< -o $@ + +COMPILE.info = $(info $$(CC) $@) + +%.os: + $(LINK.info) + @$(LINK.os) + +%.debug.os: %.os + $(OBJCOPY) --only-keep-debug $< $@ + $(OBJCOPY) --strip-debug $< + +%.o: %.c + $(COMPILE.info) + $(COMPILE.c) -MMD -MP + +%.o: %.cpp + $(COMPILE.info) + $(COMPILE.cpp) -MMD -MP + +clean: + $(info $$(RM) $(CLEANLIST)) + -@$(RM) $(CLEANLIST) + +distclean: clean + $(info $$(RM) $(DCLEANLIST)) + -@$(RM) $(DCLEANLIST) + +.PHONY: clean distclean all + |
