Skip to content

Instantly share code, notes, and snippets.

@dev001hajipro
Created August 5, 2018 06:08
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 dev001hajipro/87e7c09580c27b1916398bd3298a6164 to your computer and use it in GitHub Desktop.
Save dev001hajipro/87e7c09580c27b1916398bd3298a6164 to your computer and use it in GitHub Desktop.
複数ターゲットに対応したNASM32bitのMakefile
AS=nasm
#ASFLAGS=-f elf64 -g
ASFLAGS=-f elf -g
#LDFLAGS=
LDFLAGS=-m elf_i386
LD=ld
SOURCES=$(wildcard *.asm)
OBJECTS=$(SOURCES:.asm=.o)
TARGETS=$(SOURCES:.asm=)
all : $(TARGETS)
$(TARGETS):
#暗黙ルールの上書き
% : %.o
$(LD) $(LDFLAGS) -o $@ $<
#暗黙ルールの上書き
%.o : %.asm
$(AS) $(ASFLAGS) $<
clean:
rm -rf *.o *.lst $(TARGETS)
debug:
echo $(SOURCES)
echo $(OBJECTS)
echo $(TARGETS)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment