-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile-asm
More file actions
58 lines (43 loc) · 1.4 KB
/
Makefile-asm
File metadata and controls
58 lines (43 loc) · 1.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
ASM := as
LD := ld
#The Target Binary Program
TARGET := task5
#The Directories, Source, Includes, Objects, Binary and Resources
BUILDDIR := obj
TARGETDIR := bin
RESDIR := res
SRCEXT := S
DEPEXT := d
OBJEXT := o
LSTEXT := lst
#Flags, Libraries and Includes
ASMFLAGS := --32 -gstabs+
LDFLAGS := -melf_i386
#------------------------------------------------------------
#Do not touch anything below this line
#------------------------------------------------------------
SOURCES := $(shell find . -type f -name "*.$(SRCEXT)")
vpath %$(SRCEXT) := $(dir $(SOURCES))
OBJECTS := $(addprefix $(BUILDDIR)/, $(notdir $(SOURCES:.$(SRCEXT)=.$(OBJEXT))))
#Defauilt Make
all: resources $(TARGET)
#Remake
remake: cleaner all
#Copy Resources from Resources Directory to Target Directory
resources: directories
$(shell cp $(RESDIR)/* $(TARGETDIR)/)
#Make the Directories
directories:
$(shell mkdir -p $(TARGETDIR))
$(shell mkdir -p $(BUILDDIR))
#Clean only Objecst
clean:
$(shell rm -rf $(BUILDDIR))
#Full Clean, Objects and Binaries
cleaner: clean
$(shell rm -rf $(TARGETDIR))
#Link
$(TARGET): $(OBJECTS)
$(LD) $(LDFLAGS) -o $(TARGETDIR)/$(TARGET) $^
$(BUILDDIR)/%.$(OBJEXT): %.$(SRCEXT)
$(ASM) -ahlsm=$(addprefix $(TARGETDIR)/, $(notdir $(<:.$(SRCEXT)=.$(LSTEXT)))) $(ASMFLAGS) -o $@ $<