diff options
author | Preston Pan <preston@nullring.xyz> | 2024-01-09 18:39:49 -0800 |
---|---|---|
committer | Preston Pan <preston@nullring.xyz> | 2024-01-09 18:39:49 -0800 |
commit | ac6004730fa54a756d1627a4e8450cd32df86f75 (patch) | |
tree | 8cb4d59438a1252fa069788b2ffb78b2a1bbad3e /Makefile | |
parent | 6ccf0572469dfc8cd8fa7b8537b2ac6c265d2df6 (diff) |
reorganize directory structure
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 31 |
1 files changed, 21 insertions, 10 deletions
@@ -1,15 +1,26 @@ -## -# Project Title -# -# @file -# @version 0.1 +CC := gcc +SRCDIR := src +BUILDDIR := build +TARGET := bin/stem +SRCEXT := c +SOURCES := $(shell find $(SRCDIR) -type f -name *.$(SRCEXT)) +OBJECTS := $(patsubst $(SRCDIR)/%,$(BUILDDIR)/%,$(SOURCES:.$(SRCEXT)=.o)) +CFLAGS := +LIB := -L lib -lm +INC := -I include -all: - cc *.c -o stem -lm +$(TARGET): $(OBJECTS) + @echo " Linking..." + @echo " $(CC) $^ -o $(TARGET) $(LIB)"; $(CC) $^ -o $(TARGET) $(LIB) -O3 + +$(BUILDDIR)/%.o: $(SRCDIR)/%.$(SRCEXT) + @echo " Building..." + @mkdir -p $(BUILDDIR) + @echo " $(CC) $(CFLAGS) $(INC) -c -o $@ $<"; $(CC) $(CFLAGS) $(INC) -c -o $@ $< -save-temps -O3 clean: - rm stem + @echo " Cleaning..."; + @echo " $(RM) -r $(BUILDDIR) $(TARGET)"; $(RM) -r $(BUILDDIR) $(TARGET) install: - cp stem /usr/local/bin/ -# end + cp $(TARGET) /usr/local/bin/ |