summaryrefslogtreecommitdiff
path: root/net/Makefile
blob: c1e81c02725d4d73de490ee7852da8c69b8187fc (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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114

    ##############
    # Fool Stack #
    ##############

EXE=fool-stack

############ compiler ############

#use our cross compiler
CC=i686-foolos-gcc
AS=i686-foolos-as

#sorry just this
CC=i686-elf-gcc
AS=i686-elf-as

#regular host compilation
CC=gcc
AS=as

############ compiler flags ############

#https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html

CFLAGS=
CFLAGS+=-DPLATFORM_LINUX
#CFLAGS+=-fvar-tracking
#CFLAGS+=-DGIT_REVISION=\"$(GIT_REVISION)\"
#CFLAGS+=-ffreestanding # do we need this if using own compiler?
#CFLAGS+=-nostdlib
#CFLAGS+=-Og
CFLAGS+=-O0
CFLAGS+=-I.
#CFLAGS+=-I/home/miguel/temp/foolos/usr/i686-foolos/include/
#CFLAGS+=-I./asm
#CFLAGS+=-I./kernel
#CFLAGS+=-I./driver
#CFLAGS+=-I./fs
CFLAGS+=-gstabs

#CFLAGS+=-fstack-protector-all
#CFLAGS+=-fno-zero-initialized-in-bss
#CFLAGS+=-fdata-sections -ffunction-sections

#CFLAGS+= -w # disable all warnings
#CFLAGS+= -Wimplicit-function-declaration
CFLAGS+= -Wall
#CFLAGS+= -Wextra 
#CFLAGS+= -pedantic
CFLAGS+= -Werror
CFLAGS+= -Werror=implicit-function-declaration

CFLAGS+= -Wno-unused-variable
CFLAGS+= -Wno-unused-function
CFLAGS+= -Wno-int-conversion
CFLAGS+= -Wno-implicit-int
CFLAGS+= -Wno-incompatible-pointer-types
CFLAGS+= -Wno-discarded-qualifiers
CFLAGS+= -Wno-unused-but-set-variable

#CFLAGS+ = -Wall -Wextra -std=c89 -pedantic -Wmissing-prototypes -Wstrict-prototypes -Wold-style-definition

######## linker flags ####################
LDFLAGS=
LDLIBS+=-lgcc

########## assembler flags #################
ASFLAGS=
ASFLAGS+=-gstabs

########## verbosity ##################3
#V = 0
#CC = @echo "Compiling (i686-elf-gcc) $<..."; i686-elf-gcc
#AS = @echo "Assembling (i686-elf-as) $<..."; i686-elf-as
#CC_1 = $(CCC)
#CC = $(CC_$(V))

############ source and object files and their deps ############

#source files
SOURCES=
SOURCES+=$(wildcard *.c)

#derive object files
OBJECTS=$(patsubst %.c, %.o, $(SOURCES))

#derive and include deps
DEPS=$(patsubst %.c, %.d, $(SOURCES))

# default target
new: clean tags all

newrun: new run

-include ../Makefile.common
-include $(DEPS)

run: all
	./$(EXE)

all: $(OBJECTS)
	@echo "Compiling and linking objects ..."
	$(CC) *.o -o $(EXE)

deps: $(DEPS)
	@echo "Generating deps ..."


tags:
	@echo "Generating ctags .."; ctags --recurse=yes .

clean:
	@echo "Cleaning up..."; rm -f *.d *.o tags $(EXE)