/[projet1]/public/rules.mk
Defence Force logotype

Contents of /public/rules.mk

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1207 - (show annotations)
Mon Sep 22 18:52:24 2014 UTC (5 years ago) by Jylam
File size: 2044 byte(s)
Initial OSDKPATH message

1 # OSDK rules.mk for GNU Make
2 # Copyright (c) 2014 Jean-Yves Lamoureux <jylam@lnxscene.org>
3
4
5 # Path of the public/ directory (for instance /home/pennysbird/oric/public/)
6
7
8 # OSDKPATH = /home/user/oric/public
9
10
11 CPP = cpp
12 CFLAGS += -Wall
13 TOOLS =$(OSDKPATH)/pc/tools/osdk/main/
14 AS =$(TOOLS)/xa/xa
15 CC =$(TOOLS)/compiler/compiler
16 LINKER =$(TOOLS)/link65/link65
17 MSPLIT =$(TOOLS)/macrosplitter/macrosplitter
18 BIN2TXT =$(TOOLS)/bin2txt/bin2txt
19 FILEPACK =$(TOOLS)/filepack/filepack
20 PICTCONV =$(TOOLS)/pictconv/pictconv
21 LINKLIB =$(TOOLS)/Osdk/_final_/lib/
22 OSDKINC =$(TOOLS)/Osdk/_final_/include/
23 MACROS =$(TOOLS)/Osdk/_final_/macro/MACROS.H
24 .PHONY: $(DATA) compile_c
25
26 ifndef OSDKPATH
27 $(warning ***)
28 $(warning **********************************************)
29 $(warning You must edit)
30 $(warning $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))/rules.mk)
31 $(warning an fill OSDKPATH)
32 $(warning **********************************************)
33 $(error )
34 endif
35
36 RUNBEFOREHACK:=$(shell rm -f $(BIN).final.s $(BIN).final.c)
37 C_FILES=$(filter %.c, $(SRC))
38 %.o: %.s
39 cat $< >> $(BIN).final.s
40 %.o: %.c
41 cat $< >> $(BIN).final.c
42
43 $(BIN): $(DATA) $(OBJ) compile_c
44 ifneq ($(NO_LINK),1)
45 $(info LINKIIIIIING)
46 $(LINKER) -d $(LINKLIB) $(BIN).final.s -o .$(BIN).linked.s
47 else
48 cp $(BIN).final.s .$(BIN).linked.s
49 endif
50 $(AS) .$(BIN).linked.s -o $@.bin -bt 0x500 -C -W -v -l symbols.txt
51 $(TOOLS)/header/header -a1 $(BIN).bin $(BIN).tap 0x500
52 chmod +x $(BIN).tap
53
54 compile_c:
55 ifneq ($(strip $(C_FILES)),)
56 $(CPP) -traditional-cpp -I$(OSDKINC) $(BIN).final.c -o .1$(BIN).c
57 # Remove C comments
58 $(CPP) -xc++ .1$(BIN).c -o .2$(BIN).c
59 # Compile
60 $(CC) -O1 .2$(BIN).c .3$(BIN).c
61 # Apply macros
62 cpp -traditional-cpp -include $(MACROS) .3$(BIN).c -o .0$(BIN).s
63 cp .0$(BIN).s .1$(BIN).s
64 # Removes #'s
65 grep -v '^#' .1$(BIN).s > .2$(BIN).s
66 # Add \n after each assembly instruction
67 $(MSPLIT) .2$(BIN).s .3$(BIN).s
68 cat .3$(BIN).s >> $(BIN).final.s
69 else
70 endif
71 clean::
72 rm -f $(BIN) $(DATA) *.tap *.bin symbols.txt .*.c .*.s
73

  ViewVC Help
Powered by ViewVC 1.1.26