aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
blob: 67a99ccce9c93e6b40a39cfcc4f0afc6178ca004 (plain)
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# ========================
# =====    ===============
# ======  ================
# ======  ================
# ======  ====   ====   ==
# ======  ===     ==  =  =
# ======  ===  =  ==     =
# =  ===  ===  =  ==  ====
# =  ===  ===  =  ==  =  =
# ==     =====   ====   ==
# ========================
#
# bsdsetsid: Makefile
# 2020-11-13 13:22
# Joe
#
# BSD Makefile

default: all

SRCS_DIR	:= src/
PREFIX		:= /usr/local/
DESTDIR		:=

SRCS		:= ${SRCS_DIR}c_bsdsetsid.S
SRCS		+= ${SRCS_DIR}u_print.S
SRCS		+= ${SRCS_DIR}u_strlen.S

OBJS		 = ${SRCS:.S=.o}

AS			 = yasm
ASFLAGS		 = -felf64
ASFLAGS		+= -pgas

CC			 = cc

LD			:= ld
LDFLAGS		:= -melf_x86_64
LDFLAGS		+= --eh-frame-hdr
LDFLAGS		+= -dynamic-linker
LDFLAGS		+= /libexec/ld-elf.so.1
LDFLAGS		+= --hash-style=both
LDFLAGS		+= --enable-new-dtags 
LDPOST		:= /usr/lib/crt1.o
LDPOST		+= /usr/lib/crti.o
LDPOST		+= /usr/lib/crtbegin.o
LDPOST		+= -L/usr/lib
LDPOST		+= -lgcc
LDPOST		+= --as-needed
LDPOST		+= -lgcc_s
LDPOST		+= --no-as-needed
LDPOST		+= -lc
LDPOST		+= -lgcc
LDPOST		+= --as-needed
LDPOST		+= -lgcc_s
LDPOST		+= --no-as-needed
LDPOST		+= /usr/lib/crtend.o
LDPOST		+= /usr/lib/crtn.o

NAME		:= bsdsetsid

RM			:= rm -f

.SUFFIXES: .S .o

.S.o:
	${AS} ${ASFLAGS} -o ${.TARGET} ${.IMPSRC}

${NAME}: ${OBJS}
	${LD} ${LDFLAGS} -o ${.TARGET} ${.ALLSRC} ${LDPOST}
	# ${CC} -v -o ${.TARGET} ${.ALLSRC}

all: ${NAME}

clean:
	${RM} ${OBJS} ${NAME}

.PHONY: all clean


# Files prefixes index
# --------------------
# c_  -> core program related
# u_  -> utils related