Skip to content

Instantly share code, notes, and snippets.

@nickylimjj
Last active December 18, 2019 00:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nickylimjj/7c140d3d5b0d3284226c4ee12a1c322a to your computer and use it in GitHub Desktop.
Save nickylimjj/7c140d3d5b0d3284226c4ee12a1c322a to your computer and use it in GitHub Desktop.
Sample makefile from .s -> bin
AS := as
LD := ld
SRC := $(wildcard *.s)
OBJ := $(patsubst %.s, %.o, $(SRC))
BIN := $(patsubst %.o, %, $(OBJ))
.PHONY: all
all: $(BIN)
$(BIN): $(OBJ)
@echo linking...
$(LD) -o $@ $<
$(OBJ) : $(SRC)
@echo assembling...
$(AS) -o $@ $<
.PHONY: clean
clean:
rm $(BIN) $(OBJ)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment