Created
August 5, 2018 06:08
-
-
Save dev001hajipro/87e7c09580c27b1916398bd3298a6164 to your computer and use it in GitHub Desktop.
複数ターゲットに対応したNASM32bitのMakefile
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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