-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
50 lines (41 loc) · 914 Bytes
/
Makefile
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
CC=gcc
CFLAGS=-I. -Wall
DEPS =
OBJ = socket.o main.o gs105e.o shell.o shell_ip.o shell_vlan.o shell_sys.o shell_port.o
ifeq ($(OS),Windows_NT)
CFLAGS += -D WIN32
ifeq ($(PROCESSOR_ARCHITECTURE),AMD64)
CFLAGS += -D AMD64
endif
ifeq ($(PROCESSOR_ARCHITECTURE),x86)
CFLAGS += -D IA32
endif
else
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Linux)
CFLAGS += -D LINUX
endif
ifeq ($(UNAME_S),Darwin)
CFLAGS += -D OSX
endif
UNAME_P := $(shell uname -p)
ifeq ($(UNAME_P),x86_64)
CFLAGS += -D AMD64
endif
ifneq ($(filter %86,$(UNAME_P)),)
CFLAGS += -D IA32
endif
ifneq ($(filter arm%,$(UNAME_P)),)
CFLAGS += -D ARM
endif
endif
%.o: %.c $(DEPS)
$(CC) -c -o $@ $< $(CFLAGS)
gsconfig: $(OBJ)
gcc -o $@ $^ $(CFLAGS)
gs105e.o: gs105e.c gs105e.h socket.h
main.o: main.c gs105e.h socket.h shell.h
shell_vlan.o: shell_vlan.c gs105e.h socket.h shell.h
clean:
rm *.o -rf
rm gsconfig -rf